langchain.chains.ernie_functions.base.get_ernie_output_parser¶

langchain.chains.ernie_functions.base.get_ernie_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 Ernie 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

Union[BaseOutputParser, BaseGenerationOutputParser]