Skip to content

Commit

Permalink
fix: [azure_openai] Error: 'NoneType' object has no attribute 'conten…
Browse files Browse the repository at this point in the history
  • Loading branch information
sagarey authored and Gzn committed Apr 15, 2024
1 parent dfd3814 commit f05aeb5
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,12 @@ def _handle_chat_generate_stream_response(self, model: str, credentials: dict,

delta = chunk.choices[0]

if delta.finish_reason is None and (delta.delta.content is None or delta.delta.content == '') and \
delta.delta.function_call is None:
# Handling exceptions when content filters' streaming mode is set to asynchronous modified filter
if delta.delta is None or (
delta.finish_reason is None
and (delta.delta.content is None or delta.delta.content == '')
and delta.delta.function_call is None
):
continue

# assistant_message_tool_calls = delta.delta.tool_calls
Expand Down

0 comments on commit f05aeb5

Please sign in to comment.