Skip to content

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 microsoft#7157
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