Files
8.-samopisnyy-poiskovyy-age…/README.md
T
kuzakhmetovartur 1c534b07bc
CI / build (3.1) (push) Has been cancelled
CI / build (3.11) (push) Has been cancelled
CI / build (3.8) (push) Has been cancelled
CI / build (3.9) (push) Has been cancelled
feat: solution for '8. Самописный поисковый агент на основе deep agents from scratch'
2026-07-01 03:12:09 +03:00

76 lines
2.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Deep Agent Search with Virtual File System
This project demonstrates a simple deep agent search system that operates on **virtual files** stored entirely in memory. It uses **PyTorch**, **scikit-learn**, and **NumPy** to perform TFIDF vectorization and cosine similarity ranking.
## Features
- **Virtual File System**: Create, read, write, unload, and delete virtual files.
- **Search Agent**: Rank lines from a virtual file based on a query using TFIDF and cosine similarity.
- **Deep Learning Integration**: Uses PyTorch tensors for similarity calculations.
- **Easy to Extend**: Replace the search logic with more sophisticated models (e.g., transformers) without changing the file system.
## Installation
```bash
# Clone the repository
git clone https://git.brojs.ru/kuzakhmetovartur/8.-samopisnyy-poiskovyy-agent-na-osnove-
cd 8.-samopisnyy-poiskovyy-agent-na-osnove-
# Create a virtual environment (optional but recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
```
## Usage
Run the example script:
```bash
python src/main.py
```
You should see output similar to:
```
Search results for query: 'neural networks'
1. Neural networks can approximate complex functions.
2. Deep learning has revolutionized many fields.
3. PyTorch provides dynamic computation graphs.
After unload: Cannot read from unloaded file 'sample.txt'.
```
## Project Structure
```
├── src
│ ├── main.py # Entry point and demo
│ └── virtual_file_system.py # Virtual file system implementation
├── requirements.txt # Dependencies
└── README.md # Documentation
```
## Extending the Search Agent
The `SearchAgent` class in `src/main.py` can be replaced with any model that accepts a query and returns ranked results. For example, you could:
- Load a pretrained transformer (e.g., BERT) and compute embeddings.
- Use a neural ranking model trained on relevance data.
- Integrate with external search APIs.
Just ensure that the agent receives a `VirtualFileSystem` instance and uses `VirtualFile.read()` to access data.
## Testing
Unit tests are not included in this minimal example, but you can add tests using `pytest` to verify:
- Virtual file read/write/unload behavior.
- Search agent ranking correctness.
- Integration of the virtual file system with the agent.
## License
MIT License
```