test_convert_to_openai_function_nested_strict_2() — langchain Function Reference
Architecture documentation for the test_convert_to_openai_function_nested_strict_2() function in test_function_calling.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 6b08dd77_300b_73c6_2875_450c841c1803["test_convert_to_openai_function_nested_strict_2()"] 6f1e8e6f_d3f9_e590_b17e_1dc8afafdbe0["test_function_calling.py"] 6b08dd77_300b_73c6_2875_450c841c1803 -->|defined in| 6f1e8e6f_d3f9_e590_b17e_1dc8afafdbe0 style 6b08dd77_300b_73c6_2875_450c841c1803 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/utils/test_function_calling.py lines 1123–1158
def test_convert_to_openai_function_nested_strict_2() -> None:
def my_function(arg1: dict, arg2: dict | None) -> None:
"""Dummy function."""
expected: dict = {
"name": "my_function",
"description": "Dummy function.",
"parameters": {
"type": "object",
"properties": {
"arg1": {
"additionalProperties": False,
"type": "object",
},
"arg2": {
"anyOf": [
{"additionalProperties": False, "type": "object"},
{"type": "null"},
],
},
},
"required": ["arg1", "arg2"],
"additionalProperties": False,
},
"strict": True,
}
# there will be no extra `"additionalProperties": False` when Pydantic < 2.11
if parse(version("pydantic")) < parse("2.11"):
del expected["parameters"]["properties"]["arg1"]["additionalProperties"]
del expected["parameters"]["properties"]["arg2"]["anyOf"][0][
"additionalProperties"
]
actual = convert_to_openai_function(my_function, strict=True)
assert actual == expected
Domain
Subdomains
Source
Frequently Asked Questions
What does test_convert_to_openai_function_nested_strict_2() do?
test_convert_to_openai_function_nested_strict_2() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/utils/test_function_calling.py.
Where is test_convert_to_openai_function_nested_strict_2() defined?
test_convert_to_openai_function_nested_strict_2() is defined in libs/core/tests/unit_tests/utils/test_function_calling.py at line 1123.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free