From 6ceb617d2307c4c33e164728361450fbc4be5096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B8=D1=80=D0=B8=D0=BB=D0=BB=20=D0=9A=D1=83=D1=82?= =?UTF-8?q?=D0=BB=D0=B0=D1=85=D0=BC=D0=B5=D1=82=D0=BE=D0=B2?= Date: Wed, 27 May 2026 14:34:10 +0000 Subject: [PATCH] add README.md --- README.md | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index df028a1..e10382c 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,60 @@ -# task-6a02e23da6fe2e4ac16acf65-v2 +# RAG Agent with Qdrant and Ollama +## Project Overview +This repository contains a minimal yet complete implementation of an AI agent that can **search** and **add** information to a local knowledge base powered by **Qdrant** (vector database) and **Ollama** (local LLM & embeddings). The agent is built using the LangChain framework. + +The main components are: +- **Vector store** – Qdrant client with an initialized collection. +- **Text splitter** – RecursiveCharacterTextSplitter for chunking documents. +- **Embedding model** – OllamaEmbeddings (`nomic-embed-text`). +- **LLM** – ChatOllama (`llama3`). +- **Tools** – `search_knowledge_base` and `add_to_knowledge_base`. +- **Agent** – created with `create_agent` from LangChain. +- **CLI client** – simple interactive loop to demonstrate adding documents and searching the knowledge base. + +## Directory Structure +``` +├── README.md +├── requirements.txt +├── main.py # CLI entry point +├── agent.py # Agent creation logic +├── tools.py # LangChain tool definitions +├── utils.py # Qdrant client, splitter, and helper functions +└── docs/ # Directory with text files to load initially (optional) +``` + +## Installation +```bash +# Pull required Ollama models +ollama pull llama3 +ollama pull nomic-embed-text + +# Install Python dependencies +pip install -r requirements.txt +``` + +## Usage +1. **Load documents** – Place any `.txt` files in the `docs/` directory. +2. **Run the CLI**: + ```bash + python main.py + ``` +3. In the interactive prompt you can use: + - `/add ` – Add a new document to the knowledge base. + - `/search ` – Search the knowledge base and display results. + - `/quit` – Exit the program. + +## Example +```text +> /search python data structures +1. Python lists are ordered collections... +2. Tuples are immutable sequences... +``` + +## Architecture +- The **agent** is a LangChain agent that uses two tools: `search_knowledge_base` and `add_to_knowledge_base`. It receives user messages, decides which tool to call, and returns the result. +- The **vector store** is wrapped by `QdrantVectorStore`, which handles embedding generation via OllamaEmbeddings. Documents are split into chunks before insertion. +- The **CLI** orchestrates loading documents at startup and provides a simple REPL for demonstration purposes. + +## License +MIT © 2026