diff --git a/libs/core/tests/unit_tests/test_tools.py b/libs/core/tests/unit_tests/test_tools.py index c104b9964ed..65effa69e03 100644 --- a/libs/core/tests/unit_tests/test_tools.py +++ b/libs/core/tests/unit_tests/test_tools.py @@ -2355,7 +2355,7 @@ def test_tool_injected_tool_call_id_override_llm_generated() -> None: @tool def foo(x: int, tool_call_id: Annotated[str, InjectedToolCallId]) -> ToolMessage: """Foo.""" - return ToolMessage(x, tool_call_id=tool_call_id) # type: ignore[arg-type] + return ToolMessage(str(x), tool_call_id=tool_call_id) # Test that when LLM generates the tool_call_id, it gets overridden result = foo.invoke( @@ -2368,14 +2368,14 @@ def test_tool_injected_tool_call_id_override_llm_generated() -> None: ) # The tool should receive the real tool call ID, not the LLM-generated one - assert result == ToolMessage(0, tool_call_id="real_tool_call_id") # type: ignore[arg-type] + assert result == ToolMessage("0", tool_call_id="real_tool_call_id") def test_tool_uninjected_tool_call_id() -> None: @tool def foo(x: int, tool_call_id: str) -> ToolMessage: """Foo.""" - return ToolMessage(x, tool_call_id=tool_call_id) # type: ignore[call-overload] + return ToolMessage(str(x), tool_call_id=tool_call_id) with pytest.raises(ValueError, match="1 validation error for foo"): foo.invoke({"type": "tool_call", "args": {"x": 0}, "name": "foo", "id": "bar"})