Skip to content

Conversation

@Muneer-Shafi
Copy link
Contributor

@Muneer-Shafi Muneer-Shafi commented Aug 11, 2025

Q A
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #302
License MIT

Summary

Fixes a TypeError in AssistantMessageNormalizer::normalize() that occurs when $data->toolCalls is null in the Anthropic bridge.

Problem

The current implementation calls array_map() on potentially null toolCalls:

'content' => array_map(static function (ToolCall $toolCall) {
    // ...
}, $data->toolCalls ?? []),

@carsonbot carsonbot changed the title Fix TypeError in AssistantMessageNormalizer when toolCalls is null Fix TypeError in AssistantMessageNormalizer when toolCalls is null Aug 11, 2025
@Muneer-Shafi Muneer-Shafi changed the title Fix TypeError in AssistantMessageNormalizer when toolCalls is null [AIBundle] Fix TypeError in AssistantMessageNormalizer when toolCalls is null Aug 11, 2025
@Muneer-Shafi Muneer-Shafi force-pushed the fix-assistant-message-normalizer-null-toolcalls branch from 969669d to e08c3b1 Compare August 11, 2025 12:28
@Muneer-Shafi Muneer-Shafi changed the title [AIBundle] Fix TypeError in AssistantMessageNormalizer when toolCalls is null [Bridge\Anthropic] Fix TypeError in AssistantMessageNormalizer when toolCalls is null Aug 11, 2025
Copy link
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Muneer-Shafi and welcome to the repository! :)
Thanks for working on that fix - can you please bring in a test case to prove error and fix?

@chr-hertel chr-hertel changed the title [Bridge\Anthropic] Fix TypeError in AssistantMessageNormalizer when toolCalls is null [Platform][Anthropic] Fix TypeError in AssistantMessageNormalizer when toolCalls is null Aug 11, 2025
@chr-hertel chr-hertel added the Platform Issues & PRs about the AI Platform component label Aug 11, 2025
@Muneer-Shafi
Copy link
Contributor Author

Hi @Muneer-Shafi and welcome to the repository! :) Thanks for working on that fix - can you please bring in a test case to prove error and fix?

@chr-hertel i have updated test for Claude AssistantMessageNormalizerTest

@chr-hertel chr-hertel added the Bug Something isn't working label Aug 12, 2025
@chr-hertel chr-hertel force-pushed the fix-assistant-message-normalizer-null-toolcalls branch from 31a1be6 to 19f0952 Compare August 12, 2025 07:15
@chr-hertel
Copy link
Member

Thank you @Muneer-Shafi.

@chr-hertel chr-hertel merged commit 4a6f72b into symfony:main Aug 12, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working Platform Issues & PRs about the AI Platform component Status: Reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Platform] AssistantMessageNormalizer throws TypeError when toolCalls is null

3 participants