Describe the bug
When streaming is enabled, and the AnthropicChatGenerator produces a tool call with no arguments (i.e. "") then the tool call will fail because we are trying to json.loads the empty string (in this line: https://github.com/deepset-ai/haystack-core-integrations/blame/64e4e6a7a8bdf1f5fb8149dcb6804e69d0c43dfd/integrations/anthropic/src/haystack_integrations/components/generators/anthropic/chat/chat_generator.py#L375).
To Reproduce
Create a tool that needs no arguments and run the AnthropicChatGenerator with streaming enabled. As soon as the tool is called, we will get the json decode error warning.
Describe your environment (please complete the following information):
- OS: [e.g. iOS]
- Haystack version:
- Integration version:
Describe the bug
When streaming is enabled, and the AnthropicChatGenerator produces a tool call with no arguments (i.e.
"") then the tool call will fail because we are trying tojson.loadsthe empty string (in this line: https://github.com/deepset-ai/haystack-core-integrations/blame/64e4e6a7a8bdf1f5fb8149dcb6804e69d0c43dfd/integrations/anthropic/src/haystack_integrations/components/generators/anthropic/chat/chat_generator.py#L375).To Reproduce
Create a tool that needs no arguments and run the AnthropicChatGenerator with streaming enabled. As soon as the tool is called, we will get the json decode error warning.
Describe your environment (please complete the following information):