File tree Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ def parse_llm_err(e: OpenAIAPIError) -> LLMError:
9191 LLMError: Error to be sent to the user
9292 """
9393 msg = "Error from OpenAI. "
94- if hasattr (e , "body" ) and "message" in e .body :
94+ if hasattr (e , "body" ) and isinstance ( e . body , dict ) and "message" in e .body :
9595 msg += e .body ["message" ]
9696 else :
9797 msg += e .message
Original file line number Diff line number Diff line change @@ -245,7 +245,7 @@ def run_completion(
245245 except OpenAIAPIError as e :
246246 msg = "OpenAI error: "
247247 msg += e .message
248- if hasattr (e , "body" ) and "message" in e .body :
248+ if hasattr (e , "body" ) and isinstance ( e . body , dict ) and "message" in e .body :
249249 msg += e .body ["message" ]
250250 if isinstance (e , OpenAIRateLimitError ):
251251 raise RateLimitError (msg )
You can’t perform that action at this time.
0 commit comments