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

2.3 KiB
Raw Blame History

FAQ Bot ChromaDB + Ollama

This repository contains a simple FAQ chatbot that uses:

  • Ollama for embeddings (nomic-embed-text) and text generation.
  • ChromaDB as the vector store.
  • LangChain to orchestrate the retrieval and generation pipeline.

Features

  • Loads a small set of FAQ questions and answers.
  • Generates embeddings with the nomic-embed-text model.
  • Stores embeddings in a persistent ChromaDB collection.
  • Retrieves the most relevant answer to a user query.
  • Generates a natural language response using an Ollama LLM.

Requirements

  • Python 3.10+
  • Ollama server running locally (default port 11434).
    Install from https://ollama.ai/ and pull the required models:
    ollama pull nomic-embed-text
    ollama pull llama3   # or any other generation model you prefer
    

Installation

# Clone the repository
git clone https://github.com/your-username/faq-bot.git
cd faq-bot

# 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

Usage

python src/main.py

You will see a prompt:

FAQ Bot is ready. Type your question (or 'exit' to quit).

Type any of the predefined FAQ questions or any other question, and the bot will respond with the most relevant answer.

Project Structure

faq-bot/
├── src/
│   └── main.py          # Main application script
├── requirements.txt     # Python dependencies
└── README.md            # This file

Customizing the FAQ

The FAQ data is currently hardcoded in src/main.py. To add more questions:

  1. Open src/main.py.
  2. Edit the faq_pairs list inside the load_faq_data() function.
  3. Restart the bot.

Persistence

The vector store is persisted in the chroma_db/ directory. The next time you run the bot, it will reuse the existing embeddings instead of recomputing them.

Troubleshooting

  • Ollama not found: Ensure the Ollama server is running and accessible at http://localhost:11434.
  • Embedding errors: Verify that the nomic-embed-text model is pulled (ollama list).
  • Vector store errors: Delete the chroma_db/ directory if you suspect corruption.

License

MIT License