Skip to content

Develop accessible ChatBot with Azure OpenAI and Streamlit

License

Notifications You must be signed in to change notification settings

andreped/chatbot-streamlit-demo

Repository files navigation

title colorFrom colorTo sdk sdk_version app_port emoji pinned license app_file
ChatBot: learn about André's research through an AI assistant
indigo
indigo
streamlit
1.27.2
8501
💬
false
mit
app.py

License Streamlit App CI/CD

This application demonstrates how to setup a simple ChatBot with Azure OpenAI, llama-index, and Streamlit.

The final app is also deployed on both Streamlit and Hugging Face Spaces, as well as embedded into a personal website.

The ChatBot enables you to talk with your own data - in this case, to learn about André's research.

Build Type Status
HF Deploy Deploy
File size check Filesize
Linting Filesize

We have enabled live hosting through both Streamlit and Hugging Face spaces. Click on the respective badges below to access each:

Screenshot 2023-10-24 at 13 44 15

Screenshot 2023-10-24 at 13 03 11

If you wish to play around with the app locally, it requires that you provide OpenAI API key and all that fun stuff yourself.

These instructions were tested on a MacBook Pro with M2 chip running macOS 13.6 Ventura with Python 3.9.6.

  1. Setup virtual environment and install dependencies:
python3 -m venv venv/
source venv/bin/activate
pip install -r requirements.txt
  1. Create the secrets file at .streamlit/secrets.toml and fill in the relevant info:
OPENAI_API_KEY = "<insert OpenAI API key>"
CHATGPT_MODEL = "<insert model name>"
OPENAI_API_BASE = "https://<insert-openai-service-name>.openai.azure.com"
OPENAI_API_VERSION = "<insert version>"
ENGINE = "<insert deployment model name>"
ENGINE_EMBEDDING = "<insert deployment embedding name>"
  1. Launch the app:
streamlit run app.py

A Streamlit browser window should automatically open. If not, the app can be accessed at http://localhost:8501

Only public PDFs were used for this demonstration. Some of André's research is sadly behind a paywall and thus we have chosen not to include the PDFs in this demo to avoid copyright issues.

I wish to acknowledge Sopra Steria for giving me the chance to develop this web application on internal time. I also want to praise OpenAI, Microsoft Azure, and the developers of llama-index, Streamlit, and HuggingFace for making such great tools to develop applications in.

The code in this repository is released under MIT license.