Skip to content

Commit

Permalink
chore(internal): defer model build for import latency (#431)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Apr 4, 2024
1 parent 3ef26a6 commit e4cc44a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/anthropic/_models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import os
import inspect
from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, cast
from datetime import date, datetime
Expand Down Expand Up @@ -38,6 +39,7 @@
is_given,
is_mapping,
parse_date,
coerce_boolean,
parse_datetime,
strip_not_given,
extract_type_arg,
Expand Down Expand Up @@ -74,7 +76,9 @@ class _ConfigProtocol(Protocol):

class BaseModel(pydantic.BaseModel):
if PYDANTIC_V2:
model_config: ClassVar[ConfigDict] = ConfigDict(extra="allow")
model_config: ClassVar[ConfigDict] = ConfigDict(
extra="allow", defer_build=coerce_boolean(os.environ.get("DEFER_PYDANTIC_BUILD", "true"))
)
else:

@property
Expand Down

0 comments on commit e4cc44a

Please sign in to comment.