Zhuoxi2000 opened a new issue, #914: URL: https://github.com/apache/flink-agents/issues/914
### Search before asking - [x] I searched in the [issues](https://github.com/apache/flink-agents/issues) and found nothing similar. ### Description `AnthropicChatModelConnection.chat` reads the response text via `message.content[0].text`. When the model calls a tool, the response often contains only a `tool_use` block, so `content[0]` is a `ToolUseBlock` and `.text` raises `AttributeError: 'ToolUseBlock' object has no attribute 'text'`. Both the `tool_use` and `else` return paths use this unsafe access — even though the code just above already iterates `message.content` filtering by `type == "tool_use"`, so the blocks are known to be mixed-type. Expected: use the first text block if present, otherwise `""`. ### How to reproduce Any prompt where Claude returns just a tool call. The failing access, with real SDK types: ```python from anthropic.types import Message, ToolUseBlock, Usage msg = Message(id="m", model="claude", role="assistant", type="message", stop_reason="tool_use", content=[ToolUseBlock(type="tool_use", id="t", name="add", input={"a": 1, "b": 2})], usage=Usage(input_tokens=1, output_tokens=1)) msg.content[0].text # AttributeError: 'ToolUseBlock' object has no attribute 'text' ``` ### Version and environment - `main` (also present in 0.3.0). Component: Anthropic chat model integration (Python). Response-parsing logic; environment-independent. ### Are you willing to submit a PR? - [x] I'm willing to submit a PR! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
