Skip to content

Recommended Deployment

After completing the Chat Builder Lab, users should download two files. The file ending in streamlit-app.py is the python script for the chat app’s interface. The requirements.txtfile lists all necessary Python packages, including streamlit and any others used in your template.

Uploading to GitHub

  • Create a new repository on GitHub.
  • Upload the two files generated by Chat Builder: streamlit-app.py and requirements.txt
    • If you added an (optional) image file when you filled in the Chat Builder form, you should also upload this file to this GitHub repository.
  • Optional: to make the next steps easier, you should rename the python script to streamlit-app.py, by removing the auto-generated filename prefix.

Deploying on Streamlit Cloud

Streamlit Cloud will automatically deploy your app based on the contents of your repository.

  • Sign in to Streamlit Cloud using your GitHub account.
  • Click on New App and select Use existing repo option
  • Connect your GitHub repository containing the chatbot files discussed above. Fill in the setup form.

Create New Streamlit

  • Click on advanced settings at the bottom of the “Deploy an App” box and add your OpenAI variables in the secrets field.

  • Copy and paste the following text exactly:

    OPENAI_API_KEY='your_api_key_here'
    ASSISTANT_ID='your_assistant_id'
    PASSKEY='your_own_password or your_api_key'
  • Replace the text inside the quotes for each variable added to the secrets settings. Please be careful not to remove the ' quotation marks, as they are part of the code.

    • your_api_key_here = replace this text with your own API key

    • your_assistant_id = replace this text with the Assistant ID for the Assistant that you will be using with this chat interface. You can find the Assistant ID on the Assistants page in the OpenAI platform.

      • You can also find it using the Assistants Lab on Chat-Lab.AI, just enter your API key, select your assistant, and navigate to the Assistant Details tab.
    • your_own_password or your_api_key = this text gives you the option of creating a password and using that with the interface instead of your API key. Setting your own password has a few benefits, not the least of which is that you don’t have to look up your API key everytime you want to use the app. It also lets you share the app and pay for the API costs, if you choose to do so, without having to share your API key.

      For instance, if your department will reimburse you for student usage, this would be the easiest way to share the app with students. Otherwise, bright, but wily students could begin incurring API costs outside of this app on your dime. If you don’t wish to enable a password, then you should set this variable to your API key. This value should not be left blank. Also, you should change the default value in the screenshot below, unless you want to incur additional API charges from potential hackers.

Secrets Settings
Demo app secrets settings. Note, none of these values are real.