test_json_output_key_tools_parser_multiple_tools_no_match() — langchain Function Reference
Architecture documentation for the test_json_output_key_tools_parser_multiple_tools_no_match() function in test_openai_tools.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 7610fb50_3a6c_e731_2a4d_8ef36fea96da["test_json_output_key_tools_parser_multiple_tools_no_match()"] 0f94a062_f577_31c7_fb9c_0f526b273e64["test_openai_tools.py"] 7610fb50_3a6c_e731_2a4d_8ef36fea96da -->|defined in| 0f94a062_f577_31c7_fb9c_0f526b273e64 style 7610fb50_3a6c_e731_2a4d_8ef36fea96da fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/output_parsers/test_openai_tools.py lines 543–591
def test_json_output_key_tools_parser_multiple_tools_no_match(
*, use_tool_calls: bool
) -> None:
def create_message() -> AIMessage:
tool_calls_data = [
{
"id": "call_other",
"function": {"name": "other", "arguments": '{"b":2}'},
"type": "function",
},
{
"id": "call_another",
"function": {"name": "another", "arguments": '{"c":3}'},
"type": "function",
},
]
if use_tool_calls:
return AIMessage(
content="",
tool_calls=[
{"id": "call_other", "name": "other", "args": {"b": 2}},
{"id": "call_another", "name": "another", "args": {"c": 3}},
],
)
return AIMessage(
content="",
additional_kwargs={"tool_calls": tool_calls_data},
)
result = [ChatGeneration(message=create_message())]
# Test with return_id=True, first_tool_only=True
parser = JsonOutputKeyToolsParser(
key_name="nonexistent", first_tool_only=True, return_id=True
)
output = parser.parse_result(result) # type: ignore[arg-type]
# Should return None when no matches
assert output is None
# Test with return_id=False, first_tool_only=True
parser_no_id = JsonOutputKeyToolsParser(
key_name="nonexistent", first_tool_only=True, return_id=False
)
output_no_id = parser_no_id.parse_result(result) # type: ignore[arg-type]
# Should return None when no matches
assert output_no_id is None
Domain
Subdomains
Source
Frequently Asked Questions
What does test_json_output_key_tools_parser_multiple_tools_no_match() do?
test_json_output_key_tools_parser_multiple_tools_no_match() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/output_parsers/test_openai_tools.py.
Where is test_json_output_key_tools_parser_multiple_tools_no_match() defined?
test_json_output_key_tools_parser_multiple_tools_no_match() is defined in libs/core/tests/unit_tests/output_parsers/test_openai_tools.py at line 543.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free