langchain.chains.ernie_functions.base
.convert_to_ernie_function¶
- langchain.chains.ernie_functions.base.convert_to_ernie_function(function: Union[Dict[str, Any], Type[BaseModel], Callable]) Dict[str, Any] [source]¶
Convert a raw function/class to an Ernie function.
- Parameters
function (Union[Dict[str, Any], Type[BaseModel], Callable]) – Either 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 dict version of the passed in function which is compatible with the
Ernie function-calling API.
- Return type
Dict[str, Any]