bd49075b6e3b975e2e4058b3de2bb17e957073f1
CI / build (push) Has been cancelled
Agent with RAG Memory using Qdrant and Ollama
This project demonstrates a simple Retrieval-Augmented Generation (RAG) agent built with LangChain, Qdrant, and Ollama. The agent uses Ollama embeddings for vector representation and Qdrant as the vector store.
Prerequisites
- Python 3.10+
- Qdrant server running locally or accessible remotely
- Ollama server running locally or accessible remotely
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
Configuration
Edit config.py to match your environment:
# Qdrant settings
QDRANT_HOST = "localhost"
QDRANT_PORT = 6333
QDRANT_API_KEY = None
QDRANT_COLLECTION = "rag_collection"
# Ollama settings
OLLAMA_MODEL = "llama3"
Running the Agent
python src/main.py
The script will:
- Connect to Qdrant.
- Create an Ollama embeddings instance.
- Add sample documents to the collection if it is empty.
- Build a RetrievalQA chain using the Ollama LLM.
- Execute a sample query and print the answer.
Extending
- Replace the sample documents with your own corpus.
- Adjust the
chain_typeinsrc/agent.pyif you need a different retrieval strategy. - Use environment variables or a
.envfile to store sensitive information likeQDRANT_API_KEY.
License
MIT License
Description
Languages
Python
67.1%
TypeScript
16.6%
JavaScript
15.4%
Dockerfile
0.9%