diff --git a/api/core/model_runtime/model_providers/azure_openai/llm/llm.py b/api/core/model_runtime/model_providers/azure_openai/llm/llm.py index 4b89adaa49..eb6d985f23 100644 --- a/api/core/model_runtime/model_providers/azure_openai/llm/llm.py +++ b/api/core/model_runtime/model_providers/azure_openai/llm/llm.py @@ -343,8 +343,12 @@ class AzureOpenAILargeLanguageModel(_CommonAzureOpenAI, LargeLanguageModel): 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