_create_openai_functions_structured_output_runnable() — langchain Function Reference
Architecture documentation for the _create_openai_functions_structured_output_runnable() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD d352db91_94a6_ec14_88eb_6644997dcde0["_create_openai_functions_structured_output_runnable()"] 22e1446e_2db6_2965_eef8_bf9239c6dbfc["base.py"] d352db91_94a6_ec14_88eb_6644997dcde0 -->|defined in| 22e1446e_2db6_2965_eef8_bf9239c6dbfc f3f63b38_7673_1a74_f67c_06b8e8cfcdf3["create_structured_output_runnable()"] f3f63b38_7673_1a74_f67c_06b8e8cfcdf3 -->|calls| d352db91_94a6_ec14_88eb_6644997dcde0 e8355b27_2273_5b96_4b84_f25ab554e0b3["create_openai_fn_runnable()"] d352db91_94a6_ec14_88eb_6644997dcde0 -->|calls| e8355b27_2273_5b96_4b84_f25ab554e0b3 style d352db91_94a6_ec14_88eb_6644997dcde0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/chains/structured_output/base.py lines 549–587
def _create_openai_functions_structured_output_runnable(
output_schema: dict[str, Any] | type[BaseModel],
llm: Runnable,
prompt: BasePromptTemplate | None = None,
*,
output_parser: BaseOutputParser | BaseGenerationOutputParser | None = None,
**llm_kwargs: Any,
) -> Runnable:
if isinstance(output_schema, dict):
function: Any = {
"name": "output_formatter",
"description": (
"Output formatter. Should always be used to format your response to the"
" user."
),
"parameters": output_schema,
}
else:
class _OutputFormatter(BaseModel):
"""Output formatter.
Should always be used to format your response to the user.
"""
output: output_schema # type: ignore[valid-type]
function = _OutputFormatter
output_parser = output_parser or PydanticAttrOutputFunctionsParser(
pydantic_schema=_OutputFormatter,
attr_name="output",
)
return create_openai_fn_runnable(
[function],
llm,
prompt=prompt,
output_parser=output_parser,
**llm_kwargs,
)
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does _create_openai_functions_structured_output_runnable() do?
_create_openai_functions_structured_output_runnable() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/structured_output/base.py.
Where is _create_openai_functions_structured_output_runnable() defined?
_create_openai_functions_structured_output_runnable() is defined in libs/langchain/langchain_classic/chains/structured_output/base.py at line 549.
What does _create_openai_functions_structured_output_runnable() call?
_create_openai_functions_structured_output_runnable() calls 1 function(s): create_openai_fn_runnable.
What calls _create_openai_functions_structured_output_runnable()?
_create_openai_functions_structured_output_runnable() is called by 1 function(s): create_structured_output_runnable.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free