1.9 KiB
1.9 KiB
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_numberstool. - Search Items – Search a predefined list of strings for a query using the
search_itemtool. - Interactive CLI – Use
/add,/search, and/quitcommands to interact with the agent.
Installation
# 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:
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.>> /add 5 7 Result: 12 -
/search
Search the internal memory for a query string.>> /search python Matches found: 1. Python programming -
/quit
Exit the program.>> /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!