From fa4e0519fa36c5edc2ab4efc6b9ccd0fae3be2a8 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Tue, 22 Apr 2025 14:05:59 +0200 Subject: [PATCH] Remove unnecessary typing casts in anthropic (#143447) --- homeassistant/components/anthropic/conversation.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/anthropic/conversation.py b/homeassistant/components/anthropic/conversation.py index 288ec63509e..56b8031417b 100644 --- a/homeassistant/components/anthropic/conversation.py +++ b/homeassistant/components/anthropic/conversation.py @@ -265,21 +265,21 @@ async def _transform_stream( if current_block is None: raise ValueError("Unexpected stop event without a current block") if current_block["type"] == "tool_use": - tool_block = cast(ToolUseBlockParam, current_block) + # tool block tool_args = json.loads(current_tool_args) if current_tool_args else {} - tool_block["input"] = tool_args + current_block["input"] = tool_args yield { "tool_calls": [ llm.ToolInput( - id=tool_block["id"], - tool_name=tool_block["name"], + id=current_block["id"], + tool_name=current_block["name"], tool_args=tool_args, ) ] } elif current_block["type"] == "thinking": - thinking_block = cast(ThinkingBlockParam, current_block) - LOGGER.debug("Thinking: %s", thinking_block["thinking"]) + # thinking block + LOGGER.debug("Thinking: %s", current_block["thinking"]) if current_message is None: raise ValueError("Unexpected stop event without a current message")