50 lines
1.2 KiB
Markdown
50 lines
1.2 KiB
Markdown
# FAQ Bot with ChromaDB and LangChain
|
|
|
|
This project implements a simple FAQ bot that uses **ChromaDB** for vector storage and **LangChain** for building an intelligent agent. The bot can answer questions based on a small knowledge base stored in ChromaDB.
|
|
|
|
## Features
|
|
|
|
- Stores documents in ChromaDB with embeddings from OpenAI.
|
|
- Uses the latest LangChain agent creation method (`initializeAgentExecutorWithOptions`).
|
|
- Simple CLI interface for interacting with the bot.
|
|
- Easy to extend with more documents or tools.
|
|
|
|
## Setup
|
|
|
|
1. **Clone the repository**
|
|
|
|
```bash
|
|
git clone https://github.com/your-username/faq-bot-chromadb.git
|
|
cd faq-bot-chromadb
|
|
```
|
|
|
|
2. **Install dependencies**
|
|
|
|
```bash
|
|
npm install
|
|
```
|
|
|
|
3. **Configure environment**
|
|
|
|
Create a `.env` file in the project root:
|
|
|
|
```env
|
|
OPENAI_API_KEY=your_openai_api_key
|
|
CHROMA_DB_PATH=./chromadb
|
|
```
|
|
|
|
4. **Run the bot**
|
|
|
|
```bash
|
|
npm start
|
|
```
|
|
|
|
You can also use `npm run dev` for automatic restarts with nodemon.
|
|
|
|
## Adding Documents
|
|
|
|
The bot comes with two sample FAQ entries. To add more, edit `src/index.js` or use the `addDocument` function from `src/vectorstore.js`.
|
|
|
|
## License
|
|
|
|
MIT License |