This AI Chatbot Starter is designed to help developers find the information they need to debug their issues.
It should answer customer questions about the products or services specified.
- Clone the repository
- Make sure you have Python 3.11 installed
- Get required Astra credentials from Anant
Now follow the steps below to get the chatbot up and running.
Documentation (provided as a list of web urls in the config.yml
) can be ingested into your Astra DB Collection. Follow these steps:
-
Obtain your OpenAI API Key from the OpenAI Settings page.
-
Create a
config.yml
file with the values required. Here you specify both the list of pages to scrape, as well as the list of rules for your chatbot to observe. For an example of how this can look, take a look at eitherconfig.yml.example_datastax
, orconfig.yml.example_pokemon
. -
Create a
.env
file & add the required information. Add the OpenAI Key from Step 1 as the value ofOPENAI_API_KEY
. The Astra and OpenAI env variables are required, while the others are only needed if the respective integrations are enabled. For an example of how this can look, take a look at.env_example
. -
From the root of the repository, run the following command. This will scrape the pages specified in the
config.yml
file into text files within theoutput
folder of yourai-chatbot-starter
directory.PYTHONPATH=. python data/scrape_site.py
-
From the root of the repository, run the following command. This will store the embeddings for the scraped text in your AstraDB instance.
PYTHONPATH=. python data/compile_documents.py
-
From the root of the repository, run the following command. Process requires, Playlist.yaml as input and looks like below
This will get video ids using playlist ids or play list url's specified in the playlist_ids.yaml
. These video ids will be appended to video_ids.yaml
file present under ai-chatbot-starter
directory.
PYTHONPATH=. python data/playlist.py
- From the root of the repository, run the following command. Process require video_ids.yaml as input and looks like below.
This will scrape videos specified in the video_ids.yaml
file into text files within the video_output
folder of your ai-chatbot-starter
directory.
PYTHONPATH=. python data/scrape_videos.py
- From the root of the repository, run the following command. This will store the embeddings for the scraped videos to your AstraDB instance.
PYTHONPATH=. python data/compile_documents.py "video"
If you have Docker installed, you can run the app using the following command:
-
Build the docker image using the following command:
docker build -t docker_aibot --no-cache .
-
Run the docker image using the following command:
docker run -p 5555:5555 docker_aibot
-
You can test an example query by running:
python scripts/call_assistant.py "<your_query_here>"
Alternatively, you can run the app normally using the following steps:
-
Install the requirements using the following command:
pip install -r requirements.txt
-
Run the app using the following command:
uvicorn app:app --host 0.0.0.0 --port 5555 --reload
-
You can test an example query by running:
python scripts/call_assistant.py "<your_query_here>"
-
To run the chainlit front-end:
python -m chainlit run chainlit_app.py -w