diff --git a/streamly.py b/streamly.py index b789bc4..8b8db29 100644 --- a/streamly.py +++ b/streamly.py @@ -10,7 +10,7 @@ import base64 -from openai import OpenAI +from openai import OpenAI, OpenAIError client = OpenAI() logging.basicConfig(level=logging.INFO) @@ -217,7 +217,7 @@ def on_chat_submit(chat_input, api_key, latest_updates, use_langchain=False): st.session_state.history.append({"role": "user", "content": user_input}) st.session_state.history.append({"role": "assistant", "content": assistant_reply}) - except openai.APIConnectionError as e: + except OpenAIError.APIConnectionError as e: logging.error(f"Error occurred: {e}") error_message = f"OpenAI Error: {str(e)}" st.error(error_message)