Skip to content

Commit

Permalink
chore(internal): properly set __pydantic_private__ (#2144)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-ci-bot committed Feb 25, 2025
1 parent 3e69750 commit 2b1bd16
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/openai/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
ModelBuilderProtocol,
)
from ._utils import SensitiveHeadersFilter, is_dict, is_list, asyncify, is_given, lru_cache, is_mapping
from ._compat import model_copy, model_dump
from ._compat import PYDANTIC_V2, model_copy, model_dump
from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type
from ._response import (
APIResponse,
Expand Down Expand Up @@ -209,6 +209,9 @@ def _set_private_attributes(
model: Type[_T],
options: FinalRequestOptions,
) -> None:
if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None:
self.__pydantic_private__ = {}

self._model = model
self._client = client
self._options = options
Expand Down Expand Up @@ -294,6 +297,9 @@ def _set_private_attributes(
client: AsyncAPIClient,
options: FinalRequestOptions,
) -> None:
if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None:
self.__pydantic_private__ = {}

self._model = model
self._client = client
self._options = options
Expand Down

0 comments on commit 2b1bd16

Please sign in to comment.