1.9 KiB
1.9 KiB
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_collectionand populate it with embeddings.
- Create a collection named
- Ollama server running locally (default port
11434).- Ensure the model
llama3.1(or any other supported model) is available.
- Ensure the model
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: .venv\\Scripts\\activate
# Install dependencies
pip install -r requirements.txt
Usage
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, includinglangchain-qdrantandlangchain-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.