2026-07-01 13:53:42 +03:00

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:

  1. Connect to Qdrant.
  2. Create an Ollama embeddings instance.
  3. Add sample documents to the collection if it is empty.
  4. Build a RetrievalQA chain using the Ollama LLM.
  5. Execute a sample query and print the answer.

Extending

  • Replace the sample documents with your own corpus.
  • Adjust the chain_type in src/agent.py if you need a different retrieval strategy.
  • Use environment variables or a .env file to store sensitive information like QDRANT_API_KEY.

License

MIT License

S
Description
BroJS: Агент с RAG-памятью
Readme 145 KiB
Languages
Python 67.1%
TypeScript 16.6%
JavaScript 15.4%
Dockerfile 0.9%