mirror of
https://github.com/hwchase17/langchain.git
synced 2026-02-21 06:33:41 +00:00
fix: lint
This commit is contained in:
@@ -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"})
|
||||
|
||||
Reference in New Issue
Block a user