96 lines
1.9 KiB
Markdown
96 lines
1.9 KiB
Markdown
# Agent with RAG Memory
|
||
|
||
This project demonstrates a simple RAG (Retrieval-Augmented Generation) agent that uses LangChain tools to perform basic operations via an interactive command line interface (CLI).
|
||
|
||
## Features
|
||
|
||
- **Add Numbers** – Add two integers using the `add_numbers` tool.
|
||
- **Search Items** – Search a predefined list of strings for a query using the `search_item` tool.
|
||
- **Interactive CLI** – Use `/add`, `/search`, and `/quit` commands to interact with the agent.
|
||
|
||
## Installation
|
||
|
||
```bash
|
||
# Clone the repository
|
||
git clone https://git.brojs.ru/kuzakhmetovartur/agent-s-rag-pamyatyu.git
|
||
cd agent-s-rag-pamyatyu
|
||
|
||
# Create a virtual environment (optional but recommended)
|
||
python -m venv .venv
|
||
source .venv/bin/activate # On Windows use `.venv\\Scripts\\activate`
|
||
|
||
# Install dependencies
|
||
pip install -r requirements.txt
|
||
```
|
||
|
||
## Usage
|
||
|
||
Run the CLI:
|
||
|
||
```bash
|
||
python -m src.main
|
||
```
|
||
|
||
You will see a prompt:
|
||
|
||
```
|
||
Welcome to the RAG Agent CLI!
|
||
Available commands:
|
||
/add <int> <int> - Add two numbers.
|
||
/search <query> - Search items in memory.
|
||
/quit - Exit the program.
|
||
```
|
||
|
||
### Commands
|
||
|
||
- **/add**
|
||
Add two integers.
|
||
|
||
```text
|
||
>> /add 5 7
|
||
Result: 12
|
||
```
|
||
|
||
- **/search**
|
||
Search the internal memory for a query string.
|
||
|
||
```text
|
||
>> /search python
|
||
Matches found:
|
||
1. Python programming
|
||
```
|
||
|
||
- **/quit**
|
||
Exit the program.
|
||
|
||
```text
|
||
>> /quit
|
||
Goodbye!
|
||
```
|
||
|
||
## Project Structure
|
||
|
||
```
|
||
agent-s-rag-pamyatyu/
|
||
├── src/
|
||
│ ├── __init__.py
|
||
│ ├── cli.py
|
||
│ ├── main.py
|
||
│ └── tools.py
|
||
├── README.md
|
||
├── requirements.txt
|
||
└── pyproject.toml
|
||
```
|
||
|
||
## Dependencies
|
||
|
||
- `langchain` – The core library for building language model agents.
|
||
- `python-dotenv` – (Optional) For loading environment variables if needed.
|
||
|
||
## License
|
||
|
||
MIT License
|
||
|
||
---
|
||
|
||
Feel free to extend the tools or the CLI to suit your needs! |