Files
task-6a1864f78a94f887e50d46da/README.md
T
2026-06-04 20:08:36 +00:00

79 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# RAG Agent with Qdrant and Tavily
This repository implements an AI agent that can answer questions using a local knowledge base stored in **Qdrant** and uptodate information fetched from the web via **Tavily**. The agent is built with **LangChain 1.x** and **Ollama** for local LLM and embeddings.
## Features
* **Local RAG** Semantic search in Qdrant using Ollama embeddings.
* **Web search** Tavily integration for realtime information.
* **Automatic source selection** The LLM decides whether to use the local KB or the web.
* **Persistent vector store** Data is saved in `./qdrant_db` and reused across runs.
* **Interactive CLI** Add documents, ask questions, and see the source.
## Installation
```bash
# 1. Pull required Ollama models
ollama pull llama3
ollama pull nomic-embed-text
# 2. Install Python dependencies
pip install -r requirements.txt
# 3. Run Qdrant (Docker recommended)
# If you prefer a local binary, download from https://qdrant.tech
# Docker command:
# docker run -p 6333:6333 qdrant/qdrant
```
## Usage
```bash
# Start the CLI
python -m workspace.task-6a1864f78a94f887e50d46da.cli
```
Commands:
* `/add <directory>` Load all `.txt` and `.md` files from the directory into Qdrant.
* `/search <question>` Ask the agent a question.
* `/quit` Exit.
Example:
```
> /add ./documents
Loaded 12 chunks into Qdrant.
Documents added.
> /search What is LangGraph?
Answer:
LangGraph is a framework for building ...
Source: chromadb
```
## Environment Variables
* `TAVILY_API_KEY` Your Tavily API key.
Create a `.env` file in the project root:
```
TAVILY_API_KEY=your_api_key_here
```
## Project Structure
```
workspace/
├─ task-6a1864f78a94f887e50d46da/
│ ├─ vector_store.py # Qdrant vector store helpers
│ ├─ tools.py # Local KB and web search tools
│ ├─ agent.py # Agent definition
│ ├─ cli.py # Interactive command line
│ ├─ requirements.txt
│ └─ README.md
```
## License
MIT