Before you can run this chatbot, make sure you have the following prerequisites installed:
- Python
- Streamlit
- OpenAI Python SDK
- TOML library
You can install the required libraries using pip:
pip install streamlit openai toml-
Clone the repository or create a new project directory for this chatbot.
-
Inside your project directory, create a folder named
streamlit. This folder will contain thesecrets.tomlfile where you'll store your OpenAI API key. -
Obtain an OpenAI API key and place it in the
secrets.tomlfile as follows:# secrets.toml OPENAI_API_KEY = "YOUR_OPENAI_API_KEY_HERE"
-
Create a Python script (e.g.,
app.py) and paste the provided code into this script. -
Run the chatbot application using the following command:
streamlit run app.py