From 24ac5928ed79f6bde4270655219861e96f7186e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Ho=CC=88nicke?= Date: Tue, 23 May 2023 16:24:43 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9B=93=20fix:=20langchain=20dependency?= =?UTF-8?q?=20issue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 2 ++ 1 file changed, 2 insertions(+) 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 From 8eba10b3d9ca0fee764f74127a69598d2660be37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Ho=CC=88nicke?= Date: Tue, 23 May 2023 16:29:16 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9A=BE=20fix:=20catch=20api=20error=20fr?= =?UTF-8?q?om=20openai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dev_gpt/apis/gpt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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