First, ensure that Python 3 is installed on your machine. Then, install the required Python packages by running the following command:
pip install --upgrade -r requirements.txt
Before running the script, you need to export your OpenAI API key as an environment variable. Replace YOUR_API_KEY
with your actual OpenAI API key.
export OPENAI_API_KEY=YOUR_API_KEY
To create an assistant and thread, run the script with the --create-assistant
flag:
python openai_manager.py --create-assistant --create-thread
Make sure to copy the assistant and thread ids into your app.py file.
To create a new thread, use the following command:
python openai_manager.py --create-thread
If you need to delete an old thread, you can do so by providing the thread ID to the --delete-thread
option:
python openai_manager.py --delete-thread=THREAD_ID
Replace THREAD_ID
with the actual ID of the thread you want to delete.
To run the Streamlit app, navigate to the directory containing your Streamlit script (assuming it's named app.py) and execute the following command:
streamlit run app.py
Ensure that the environment variable for the OpenAI API key is set each time in the terminal session where you are running the script.