_xml_to_function_call() — langchain Function Reference
Architecture documentation for the _xml_to_function_call() function in experimental.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 2f365234_b69d_08fc_8892_b7529ec51dbf["_xml_to_function_call()"] ce9a5118_b2cf_f25f_fad5_ea15575e8265["experimental.py"] 2f365234_b69d_08fc_8892_b7529ec51dbf -->|defined in| ce9a5118_b2cf_f25f_fad5_ea15575e8265 a9a83498_6055_e600_f7dc_4634dfd82ff8["_xml_to_tool_calls()"] a9a83498_6055_e600_f7dc_4634dfd82ff8 -->|calls| 2f365234_b69d_08fc_8892_b7529ec51dbf 5caceaa3_b456_6fdf_116f_ca7f168a1487["_xml_to_dict()"] 2f365234_b69d_08fc_8892_b7529ec51dbf -->|calls| 5caceaa3_b456_6fdf_116f_ca7f168a1487 style 2f365234_b69d_08fc_8892_b7529ec51dbf fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/anthropic/langchain_anthropic/experimental.py lines 103–133
def _xml_to_function_call(invoke: Any, tools: list[dict]) -> dict[str, Any]:
name = invoke.find("tool_name").text
arguments = _xml_to_dict(invoke.find("parameters"))
# make list elements in arguments actually lists
filtered_tools = [tool for tool in tools if tool["name"] == name]
if len(filtered_tools) > 0 and not isinstance(arguments, str):
tool = filtered_tools[0]
for key, value in arguments.items():
if (
key in tool["parameters"]["properties"]
and "type" in tool["parameters"]["properties"][key]
):
if tool["parameters"]["properties"][key][
"type"
] == "array" and not isinstance(value, list):
arguments[key] = [value]
if (
tool["parameters"]["properties"][key]["type"] != "object"
and isinstance(value, dict)
and len(value.keys()) == 1
):
arguments[key] = next(iter(value.values()))
return {
"function": {
"name": name,
"arguments": json.dumps(arguments),
},
"type": "function",
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does _xml_to_function_call() do?
_xml_to_function_call() is a function in the langchain codebase, defined in libs/partners/anthropic/langchain_anthropic/experimental.py.
Where is _xml_to_function_call() defined?
_xml_to_function_call() is defined in libs/partners/anthropic/langchain_anthropic/experimental.py at line 103.
What does _xml_to_function_call() call?
_xml_to_function_call() calls 1 function(s): _xml_to_dict.
What calls _xml_to_function_call()?
_xml_to_function_call() is called by 1 function(s): _xml_to_tool_calls.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free