diff --git a/dev_gpt/apis/gpt.py b/dev_gpt/apis/gpt.py index 335eab0..ec6ec99 100644 --- a/dev_gpt/apis/gpt.py +++ b/dev_gpt/apis/gpt.py @@ -10,7 +10,7 @@ from langchain.callbacks import CallbackManager from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler from langchain.chat_models import ChatOpenAI from langchain.schema import HumanMessage, SystemMessage, BaseMessage, AIMessage -from openai.error import RateLimitError +from openai.error import RateLimitError, APIError from requests.exceptions import ConnectionError, ChunkedEncodingError from urllib3.exceptions import InvalidChunkLength @@ -149,7 +149,7 @@ class _GPTConversation: response = self._chat(self.messages) self.conversation_logger.log(self.messages, response) break - except (ConnectionError, InvalidChunkLength, ChunkedEncodingError) as e: + except (ConnectionError, InvalidChunkLength, ChunkedEncodingError, APIError) as e: print('There was a connection error. Retrying...') if i == 9: raise e diff --git a/requirements.txt b/requirements.txt index 97b99b7..8836425 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,4 +7,6 @@ psutil jcloud jina-hubble-sdk langchain==0.0.153 +typing-inspect==0.8.0 +typing_extensions==4.5.0 pydantic==1.10.7 \ No newline at end of file