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

2.3 KiB
Raw Blame History

FAQ Bot ChromaDB + LangChain

This project implements a simple FAQ bot that uses ChromaDB for vector storage and LangChain as the single MCPtool to retrieve and generate answers.
The bot can ingest FAQ documents, store embeddings in ChromaDB, and answer user questions via a commandline interface.

Features

  • Vector storage ChromaDB (DuckDB + Parquet backend)
  • Embedding model OpenAI embeddings (text-embedding-3-small)
  • LLM OpenAI Chat (gpt-4o-mini by default)
  • MCPtool LangChain (only one MCPtool used)
  • CLI python -m src.main ingest|ask
  • Unit tests pytest

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

    python3 -m venv .venv
    source .venv/bin/activate
    
  3. Install dependencies

    pip install -r requirements.txt
    
  4. Set OpenAI API key

    export OPENAI_API_KEY="sk-..."
    

Usage

Ingest FAQ file

Prepare a text file with FAQ pairs in the following format:

Q: What is Python?
A: Python is a programming language.

Q: What is ChromaDB?
A: ChromaDB is a vector database.

Run:

python -m src.main ingest path/to/faq.txt --collection faq_collection

Ask a question

python -m src.main ask "What is Python?" --collection faq_collection

The bot will print the generated answer.

Testing

Run the test suite:

pytest

Project Structure

src/
├── main.py          # CLI entry point
├── ingest.py        # Ingestion logic
└── retriever.py     # Retrieval & answer generation
tests/
├── test_ingest.py
└── test_retrieval.py
requirements.txt
README.md

Notes

  • The bot uses the default OpenAI embeddings and LLM.
    If you want to change the model, edit the OpenAIEmbeddings() and OpenAIChat() calls in src/ingest.py and src/retriever.py.
  • ChromaDB data is persisted in the chromadb/ directory relative to the project root.
  • The deadline for the assignment is 31.08.2026. All code is committed to the specified Git repository.

Happy coding!