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

    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

    python -m venv .venv
    source .venv/bin/activate   # On Windows: .venv\Scripts\activate
    
  3. Install dependencies

    pip install -r requirements.txt
    
  4. Set environment variables

    Create a .env file in the project root:

    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:

    {"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

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

S
Description
BroJS: Повторный экзамен: FAQ-бот — ChromaDB + один MCP-tool
Readme 142 KiB
Languages
Python 100%