# pre_init

> **Function** in `langchain_core`

📖 [View in docs](https://reference.langchain.com/python/langchain-core/utils/pydantic/pre_init)

Decorator to run a function before model initialization.

## Signature

```python
pre_init(
    func: Callable[[Any, dict[str, Any]], Any],
) -> Callable[[Any, dict[str, Any]], Any]
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `func` | `Callable[[Any, dict[str, Any]], Any]` | Yes | The function to run before model initialization. |

## Returns

`Callable[[Any, dict[str, Any]], Any]`

The decorated function.

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/1c3a4186cf2ba4f28face59118ac7786de009f91/libs/core/langchain_core/utils/pydantic.py#L129)