# RAG Agent with Qdrant and Ollama ## Overview This repository contains a minimal implementation of an AI agent that uses **RAG (Retrieval‑Augmented Generation)** with a local vector store powered by **Qdrant** and embeddings from **Ollama**. The agent can: 1. Add documents to the knowledge base. 2. Search the knowledge base semantically. 3. Answer arbitrary user queries using the stored information. The project is structured into three main files: - `main.py` – entry point with an interactive CLI and examples. - `tools.py` – LangChain tools for adding/searching documents. - `requirements.txt` – Python dependencies. ## Installation ```bash # Pull required Ollama models (run once) ollama pull llama3 ollama pull nomic-embed-text # Install Python packages pip install -r requirements.txt ``` ## Usage Run the interactive client: ```bash python main.py ``` You can use the following commands: - `/add` – add a new document. - `/search ` – perform a semantic search. - `/quit` – exit. - Any other text is treated as a question for the agent. ## Architecture The agent uses LangChain’s `create_agent` with two custom tools: 1. **add_to_knowledge_base** – splits input into chunks, embeds them via Ollama, and stores in Qdrant. 2. **search_knowledge_base** – performs a similarity search on the vector store. The LLM is an Ollama `llama3` model accessed through LangChain’s `ChatOllama`. The embeddings are provided by `OllamaEmbeddings` with the `nomic-embed-text` model. ## Extending Feel free to add more tools or integrate a persistent Qdrant instance instead of an in‑memory one. The code is intentionally simple for educational purposes.