langchain.chains.structured_output.base
.get_openai_output_parser¶
- langchain.chains.structured_output.base.get_openai_output_parser(functions: Sequence[Union[Dict[str, Any], Type[BaseModel], Callable]]) Union[BaseOutputParser, BaseGenerationOutputParser] [source]¶
Get the appropriate function output parser given the user functions.
- Parameters
functions (Sequence[Union[Dict[str, Any], Type[BaseModel], Callable]]) – Sequence where element is a dictionary, a pydantic.BaseModel class, or a Python function. If a dictionary is passed in, it is assumed to already be a valid OpenAI function.
- Returns
- A PydanticOutputFunctionsParser if functions are Pydantic classes, otherwise
a JsonOutputFunctionsParser. If there’s only one function and it is not a Pydantic class, then the output parser will automatically extract only the function arguments and not the function name.
- Return type