diff --git a/src/openai/_models.py b/src/openai/_models.py index 4aa2623bbc..166973538f 100644 --- a/src/openai/_models.py +++ b/src/openai/_models.py @@ -534,12 +534,12 @@ class GenericModel(BaseGenericModel, BaseModel): if PYDANTIC_V2: - if TYPE_CHECKING: - from pydantic import TypeAdapter + from pydantic import TypeAdapter else: - from pydantic import TypeAdapter as _TypeAdapter - TypeAdapter = lru_cache(_TypeAdapter) + from pydantic import TypeAdapter as _TypeAdapter + + TypeAdapter = lru_cache(_TypeAdapter) def _validate_non_model_type(*, type_: type[_T], value: object) -> _T: return TypeAdapter(type_).validate_python(value)