RAG Agent with ChromaDB and Web Search

This project demonstrates a simple Retrieval-Augmented Generation (RAG) agent that uses ChromaDB for vector storage and similarity search, and performs web search using DuckDuckGo.

Features

  • Vector Store: Stores embeddings in a local ChromaDB collection.
  • RAG Agent: Retrieves relevant documents and constructs an answer.
  • Web Search: Fetches top results from DuckDuckGo.

Setup

# Clone the repository
git clone https://git.brojs.ru/kuzakhmetovartur/ekzamen-rag-agent-s-chromadb-i-veb-poisk.git
cd ekzamen-rag-agent-s-chromadb-i-veb-poisk

# Install dependencies
npm install

# Run the example
npm start

Running Tests

npm test

Configuration

The project uses a local ChromaDB instance by default. If you need to connect to a remote instance, set the following environment variables in a .env file:

CHROMA_HOST=localhost
CHROMA_PORT=8000

Project Structure

src/
  index.js        # Entry point
  agent.js        # RAG agent logic
  vectorStore.js  # ChromaDB wrapper
  search.js       # Web search helper
  utils.js        # Embedding helper
tests/
  vectorStore.test.js
  agent.test.js

Notes

  • The embedding function in utils.js is a deterministic placeholder. Replace it with a real embedding model (e.g., OpenAI embeddings) for production use.
  • The agent currently returns concatenated context as the answer. Integrate a language model for richer responses.

License

MIT License

S
Description
BroJS: Экзамен: RAG-агент с ChromaDB и веб-поиском
Readme 101 KiB
Languages
Python 82.6%
JavaScript 16.6%
Dockerfile 0.8%