42 lines
904 B
Markdown
42 lines
904 B
Markdown
# RAG‑Agent with ChromaDB and Tavily
|
||
|
||
## What is it?
|
||
|
||
A small demo of a LangChain agent that can answer questions using either a local knowledge base stored in **ChromaDB** or live web search via **Tavily**. The agent automatically chooses the source based on the query and returns the answer together with a source label.
|
||
|
||
## Prerequisites
|
||
|
||
* Python 3.10+
|
||
* Ollama (downloaded models below)
|
||
|
||
```bash
|
||
ollama pull llama3
|
||
ollama pull nomic-embed-text
|
||
```
|
||
|
||
## Installation
|
||
|
||
```bash
|
||
pip install -r requirements.txt
|
||
```
|
||
|
||
Create a `.env` file in the project root with your Tavily API key:
|
||
|
||
```
|
||
TAVILY_API_KEY=your_key_here
|
||
```
|
||
|
||
## Data
|
||
|
||
Place any `.txt` or `.md` files you want to index into the `documents/` folder.
|
||
|
||
## Usage
|
||
|
||
```bash
|
||
python main.py
|
||
```
|
||
|
||
You will see a prompt. Type your question and press Enter. Type `exit` to quit.
|
||
|
||
The output shows the answer and the source (`chromadb` or `tavily`).
|