# model_validate

> **Function** in `langchain_core`

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

Validate `obj` against a Pydantic model class of either major version.

Dispatches to the correct method for Pydantic v1 (`parse_obj`) or v2
(`model_validate`), so callers holding a `TypeBaseModel` don't have to
branch on the model's version themselves.

## Signature

```python
model_validate(
    model: TypeBaseModel,
    obj: Any,
) -> PydanticBaseModel
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `model` | `TypeBaseModel` | Yes | The Pydantic model class to validate against. |
| `obj` | `Any` | Yes | The object to validate. |

---

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