2.0 KiB
2.0 KiB
RAG Agent with ChromaDB and Web Search
This project implements a Retrieval-Augmented Generation (RAG) agent that uses ChromaDB as the vector store and performs web search to ingest documents. The agent answers user questions by retrieving relevant passages from the stored documents and generating responses with OpenAI’s GPT models.
Features
- ChromaDB vector store (no Qdrant usage)
- Web content ingestion via HTTP fetch
- OpenAI embeddings for vector representation
- GPT-4o-mini for answer generation
- Simple CLI usage
Prerequisites
- Node.js 20+ (ESM support)
- Docker (optional, for running ChromaDB locally)
- OpenAI API key
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 -
Configure environment variables
Create a
.envfile in the project root:CHROMA_HOST=localhost CHROMA_PORT=8000 OPENAI_API_KEY=YOUR_OPENAI_API_KEY -
Run ChromaDB
The simplest way is to use Docker:
docker run -d --name chromadb -p 8000:8000 chromadb/chromaOr install ChromaDB locally following the official docs.
-
Run the agent
npm startThe script will ingest a sample document from GitHub and answer a question about the OpenAI Node.js library.
Project Structure
src/
├── agent.js # RAG agent logic
├── index.js # Entry point
├── vectorStore.js # ChromaDB wrapper
└── webSearch.js # Simple web fetch helper
Notes
- The project does not use Qdrant. All references to Qdrant have been removed.
- Only ChromaDB is used for vector storage.
- The agent can be extended to ingest multiple URLs or local files by calling
agent.ingestFromUrl(url).
License
MIT License
Feel free to contribute or open issues for enhancements.