Skip to content

Commit

Permalink
fix: revert regression with 3.7 support (#1269)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Mar 25, 2024
1 parent 835cb9b commit 37aed56
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/openai/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,12 +538,14 @@ class GenericModel(BaseGenericModel, BaseModel):


if PYDANTIC_V2:
from pydantic import TypeAdapter as _TypeAdapter

_CachedTypeAdapter = cast("TypeAdapter[object]", lru_cache(maxsize=None)(_TypeAdapter))

if TYPE_CHECKING:
from pydantic import TypeAdapter
else:
from pydantic import TypeAdapter as _TypeAdapter

TypeAdapter = lru_cache(_TypeAdapter)
TypeAdapter = _CachedTypeAdapter

def _validate_non_model_type(*, type_: type[_T], value: object) -> _T:
return TypeAdapter(type_).validate_python(value)
Expand Down

0 comments on commit 37aed56

Please sign in to comment.