51 lines
1.3 KiB
Markdown
51 lines
1.3 KiB
Markdown
# RAG Agent with ChromaDB and Web Search
|
||
|
||
This project demonstrates a simple Retrieval-Augmented Generation (RAG) agent that uses **ChromaDB** as the vector store and performs web search as a fallback. The agent is written in Node.js and uses only the required dependencies.
|
||
|
||
## Features
|
||
|
||
- **Vector storage** with ChromaDB (in-memory by default).
|
||
- **Simple embedding** function (placeholder) – replace with a real model for production.
|
||
- **Web search** using DuckDuckGo’s HTML interface.
|
||
- **RAG agent** that retrieves relevant documents or falls back to web search.
|
||
|
||
## Installation
|
||
|
||
```bash
|
||
npm install
|
||
```
|
||
|
||
## Usage
|
||
|
||
```bash
|
||
node src/index.js "Your query here"
|
||
```
|
||
|
||
If no query is provided, it defaults to `"What is ChromaDB?"`.
|
||
|
||
## Running Tests
|
||
|
||
```bash
|
||
npm test
|
||
```
|
||
|
||
## Project Structure
|
||
|
||
```
|
||
src/
|
||
index.js # Entry point
|
||
agent.js # RAG agent logic
|
||
vectorStore.js # ChromaDB wrapper
|
||
webSearch.js # Simple web search helper
|
||
test.js # Basic test for vector store
|
||
```
|
||
|
||
## Extending
|
||
|
||
- Replace the `embed` function in `vectorStore.js` with a real embedding model (e.g., OpenAI, HuggingFace).
|
||
- Persist the ChromaDB collection by configuring the client with a storage path.
|
||
- Add a language model to generate responses from retrieved documents.
|
||
|
||
## License
|
||
|
||
MIT |