init
__all__ = ['MakeToolCallNode', 'get_full_tools_by_name', 'get_tools_for_llm_call_by_name']
module-attribute
MakeToolCallNode
Bases: Generic[StateType, ConfigType]
Note: Using a class to wrap the static method for the type checking.
Examples:
MakeToolCallNode[FullGraphState, FullConfig].build(...)
build(tool_call_message_getter, conf_from_run_config, tool_call_getter, allowed_tools_getter, tools_getter, tool_input_state_getter, responses_to_state_update, internal_node_name='general_tool_node', handle_tool_errors=True)
staticmethod
Create a tool call node that can be used in the graph.
This effectively orchestrates the various steps required to make tool calls generally.
Note: This calls all tools concurrently.
| PARAMETER | DESCRIPTION |
|---|---|
tool_call_message_getter
|
A function that returns the latest tool call message from the state.
TYPE:
|
conf_from_run_config
|
A function that returns the validated config to use for the tool call.
TYPE:
|
allowed_tools_getter
|
A function that returns the allowed tools for the agent.
TYPE:
|
tool_call_getter
|
A function that returns the tool calls to make from the tool call message.
TYPE:
|
tools_getter
|
A function that returns the full tools to call (based on tool names, provided deps)
TYPE:
|
tool_input_state_getter
|
A function that returns the additional information to pass to the tools. Note: Information provided should be general to ALL tools called by this node.
TYPE:
|
responses_to_state_update
|
A function that converts the tool response messages to a state update.
TYPE:
|
internal_node_name
|
The name of the node.
TYPE:
|
handle_tool_errors
|
Whether to handle tool errors (default is True). False helpful for testing.
TYPE:
|
get_full_tools_by_name(deps, tool_names)
async
Use this to get tools by their names including any dependencies necessary to run the tool.
Note: Ideally only use this for tools that will actually be used. Some of the tools require additional initialization.
get_tools_for_llm_call_by_name(tool_names)
async
Use this to get the tools cheaply for use in LLM call (without any initialization).
Note: This is useful when the tools won't actually be used, only their args schema is needed for the LLM to see.