This repository contains the code for a Q&A chatbot API that answers questions based on the content of a website. It also includes scripts to train the bot.
- Scrape website content and store it in a database
- Train the chatbot based on the scraped content
- Expose an API to interact with the chatbot
- Node.js
- pnpm package manager
- OpenAI API key
- Weaviate database (can be run locally)
- Clone the repository:
git clone https://github.com/Ibentau/ibentau-api
- Change the working directory:
cd ibentau-api
- Install dependencies:
pnpm install
-
Set the following environment variables:
OPENAI_API_KEY
: OpenAI API keyWEAVIATE_SCHEME
: eitherhttp
orhttps
WEAVIATE_HOST
: the host of the Weaviate database (e.g.localhost:8080
)
-
Edit the
urls.json
file to include the URLs you want to scrape. -
Adapt the scrapping function in the
scripts/scrape.ts
file to the structure of the web pages you want to scrape.
- Scrape the website content:
pnpm run scrape
- Generate embeddings for the scraped content:
pnpm run generate_embeddings
- Initialize the Weaviate database:
pnpm run init_weaviate
- Start the development server:
pnpm run dev
The API will be available at http://localhost:3000
.
This project is licensed under the terms of the MIT license. See LICENSE for details.