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

92 lines
2.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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
```bash
# 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
```bash
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:
```bash
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:
```bash
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!