attempt fixes

This commit is contained in:
Sydney Runkle
2025-08-06 15:11:39 -04:00
parent 79ce01fd3e
commit 163f0ee7fd
@@ -575,7 +575,7 @@ def create_react_agent(
_should_bind_tools(model, tool_classes, num_builtin=len(llm_builtin_tools)) # type: ignore[arg-type]
and len(tool_classes + llm_builtin_tools) > 0
):
model = cast(Union[BaseChatModelV0, BaseChatModelV1], model).bind_tools(
model = cast(Union[BaseChatModelV0, BaseChatModelV1], model).bind_tools( # type: ignore[assignment]
tool_classes + llm_builtin_tools # type: ignore[operator]
)
@@ -681,6 +681,9 @@ def create_react_agent(
else:
response = cast(AIMessageV1, response)
# Type assertion to help mypy understand the response type
assert isinstance(response, (AIMessageV0, AIMessageV1))
# add agent name to the AIMessage
response.name = name
@@ -714,6 +717,9 @@ def create_react_agent(
else:
response = cast(AIMessageV1, response)
# Type assertion to help mypy understand the response type
assert isinstance(response, (AIMessageV0, AIMessageV1))
# add agent name to the AIMessage
response.name = name
if _are_more_steps_needed(state, response):