mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-08 02:37:52 +02:00
Apply patch [skip ci]
This commit is contained in:
@@ -908,6 +908,16 @@ def tools_condition(
|
||||
class InjectedState(InjectedToolArg):
|
||||
"""Annotation for injecting graph state into tool arguments.
|
||||
|
||||
.. deprecated:: 0.2.0
|
||||
Use reserved keyword 'state' instead of InjectedState annotation.
|
||||
The annotation-based approach will be removed in a future version.
|
||||
|
||||
Instead of:
|
||||
def tool(x: int, state: Annotated[dict, InjectedState]) -> str:
|
||||
|
||||
Use:
|
||||
def tool(x: int, state) -> str:
|
||||
|
||||
This annotation enables tools to access graph state without exposing state
|
||||
management details to the language model. Tools annotated with InjectedState
|
||||
receive state data automatically during execution while remaining invisible
|
||||
@@ -1318,3 +1328,4 @@ def _get_runtime_arg(tool: BaseTool) -> Optional[str]:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user