Add README.md
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
# RAG Agent
|
||||
|
||||
## Overview
|
||||
|
||||
This project implements a Retrieval‑Augmented Generation (RAG) agent that can search a local knowledge base stored in ChromaDB and the web via Tavily. The agent automatically chooses the appropriate source and indicates it in the response.
|
||||
|
||||
## Features
|
||||
|
||||
- Local vector store with Ollama embeddings (`nomic-embed-text`)
|
||||
- Web search powered by Tavily
|
||||
- Two tools: **Local KB Search** and **Web Search**
|
||||
- Automatic source selection
|
||||
- Persistent vector store between runs
|
||||
- CLI chat loop with exit command
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
# Pull required models
|
||||
ollama pull llama3
|
||||
ollama pull nomic-embed-text
|
||||
|
||||
# Install Python dependencies
|
||||
pip install langchain langchain-chroma langchain-tavily langchain-ollama tavily-python chromadb python-dotenv
|
||||
```
|
||||
|
||||
## Setup
|
||||
|
||||
Create a `.env` file in the project root with your Tavily API key:
|
||||
|
||||
```
|
||||
TAVILY_API_KEY=your_api_key_here
|
||||
CHAT_BASE_URL=http://localhost:11434/v1
|
||||
CHAT_API_KEY=ollama
|
||||
CHAT_MODEL=llama3
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
python main.py --docs_dir path/to/documents
|
||||
```
|
||||
|
||||
- `--docs_dir` (optional) – Directory containing `.txt` or `.md` files to index into the vector store. If omitted, the agent will use the existing persisted store.
|
||||
|
||||
### Example
|
||||
|
||||
```
|
||||
You: What are the latest news about AI agents?
|
||||
Agent: 1. AI Agents in 2024 (https://example.com) ...
|
||||
Source: tavily
|
||||
|
||||
You: Tell me about LangGraph in my notes.
|
||||
Agent: LangGraph is a framework for building ...
|
||||
Source: chromadb
|
||||
```
|
||||
|
||||
## Exiting
|
||||
|
||||
Type `exit` or `quit` to exit the chat loop.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
Reference in New Issue
Block a user