# RAG Agent with LangChain, Qdrant, and Ollama This repository contains a minimal example of a Retrieval-Augmented Generation (RAG) agent built with **LangChain**, **Qdrant**, and **Ollama**. The agent retrieves relevant documents from a local Qdrant vector store and generates answers using an Ollama language model. ## Prerequisites - **Python 3.10+** - **Qdrant** server running locally (default port `6333`). - Create a collection named `rag_collection` and populate it with embeddings. - **Ollama** server running locally (default port `11434`). - Ensure the model `llama3.1` (or any other supported model) is available. ## 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: .venv\\Scripts\\activate # Install dependencies pip install -r requirements.txt ``` ## Usage ```bash python -m src.main ``` You will be prompted to enter a question. The agent will retrieve relevant documents from Qdrant and generate an answer using Ollama. Type `exit` or `quit` to terminate the program. ## Project Structure ``` agent-s-rag-pamyatyu/ ├── requirements.txt ├── src/ │ └── main.py └── README.md ``` - `requirements.txt` – lists all Python dependencies, including `langchain-qdrant` and `langchain-ollama`. - `src/main.py` – contains the RAG agent implementation. - `README.md` – this documentation file. ## Troubleshooting - **Missing dependencies**: Ensure you ran `pip install -r requirements.txt`. - **Qdrant connection errors**: Verify Qdrant is running and the collection name matches `rag_collection`. - **Ollama connection errors**: Verify Ollama is running and the model name is correct. ## License This project is provided as-is for educational purposes. Feel free to modify and extend it. ---