test_convert_to_openai_function_strict_union_of_objects_arg_type() — langchain Function Reference
Architecture documentation for the test_convert_to_openai_function_strict_union_of_objects_arg_type() function in test_function_calling.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 7e384644_c91c_9a03_11c6_ccaf59b30f2e["test_convert_to_openai_function_strict_union_of_objects_arg_type()"] 6f1e8e6f_d3f9_e590_b17e_1dc8afafdbe0["test_function_calling.py"] 7e384644_c91c_9a03_11c6_ccaf59b30f2e -->|defined in| 6f1e8e6f_d3f9_e590_b17e_1dc8afafdbe0 style 7e384644_c91c_9a03_11c6_ccaf59b30f2e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/utils/test_function_calling.py lines 500–552
def test_convert_to_openai_function_strict_union_of_objects_arg_type() -> None:
class NestedA(BaseModel):
foo: str
class NestedB(BaseModel):
bar: int
class NestedC(BaseModel):
baz: bool
def my_function(my_arg: NestedA | NestedB | NestedC) -> None:
"""Dummy function."""
expected = {
"name": "my_function",
"description": "Dummy function.",
"parameters": {
"properties": {
"my_arg": {
"anyOf": [
{
"properties": {"foo": {"title": "Foo", "type": "string"}},
"required": ["foo"],
"title": "NestedA",
"type": "object",
"additionalProperties": False,
},
{
"properties": {"bar": {"title": "Bar", "type": "integer"}},
"required": ["bar"],
"title": "NestedB",
"type": "object",
"additionalProperties": False,
},
{
"properties": {"baz": {"title": "Baz", "type": "boolean"}},
"required": ["baz"],
"title": "NestedC",
"type": "object",
"additionalProperties": False,
},
]
}
},
"required": ["my_arg"],
"type": "object",
"additionalProperties": False,
},
"strict": True,
}
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_strict_union_of_objects_arg_type() do?
test_convert_to_openai_function_strict_union_of_objects_arg_type() 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_strict_union_of_objects_arg_type() defined?
test_convert_to_openai_function_strict_union_of_objects_arg_type() is defined in libs/core/tests/unit_tests/utils/test_function_calling.py at line 500.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free