# convert_to_ernie_function

> **Function** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/chains/ernie_functions/base/convert_to_ernie_function)

Convert a raw function/class to an Ernie function.

## Signature

```python
convert_to_ernie_function(
    function: Union[Dict[str, Any], Type[BaseModel], Callable],
) -> Dict[str, Any]
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `function` | `Union[Dict[str, Any], Type[BaseModel], Callable]` | Yes | 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

`Dict[str, Any]`

A dict version of the passed in function which is compatible with the
Ernie function-calling API.

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/a6a6079511ac8a5c1293337f88096b8641562e77/libs/community/langchain_community/chains/ernie_functions/base.py#L144)