Skip to content

Commit 0119042

Browse files
chore(internal): properly set __pydantic_private__ (#603)
1 parent 7b60c37 commit 0119042

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/finch/_base_client.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
ModelBuilderProtocol,
6464
)
6565
from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping
66-
from ._compat import model_copy, model_dump
66+
from ._compat import PYDANTIC_V2, model_copy, model_dump
6767
from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type
6868
from ._response import (
6969
APIResponse,
@@ -208,6 +208,9 @@ def _set_private_attributes(
208208
model: Type[_T],
209209
options: FinalRequestOptions,
210210
) -> None:
211+
if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None:
212+
self.__pydantic_private__ = {}
213+
211214
self._model = model
212215
self._client = client
213216
self._options = options
@@ -293,6 +296,9 @@ def _set_private_attributes(
293296
client: AsyncAPIClient,
294297
options: FinalRequestOptions,
295298
) -> None:
299+
if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None:
300+
self.__pydantic_private__ = {}
301+
296302
self._model = model
297303
self._client = client
298304
self._options = options

0 commit comments

Comments
 (0)