2026-07-01 14:05:59 +03:00

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

# 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

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:

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:

pytest

Ensure that your local Ollama and Qdrant instances are running before executing tests.

License

MIT License

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