anthropic 0.58.2__py3-none-any.whl → 0.59.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- anthropic/_models.py +24 -3
- anthropic/_version.py +1 -1
- anthropic/types/model.py +0 -3
- anthropic/types/model_param.py +0 -3
- {anthropic-0.58.2.dist-info → anthropic-0.59.0.dist-info}/METADATA +1 -1
- {anthropic-0.58.2.dist-info → anthropic-0.59.0.dist-info}/RECORD +8 -8
- {anthropic-0.58.2.dist-info → anthropic-0.59.0.dist-info}/WHEEL +0 -0
- {anthropic-0.58.2.dist-info → anthropic-0.59.0.dist-info}/licenses/LICENSE +0 -0
anthropic/_models.py
CHANGED
|
@@ -224,14 +224,18 @@ class BaseModel(pydantic.BaseModel):
|
|
|
224
224
|
else:
|
|
225
225
|
fields_values[name] = field_get_default(field)
|
|
226
226
|
|
|
227
|
+
extra_field_type = _get_extra_fields_type(__cls)
|
|
228
|
+
|
|
227
229
|
_extra = {}
|
|
228
230
|
for key, value in values.items():
|
|
229
231
|
if key not in model_fields:
|
|
232
|
+
parsed = construct_type(value=value, type_=extra_field_type) if extra_field_type is not None else value
|
|
233
|
+
|
|
230
234
|
if PYDANTIC_V2:
|
|
231
|
-
_extra[key] =
|
|
235
|
+
_extra[key] = parsed
|
|
232
236
|
else:
|
|
233
237
|
_fields_set.add(key)
|
|
234
|
-
fields_values[key] =
|
|
238
|
+
fields_values[key] = parsed
|
|
235
239
|
|
|
236
240
|
object.__setattr__(m, "__dict__", fields_values)
|
|
237
241
|
|
|
@@ -386,6 +390,23 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object:
|
|
|
386
390
|
return construct_type(value=value, type_=type_, metadata=getattr(field, "metadata", None))
|
|
387
391
|
|
|
388
392
|
|
|
393
|
+
def _get_extra_fields_type(cls: type[pydantic.BaseModel]) -> type | None:
|
|
394
|
+
if not PYDANTIC_V2:
|
|
395
|
+
# TODO
|
|
396
|
+
return None
|
|
397
|
+
|
|
398
|
+
schema = cls.__pydantic_core_schema__
|
|
399
|
+
if schema["type"] == "model":
|
|
400
|
+
fields = schema["schema"]
|
|
401
|
+
if fields["type"] == "model-fields":
|
|
402
|
+
extras = fields.get("extras_schema")
|
|
403
|
+
if extras and "cls" in extras:
|
|
404
|
+
# mypy can't narrow the type
|
|
405
|
+
return extras["cls"] # type: ignore[no-any-return]
|
|
406
|
+
|
|
407
|
+
return None
|
|
408
|
+
|
|
409
|
+
|
|
389
410
|
def is_basemodel(type_: type) -> bool:
|
|
390
411
|
"""Returns whether or not the given type is either a `BaseModel` or a union of `BaseModel`"""
|
|
391
412
|
if is_union(type_):
|
|
@@ -455,7 +476,7 @@ def construct_type(*, value: object, type_: object, metadata: Optional[List[Any]
|
|
|
455
476
|
type_ = type_.__value__ # type: ignore[unreachable]
|
|
456
477
|
|
|
457
478
|
# unwrap `Annotated[T, ...]` -> `T`
|
|
458
|
-
if metadata is not None:
|
|
479
|
+
if metadata is not None and len(metadata) > 0:
|
|
459
480
|
meta: tuple[Any, ...] = tuple(metadata)
|
|
460
481
|
elif is_annotated_type(type_):
|
|
461
482
|
meta = get_args(type_)[1:]
|
anthropic/_version.py
CHANGED
anthropic/types/model.py
CHANGED
anthropic/types/model_param.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: anthropic
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.59.0
|
|
4
4
|
Summary: The official Python library for the anthropic API
|
|
5
5
|
Project-URL: Homepage, https://github.com/anthropics/anthropic-sdk-python
|
|
6
6
|
Project-URL: Repository, https://github.com/anthropics/anthropic-sdk-python
|
|
@@ -6,13 +6,13 @@ anthropic/_constants.py,sha256=dZ53c7dQnlC6xcGkes61-8goAEIOwzTfsmcBfzdU9Ho,756
|
|
|
6
6
|
anthropic/_exceptions.py,sha256=bkSqVWxtRdRb31H7MIvtxfh5mo_Xf7Ib3nPTOmAOmGs,4073
|
|
7
7
|
anthropic/_files.py,sha256=rfm6t3u1wPlq2X5l3qnymAmDY8caH9V_lickXC24o6I,3627
|
|
8
8
|
anthropic/_legacy_response.py,sha256=QsroQ_9LHI8tSoPEvbIXXB44SvLJXaXQX7khjZpnqfE,17235
|
|
9
|
-
anthropic/_models.py,sha256=
|
|
9
|
+
anthropic/_models.py,sha256=VEovOb5ek_pfb-KvxfBpCYYUszw2KMUT6x_zzUzCLzk,31387
|
|
10
10
|
anthropic/_qs.py,sha256=AOkSz4rHtK4YI3ZU_kzea-zpwBUgEY8WniGmTPyEimc,4846
|
|
11
11
|
anthropic/_resource.py,sha256=FYEOzfhB-XWTR2gyTmQuuFoecRiVXxe_SpjZlQQGytU,1080
|
|
12
12
|
anthropic/_response.py,sha256=1Y7-OrGn1lOwvZ_SmMlwT9Nb2i9A1RYw2Q4-F1cwPSU,30542
|
|
13
13
|
anthropic/_streaming.py,sha256=vn8K5KgfO3Bv9NE8nwHIQEjEhkQeVE6YMnGqiJlCgqE,14023
|
|
14
14
|
anthropic/_types.py,sha256=WeAcP68yMpfs3hNEltM_k2nYMiG4xda4cFdf5kHbjP8,6299
|
|
15
|
-
anthropic/_version.py,sha256=
|
|
15
|
+
anthropic/_version.py,sha256=EW9TFA1pohaF4p9rmYwP8ffwypJpV5zfCMKWeGFB8JE,162
|
|
16
16
|
anthropic/pagination.py,sha256=hW6DOtNbwwQrNQ8wn4PJj7WB2y_37szSDQeUBnunQ40,2202
|
|
17
17
|
anthropic/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
18
|
anthropic/_decoders/jsonl.py,sha256=KDLw-Frjo7gRup5qDp_BWkXIZ-mFZU5vFDz0WBhEKcs,3510
|
|
@@ -112,10 +112,10 @@ anthropic/types/message_stop_event.py,sha256=rtYh1F-b9xilu8s_RdaHijP7kf3om6FvK9c
|
|
|
112
112
|
anthropic/types/message_stream_event.py,sha256=OspCo1IFpItyJDr4Ta16o8DQmTsgVWSmeNg4BhfMM0M,285
|
|
113
113
|
anthropic/types/message_tokens_count.py,sha256=JmkcWw9nZAUgr2WY5G4Mwqs2jcnMuZXh920MlUkvY70,329
|
|
114
114
|
anthropic/types/metadata_param.py,sha256=p6j8bWh3FfI3PB-vJjU4JhRukP2NZdrcE2gQixw5zgw,594
|
|
115
|
-
anthropic/types/model.py,sha256=
|
|
115
|
+
anthropic/types/model.py,sha256=SahaHoHnqIh71yKDM0_zsNJVJjqXESmxHYnEMWaIxJ4,795
|
|
116
116
|
anthropic/types/model_info.py,sha256=JrqNQwWcOiC5ItKTZqRfeAQhPWzi0AyzzOTF6AdE-ss,646
|
|
117
117
|
anthropic/types/model_list_params.py,sha256=O2GJOAHr6pB7yGAJhLjcwsDJ8ACtE1GrOrI2JDkj0w8,974
|
|
118
|
-
anthropic/types/model_param.py,sha256=
|
|
118
|
+
anthropic/types/model_param.py,sha256=EFUM-xa-i8TNOjU9UCd22gJhnzk2ZARWHVS07ZRjDLs,841
|
|
119
119
|
anthropic/types/plain_text_source_param.py,sha256=zdzLMfSQZH2_9Z8ssVc5hLG1w_AuFZ2Z3E17lEntAzg,382
|
|
120
120
|
anthropic/types/raw_content_block_delta.py,sha256=T1i1gSGq9u9obYbxgXYAwux-WIRqSRWJW9tBjBDXoP8,611
|
|
121
121
|
anthropic/types/raw_content_block_delta_event.py,sha256=XKpY_cCljZ6NFtVCt5R38imPbnZAbFyQVIB5d4K4ZgY,393
|
|
@@ -322,7 +322,7 @@ anthropic/types/shared/not_found_error.py,sha256=R6OsCvAmsf_SB2TwoX6E63o049qZMaA
|
|
|
322
322
|
anthropic/types/shared/overloaded_error.py,sha256=PlyhHt3wmzcnynSfkWbfP4XkLoWsPa9B39V3CyAdgx8,282
|
|
323
323
|
anthropic/types/shared/permission_error.py,sha256=nuyxtLXOiEkYEbFRXiAWjxU6XtdyjkAaXQ2NgMB3pjw,282
|
|
324
324
|
anthropic/types/shared/rate_limit_error.py,sha256=eYULATjXa6KKdqeBauest7RzuN-bhGsY5BWwH9eYv4c,280
|
|
325
|
-
anthropic-0.
|
|
326
|
-
anthropic-0.
|
|
327
|
-
anthropic-0.
|
|
328
|
-
anthropic-0.
|
|
325
|
+
anthropic-0.59.0.dist-info/METADATA,sha256=u7i0Mx81_G98nk2e9maKP1y4D0g5E5hYEIdMoLYcmPk,27053
|
|
326
|
+
anthropic-0.59.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
327
|
+
anthropic-0.59.0.dist-info/licenses/LICENSE,sha256=i_lphP-Lz65-SMrnalKeiiUxe6ngKr9_08xk_flWV6Y,1056
|
|
328
|
+
anthropic-0.59.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|