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

2.4 KiB
Raw Blame History

FAQ Bot ChromaDB + Ollama

This project implements a simple FAQ bot that uses ChromaDB as the vector store and Ollama for embeddings and language generation.
The bot is built with LangChain and relies on a single MCPTool to retrieve relevant documents and generate answers.

Features

  • Embeddings: Uses the nomic-embed-text model from Ollama.
  • Vector Store: Stores embeddings in a persistent ChromaDB collection.
  • LLM: Generates answers with the llama3 model from Ollama.
  • MCPTool: A single tool that handles retrieval and generation in one step.
  • CLI: Interactive commandline interface for quick testing.

Setup

# Clone the repository
git clone https://git.brojs.ru/kuzakhmetovartur/povtornyy-ekzamen-faq-bot-chromadb-odin.git
cd povtornyy-ekzamen-faq-bot-chromadb-odin

# Create a virtual environment (optional but recommended)
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\\Scripts\\activate

# Install dependencies
pip install -r requirements.txt

Data

Place your FAQ documents as plain text files (*.txt) in the data/ directory.
Each file will be loaded, embedded, and stored in ChromaDB.

Running the Bot

python -m src.main

You will see a prompt:

FAQ Bot powered by ChromaDB and Ollama.
Type 'exit' to quit.

Your question:

Type a question and press Enter. The bot will return an answer.

Testing

Run the unit tests to verify that the bot uses the correct components:

python -m unittest discover -s tests

All tests should pass, confirming that:

  • The embeddings are from OllamaEmbeddings.
  • The vector store is a Chroma instance.
  • No OpenAI modules are imported.
  • Answers are returned as strings.

Project Structure

├── data/                # FAQ documents (plain text)
├── chroma_db/           # Persisted ChromaDB collection
├── src/
│   └── main.py          # Bot implementation
├── tests/
│   └── test_main.py     # Unit tests
├── requirements.txt
└── README.md

Notes

  • The bot requires an Ollama server running locally.
    Ensure that the nomic-embed-text and llama3 models are available:

    ollama pull nomic-embed-text
    ollama pull llama3
    
  • The vector store is persisted in the chroma_db/ directory.
    If you add new documents, delete this folder and rerun the bot to rebuild the index.

Enjoy building your FAQ bot!