test__convert_typed_dict_to_openai_function() — langchain Function Reference
Architecture documentation for the test__convert_typed_dict_to_openai_function() function in test_function_calling.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 204d53de_5519_a095_94fc_a80f62cb1df3["test__convert_typed_dict_to_openai_function()"] 6f1e8e6f_d3f9_e590_b17e_1dc8afafdbe0["test_function_calling.py"] 204d53de_5519_a095_94fc_a80f62cb1df3 -->|defined in| 6f1e8e6f_d3f9_e590_b17e_1dc8afafdbe0 style 204d53de_5519_a095_94fc_a80f62cb1df3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/utils/test_function_calling.py lines 802–1035
def test__convert_typed_dict_to_openai_function(
typed_dict: TypeAlias, annotated: TypeAlias
) -> None:
class SubTool(typed_dict): # type: ignore[misc]
"""Subtool docstring."""
args: annotated[dict[str, Any], {}, "this does bar"] # noqa: F722
class Tool(typed_dict): # type: ignore[misc]
"""Docstring.
Args:
arg1: foo
"""
arg1: str
arg2: int | str | bool
arg3: list[SubTool] | None
arg4: annotated[Literal["bar", "baz"], ..., "this does foo"] # noqa: F722
arg5: annotated[float | None, None]
arg6: annotated[
Sequence[Mapping[str, tuple[Iterable[Any], SubTool]]] | None, []
]
arg7: annotated[list[SubTool], ...]
arg8: annotated[tuple[SubTool], ...]
arg9: annotated[Sequence[SubTool], ...]
arg10: annotated[Iterable[SubTool], ...]
arg11: annotated[set[SubTool], ...]
arg12: annotated[dict[str, SubTool], ...]
arg13: annotated[Mapping[str, SubTool], ...]
arg14: annotated[MutableMapping[str, SubTool], ...]
arg15: annotated[bool, False, "flag"] # noqa: F821
expected = {
"name": "Tool",
"description": "Docstring.",
"parameters": {
"type": "object",
"properties": {
"arg1": {"description": "foo", "type": "string"},
"arg2": {
"anyOf": [
{"type": "integer"},
{"type": "string"},
{"type": "boolean"},
]
},
"arg3": {
"type": "array",
"items": {
"description": "Subtool docstring.",
"type": "object",
"properties": {
"args": {
"description": "this does bar",
"default": {},
"type": "object",
}
},
},
},
"arg4": {
"description": "this does foo",
"enum": ["bar", "baz"],
"type": "string",
},
"arg5": {"type": "number"},
"arg6": {
"default": [],
"type": "array",
"items": {
"type": "object",
"additionalProperties": {
"type": "array",
"minItems": 2,
"maxItems": 2,
"items": [
{"type": "array", "items": {}},
{
"title": "SubTool",
"description": "Subtool docstring.",
Domain
Subdomains
Source
Frequently Asked Questions
What does test__convert_typed_dict_to_openai_function() do?
test__convert_typed_dict_to_openai_function() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/utils/test_function_calling.py.
Where is test__convert_typed_dict_to_openai_function() defined?
test__convert_typed_dict_to_openai_function() is defined in libs/core/tests/unit_tests/utils/test_function_calling.py at line 802.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free