mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Remove unnecessary typing casts in anthropic (#143447)
This commit is contained in:
parent
ccd1a08aca
commit
fa4e0519fa
@ -265,21 +265,21 @@ async def _transform_stream(
|
|||||||
if current_block is None:
|
if current_block is None:
|
||||||
raise ValueError("Unexpected stop event without a current block")
|
raise ValueError("Unexpected stop event without a current block")
|
||||||
if current_block["type"] == "tool_use":
|
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_args = json.loads(current_tool_args) if current_tool_args else {}
|
||||||
tool_block["input"] = tool_args
|
current_block["input"] = tool_args
|
||||||
yield {
|
yield {
|
||||||
"tool_calls": [
|
"tool_calls": [
|
||||||
llm.ToolInput(
|
llm.ToolInput(
|
||||||
id=tool_block["id"],
|
id=current_block["id"],
|
||||||
tool_name=tool_block["name"],
|
tool_name=current_block["name"],
|
||||||
tool_args=tool_args,
|
tool_args=tool_args,
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
elif current_block["type"] == "thinking":
|
elif current_block["type"] == "thinking":
|
||||||
thinking_block = cast(ThinkingBlockParam, current_block)
|
# thinking block
|
||||||
LOGGER.debug("Thinking: %s", thinking_block["thinking"])
|
LOGGER.debug("Thinking: %s", current_block["thinking"])
|
||||||
|
|
||||||
if current_message is None:
|
if current_message is None:
|
||||||
raise ValueError("Unexpected stop event without a current message")
|
raise ValueError("Unexpected stop event without a current message")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user