Skip to content

Conversation

Muneer-Shafi
Copy link
Contributor

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

Solution

  • Use $data->hasToolCalls() to check for tool calls existence before mapping
  • Return $data->content when no tool calls are present
  • Maintains proper return type annotation for both scenarios

Changes

  • Modified AssistantMessageNormalizer::normalize() method
  • Added proper null safety check
  • Preserves existing functionality for messages with tool calls

Testing

  • Tested with AssistantMessage containing tool calls
  • Tested with AssistantMessage without tool calls (null toolCalls)
  • No breaking changes to existing API

Closes #[302]

- Use hasToolCalls() check before array_map to prevent TypeError
- Return content when no tool calls are present
- Maintains backward compatibility and proper return types
Copy link

Thanks for your Pull Request! We love contributions.

However, you should instead open your PR on the main repository:
https://github.com/symfony/ai

This repository is what we call a "subtree split": a read-only subset of that main repository.
We're looking forward to your PR there!

@github-actions github-actions bot closed this Aug 11, 2025
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.

1 participant