mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-15 15:46:47 +00:00
remove unnecessary casting
This commit is contained in:
parent
13719df998
commit
6e2418d44b
@ -393,26 +393,26 @@ def _init_tool_calls(content: list[types.ContentBlock]) -> list[types.ContentBlo
|
|||||||
if isinstance(args_, dict):
|
if isinstance(args_, dict):
|
||||||
new_content.append(
|
new_content.append(
|
||||||
create_tool_call(
|
create_tool_call(
|
||||||
name=cast("str", block.get("name")),
|
name=block.get("name") or "",
|
||||||
args=args_,
|
args=args_,
|
||||||
id=cast("str", block.get("id", "")),
|
id=block.get("id", ""),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
new_content.append(
|
new_content.append(
|
||||||
create_invalid_tool_call(
|
create_invalid_tool_call(
|
||||||
name=cast("str", block.get("name", "")),
|
name=block.get("name", ""),
|
||||||
args=cast("str", block.get("args", "")),
|
args=block.get("args", ""),
|
||||||
id=cast("str", block.get("id", "")),
|
id=block.get("id", ""),
|
||||||
error=None,
|
error=None,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
new_content.append(
|
new_content.append(
|
||||||
create_invalid_tool_call(
|
create_invalid_tool_call(
|
||||||
name=cast("str", block.get("name", "")),
|
name=block.get("name", ""),
|
||||||
args=cast("str", block.get("args", "")),
|
args=block.get("args", ""),
|
||||||
id=cast("str", block.get("id", "")),
|
id=block.get("id", ""),
|
||||||
error=None,
|
error=None,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user