_make_tools_invocation() — langchain Function Reference
Architecture documentation for the _make_tools_invocation() function in test_agent.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 64bbfaac_3c41_2db9_52b6_6979f090cc37["_make_tools_invocation()"] 47a7b285_8e60_f78f_282d_429958c446fa["test_agent.py"] 64bbfaac_3c41_2db9_52b6_6979f090cc37 -->|defined in| 47a7b285_8e60_f78f_282d_429958c446fa ea08f4fd_9d27_8cd9_90d0_31c9bf4bafd2["test_openai_agent_tools_agent()"] ea08f4fd_9d27_8cd9_90d0_31c9bf4bafd2 -->|calls| 64bbfaac_3c41_2db9_52b6_6979f090cc37 style 64bbfaac_3c41_2db9_52b6_6979f090cc37 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/tests/unit_tests/agents/test_agent.py lines 995–1018
def _make_tools_invocation(name_to_arguments: dict[str, dict[str, Any]]) -> AIMessage:
"""Create an AIMessage that represents a tools invocation.
Args:
name_to_arguments: A dictionary mapping tool names to an invocation.
Returns:
AIMessage that represents a request to invoke a tool.
"""
raw_tool_calls = [
{"function": {"name": name, "arguments": json.dumps(arguments)}, "id": str(idx)}
for idx, (name, arguments) in enumerate(name_to_arguments.items())
]
tool_calls = [
ToolCall(name=name, args=args, id=str(idx), type="tool_call")
for idx, (name, args) in enumerate(name_to_arguments.items())
]
return AIMessage(
content="",
additional_kwargs={
"tool_calls": raw_tool_calls,
},
tool_calls=tool_calls,
)
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does _make_tools_invocation() do?
_make_tools_invocation() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/agents/test_agent.py.
Where is _make_tools_invocation() defined?
_make_tools_invocation() is defined in libs/langchain/tests/unit_tests/agents/test_agent.py at line 995.
What calls _make_tools_invocation()?
_make_tools_invocation() is called by 1 function(s): test_openai_agent_tools_agent.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free