Skip to main content

Chatbot Demo App

img.png

This is a simple chatbot demo that uses AIMon to check responses to user queries. The chatbot is built using LLamaIndex. This chatbot application intentionally crawls a single webpage. This way we can demonstrate how AIMon's hallucination detector works when the chatbot is asked questions that are not related to the webpage, in which case it is likely to answer out of its own learned knowledge.

Code

The code for the summarization app can be found in the github repository.

Setup

Make sure you have the AIMon API key which can be obtained by signing up on the AIMon website.

Installation

  1. First install AIMon's Python SDK and get the API key as described in the Quickstart section.

  2. Clone the repository.

    git clone https://github.com/aimonlabs/aimon-python-sdk.git
  3. Install the required packages from the requirements.txt file specified in this directory.

    cd examples/streamlit_apps/chatbot
    pip install -r requirements.txt

API Keys

After signing up on the AIMon website, you can obtain the key by navigating to My Account -> Keys -> Copy API Key on the UI:

copy_api_key_ui.png

You will need to specify AIMon and OpenAI API keys as part of their respective environment variables.

export OPENAI_API_KEY=YOUR_OPENAI_API_KEY
export AIMON_API_KEY=YOUR_AIMON_API_KEY

Running the Chatbot

The chatbot is a streamlit app. You can run it using this command:

python -m streamlit run aimon_chatbot_demo.py

Now, you can navigate to the UI and see the metrics populated for your application as shown below:

ui_with_metrics.png