Files
ekzamen-rag-agent-s-chromad…/README.md
T

82 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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 OpenAIs 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
1. **Clone the repository**
```bash
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
```
2. **Install dependencies**
```bash
npm install
```
3. **Configure environment variables**
Create a `.env` file in the project root:
```dotenv
CHROMA_HOST=localhost
CHROMA_PORT=8000
OPENAI_API_KEY=YOUR_OPENAI_API_KEY
```
4. **Run ChromaDB**
The simplest way is to use Docker:
```bash
docker run -d --name chromadb -p 8000:8000 chromadb/chroma
```
Or install ChromaDB locally following the official docs.
5. **Run the agent**
```bash
npm start
```
The 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.