# RAG Agent with Ollama Embeddings and Qdrant This project implements a Retrieval-Augmented Generation (RAG) agent that uses: - **OllamaEmbeddings** from `langchain-community` for local embeddings. - **Qdrant** as the vector store for efficient similarity search. - **OpenAI LLM** for generating responses. ## Prerequisites - Python 3.10+ - A running local Ollama instance (default: `http://localhost:11434`). - A running local Qdrant instance (default: `http://localhost:6333`). - An OpenAI API key for the LLM. ## Setup ```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 python -m venv .venv source .venv/bin/activate # On Windows use .venv\\Scripts\\activate # Install dependencies pip install -r requirements.txt # or using Poetry # poetry install ``` Create a `.env` file in the project root with your OpenAI key: ``` OPENAI_API_KEY=sk-... ``` ## Running the Agent ```bash python src/main.py ``` You can then interact with the agent in the console. Type `exit` or `quit` to stop. ## Adding Documents The agent automatically creates a Qdrant collection named `rag_collection`. To add documents, you can extend the `vector_store.py` module or use the Qdrant client directly. For example: ```python from vector_store import get_vector_store vs = get_vector_store() vs.add_texts(["Hello world", "Another document"]) ``` ## Testing The project includes a minimal test suite (not shown here). To run tests: ```bash pytest ``` Ensure that your local Ollama and Qdrant instances are running before executing tests. ## License MIT License