Files
povtornyy-ekzamen-faq-bot-c…/README.md
T

85 lines
2.1 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.
# FAQ Bot ChromaDB + MCP-tool
This repository contains a simple FAQ bot that uses **ChromaDB** for vector storage and a single **MCP-tool** for auxiliary functionality. The bot answers user questions by retrieving relevant FAQ documents and generating responses with OpenAIs LLM.
## Features
- **Vector search** with ChromaDB (persisted locally).
- **OpenAI embeddings** (`text-embedding-ada-002`) for document indexing.
- **OpenAI function calling** to invoke a single MCP-tool (`get_current_utc_time`).
- Interactive commandline interface.
## Setup
1. **Clone the repository**
```bash
git clone https://git.brojs.ru/kuzakhmetovartur/povtornyy-ekzamen-faq-bot-chromadb-odin.git
cd povtornyy-ekzamen-faq-bot-chromadb-odin
```
2. **Create a virtual environment**
```bash
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
```
3. **Install dependencies**
```bash
pip install -r requirements.txt
```
4. **Set environment variables**
Create a `.env` file in the project root:
```dotenv
OPENAI_API_KEY=your_openai_api_key
FAQ_FILE=data/faq.jsonl # optional, defaults to data/faq.jsonl
```
5. **Prepare FAQ data**
Place your FAQ documents in `data/faq.jsonl`. Each line should be a JSON object:
```json
{"id": "1", "text": "What is ChromaDB?", "metadata": {"category": "database"}}
{"id": "2", "text": "How to use the MCP-tool?", "metadata": {"category": "tool"}}
```
If the file is missing, the bot will start without preloaded documents.
## Running the Bot
```bash
python src/main.py
```
You will see:
```
FAQ Bot (ChromaDB + MCP-tool). Type 'exit' to quit.
You:
```
Type a question, e.g.:
```
You: What is the current time?
```
The bot may invoke the MCP-tool and return the current UTC time.
## Testing
The repository includes no automated tests, but you can manually verify:
- The bot can answer FAQ questions.
- The MCP-tool is invoked when the model requests it.
- ChromaDB persists data between runs (check the `chromadb/` directory).
## License
MIT License