42 lines
1.4 KiB
Markdown
42 lines
1.4 KiB
Markdown
# FAQ Bot – ChromaDB + MCP-tool
|
||
|
||
This project implements a simple FAQ bot that uses **ChromaDB** as the sole vector store and a single **Minimal Context‑Aware Prompt (MCP) tool** for prompt generation.
|
||
|
||
## Stack
|
||
|
||
- **ChromaDB** – vector database for storing and querying embeddings.
|
||
- **MCP-tool** – a lightweight function that creates a prompt from a user question.
|
||
- **Node.js** – runtime environment.
|
||
- **readline-sync** – simple CLI input.
|
||
|
||
## How it works
|
||
|
||
1. **Vector Store**
|
||
- `src/vectorStore.js` wraps ChromaDB.
|
||
- Documents are embedded using a deterministic 768‑dimensional vector derived from word hashes.
|
||
- The collection is created (or fetched) on startup.
|
||
|
||
2. **MCP-tool**
|
||
- `src/bot.js` contains `generatePrompt` which formats the user question into a prompt.
|
||
- The prompt is embedded and queried against the vector store.
|
||
|
||
3. **Bot Loop**
|
||
- `src/index.js` loads a small FAQ dataset, populates the collection, and starts a REPL loop.
|
||
- User input is processed, the best matching FAQ answer is returned.
|
||
|
||
## Running the bot
|
||
|
||
```bash
|
||
npm install
|
||
npm start
|
||
```
|
||
|
||
Type a question and press Enter. Type `exit` to quit.
|
||
|
||
## Notes
|
||
|
||
- Only **ChromaDB** is used for vector operations; no other vector store libraries are present.
|
||
- Only **one MCP-tool** (`generatePrompt`) is integrated.
|
||
- The code is fully self‑contained and can be extended with real embeddings or a larger dataset.
|
||
|
||
--- |