InjectedToolCallId#

class langchain_core.tools.base.InjectedToolCallId[source]#

Annotation for injecting the tool_call_id.

Example

..code-block:: python

from typing_extensions import Annotated

from langchain_core.messages import ToolMessage from langchain_core.tools import tool, InjectedToolCallID

@tool def foo(x: int, tool_call_id: Annotated[str, InjectedToolCallID]) -> ToolMessage:

β€œβ€β€Return x.””” return ToolMessage(str(x), artifact=x, name=”foo”, tool_call_id=tool_call_id)