2.3 KiB
2.3 KiB
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-textmodel. - 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 hard‑coded in src/main.py. To add more questions:
- Open
src/main.py. - Edit the
faq_pairslist inside theload_faq_data()function. - 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-textmodel is pulled (ollama list). - Vector store errors: Delete the
chroma_db/directory if you suspect corruption.