Skip to content

Commit

Permalink
Only reraise if it is not a streaming error.
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcCote committed Jun 12, 2024
1 parent 74b86e5 commit 79e802c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bytes32/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ def stream_llm_gpt(prompt, model="gpt-3.5-turbo", **kwargs):
except (openai.APITimeoutError, openai.APIError, ChunkedEncodingError, ReadError, RemoteProtocolError) as e:
if isinstance(e, openai.APIError):
print("*****", e.type)
if "An error occurred during streaming" not in e.message:
raise e

# Append the response we received so far to messages.
if len(messages) == 1:
messages.append({"role": "assistant", "content": response})
Expand Down

0 comments on commit 79e802c

Please sign in to comment.