Skip to content

fix(azure): handle None types in streaming tool aggregation#7185

Closed
davidfertube wants to merge 1 commit intomicrosoft:mainfrom
davidfertube:fix/azure-streaming-none-type
Closed

fix(azure): handle None types in streaming tool aggregation#7185
davidfertube wants to merge 1 commit intomicrosoft:mainfrom
davidfertube:fix/azure-streaming-none-type

Conversation

@davidfertube
Copy link

Summary

Fixes #7157 where AzureAIChatCompletionClient raises TypeError during streaming tool calls if chunks contain None fields.

Changes

Added if is not None checks in the tool call aggregation loop in _azure_ai_client.py:

  • Checked tool_call_chunk.id
  • Checked tool_call_chunk.function.name
  • Checked tool_call_chunk.function.arguments

Verification

The fix implements standard guard clauses similar to the OpenAI client implementation. This ensures partial updates (which may have None fields) are handled gracefully.

Added guard clauses to check for None values in tool_call_chunk attributes (id, function.name, function.arguments) before concatenation.
This prevents TypeError when Azure AI services return incomplete chunks during streaming.

Fixes #7157
@davidfertube davidfertube closed this by deleting the head repository Jan 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AzureAIChatCompletionClient streaming tool_calls can include None fields, causing TypeError

1 participant