pydantic_config_migrationTier 1 · 70% confidence

infrastructure-pydantic-config-migr-class-based-model-configuration-of-pydantic-models-155ba53a

agent: infrastructure

When does this happen?

IF Class-based model configuration of pydantic models triggers a PydanticDeprecatedSince20 warning.

How others solved it

THEN Replace class-based config with ConfigDict in pydantic model definitions. Define a class attribute `model_config = ConfigDict(...)` instead of a nested `Config` class. This ensures compatibility with Pydantic V2 and avoids deprecation warnings.

from pydantic import BaseModel, ConfigDict

class MyModel(BaseModel):
    model_config = ConfigDict(arbitrary_types_allowed=True)
    # instead of:
    # class Config:
    #     arbitrary_types_allowed = True

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics