Skip to content

AnthropicChatGenerator fails tool calls with no arguments when streaming is enabled #1947

@mathislucka

Description

@mathislucka

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:

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions