scale-gp-beta 0.1.0a30__py3-none-any.whl → 0.1.0a32__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.
Files changed (57) hide show
  1. scale_gp_beta/__init__.py +3 -1
  2. scale_gp_beta/_base_client.py +12 -12
  3. scale_gp_beta/_client.py +20 -20
  4. scale_gp_beta/_compat.py +48 -48
  5. scale_gp_beta/_models.py +51 -45
  6. scale_gp_beta/_qs.py +7 -7
  7. scale_gp_beta/_types.py +53 -12
  8. scale_gp_beta/_utils/__init__.py +9 -2
  9. scale_gp_beta/_utils/_compat.py +45 -0
  10. scale_gp_beta/_utils/_datetime_parse.py +136 -0
  11. scale_gp_beta/_utils/_transform.py +13 -3
  12. scale_gp_beta/_utils/_typing.py +6 -1
  13. scale_gp_beta/_utils/_utils.py +4 -5
  14. scale_gp_beta/_version.py +1 -1
  15. scale_gp_beta/resources/__init__.py +6 -6
  16. scale_gp_beta/resources/chat/completions.py +236 -236
  17. scale_gp_beta/resources/completions.py +142 -142
  18. scale_gp_beta/resources/dataset_items.py +27 -27
  19. scale_gp_beta/resources/datasets.py +38 -38
  20. scale_gp_beta/resources/evaluation_items.py +19 -19
  21. scale_gp_beta/resources/evaluations.py +97 -75
  22. scale_gp_beta/resources/files/content.py +3 -3
  23. scale_gp_beta/resources/files/files.py +21 -21
  24. scale_gp_beta/resources/inference.py +7 -7
  25. scale_gp_beta/resources/models.py +71 -73
  26. scale_gp_beta/resources/questions.py +43 -43
  27. scale_gp_beta/resources/responses.py +34 -34
  28. scale_gp_beta/resources/spans.py +81 -81
  29. scale_gp_beta/types/__init__.py +4 -4
  30. scale_gp_beta/types/chat/chat_completion.py +114 -19
  31. scale_gp_beta/types/chat/chat_completion_chunk.py +84 -14
  32. scale_gp_beta/types/chat/completion_create_params.py +5 -3
  33. scale_gp_beta/types/completion.py +36 -6
  34. scale_gp_beta/types/completion_create_params.py +5 -3
  35. scale_gp_beta/types/container.py +2 -2
  36. scale_gp_beta/types/container_param.py +2 -2
  37. scale_gp_beta/types/dataset_create_params.py +4 -2
  38. scale_gp_beta/types/dataset_list_params.py +3 -2
  39. scale_gp_beta/types/dataset_update_params.py +3 -2
  40. scale_gp_beta/types/evaluation.py +7 -1
  41. scale_gp_beta/types/evaluation_create_params.py +17 -6
  42. scale_gp_beta/types/evaluation_list_params.py +3 -1
  43. scale_gp_beta/types/evaluation_task.py +6 -1
  44. scale_gp_beta/types/evaluation_task_param.py +4 -3
  45. scale_gp_beta/types/evaluation_update_params.py +3 -2
  46. scale_gp_beta/types/inference_model.py +10 -1
  47. scale_gp_beta/types/model_create_params.py +6 -4
  48. scale_gp_beta/types/model_update_params.py +6 -4
  49. scale_gp_beta/types/question_create_params.py +4 -2
  50. scale_gp_beta/types/response.py +852 -142
  51. scale_gp_beta/types/response_create_params.py +7 -5
  52. scale_gp_beta/types/response_create_response.py +6072 -1012
  53. scale_gp_beta/types/span_search_params.py +8 -7
  54. {scale_gp_beta-0.1.0a30.dist-info → scale_gp_beta-0.1.0a32.dist-info}/METADATA +1 -1
  55. {scale_gp_beta-0.1.0a30.dist-info → scale_gp_beta-0.1.0a32.dist-info}/RECORD +57 -55
  56. {scale_gp_beta-0.1.0a30.dist-info → scale_gp_beta-0.1.0a32.dist-info}/WHEEL +0 -0
  57. {scale_gp_beta-0.1.0a30.dist-info → scale_gp_beta-0.1.0a32.dist-info}/licenses/LICENSE +0 -0
@@ -17,7 +17,7 @@ from ..types import (
17
17
  span_update_params,
18
18
  span_upsert_batch_params,
19
19
  )
20
- from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
20
+ from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
21
21
  from .._utils import maybe_transform, async_maybe_transform
22
22
  from .._compat import cached_property
23
23
  from .._resource import SyncAPIResource, AsyncAPIResource
@@ -64,23 +64,23 @@ class SpansResource(SyncAPIResource):
64
64
  name: str,
65
65
  start_timestamp: Union[str, datetime],
66
66
  trace_id: str,
67
- id: str | NotGiven = NOT_GIVEN,
68
- application_interaction_id: str | NotGiven = NOT_GIVEN,
69
- application_variant_id: str | NotGiven = NOT_GIVEN,
70
- end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
71
- group_id: str | NotGiven = NOT_GIVEN,
72
- input: Dict[str, object] | NotGiven = NOT_GIVEN,
73
- metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
74
- output: Dict[str, object] | NotGiven = NOT_GIVEN,
75
- parent_id: str | NotGiven = NOT_GIVEN,
76
- status: SpanStatus | NotGiven = NOT_GIVEN,
77
- type: SpanType | NotGiven = NOT_GIVEN,
67
+ id: str | Omit = omit,
68
+ application_interaction_id: str | Omit = omit,
69
+ application_variant_id: str | Omit = omit,
70
+ end_timestamp: Union[str, datetime] | Omit = omit,
71
+ group_id: str | Omit = omit,
72
+ input: Dict[str, object] | Omit = omit,
73
+ metadata: Dict[str, object] | Omit = omit,
74
+ output: Dict[str, object] | Omit = omit,
75
+ parent_id: str | Omit = omit,
76
+ status: SpanStatus | Omit = omit,
77
+ type: SpanType | Omit = omit,
78
78
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
79
79
  # The extra values given here take precedence over values defined on the client or passed to this method.
80
80
  extra_headers: Headers | None = None,
81
81
  extra_query: Query | None = None,
82
82
  extra_body: Body | None = None,
83
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
83
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
84
84
  ) -> Span:
85
85
  """
86
86
  Create Span
@@ -142,7 +142,7 @@ class SpansResource(SyncAPIResource):
142
142
  extra_headers: Headers | None = None,
143
143
  extra_query: Query | None = None,
144
144
  extra_body: Body | None = None,
145
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
145
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
146
146
  ) -> Span:
147
147
  """
148
148
  Get Span
@@ -170,17 +170,17 @@ class SpansResource(SyncAPIResource):
170
170
  self,
171
171
  span_id: str,
172
172
  *,
173
- end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
174
- metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
175
- name: str | NotGiven = NOT_GIVEN,
176
- output: Dict[str, object] | NotGiven = NOT_GIVEN,
177
- status: SpanStatus | NotGiven = NOT_GIVEN,
173
+ end_timestamp: Union[str, datetime] | Omit = omit,
174
+ metadata: Dict[str, object] | Omit = omit,
175
+ name: str | Omit = omit,
176
+ output: Dict[str, object] | Omit = omit,
177
+ status: SpanStatus | Omit = omit,
178
178
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
179
179
  # The extra values given here take precedence over values defined on the client or passed to this method.
180
180
  extra_headers: Headers | None = None,
181
181
  extra_query: Query | None = None,
182
182
  extra_body: Body | None = None,
183
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
183
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
184
184
  ) -> Span:
185
185
  """
186
186
  Update Span
@@ -223,7 +223,7 @@ class SpansResource(SyncAPIResource):
223
223
  extra_headers: Headers | None = None,
224
224
  extra_query: Query | None = None,
225
225
  extra_body: Body | None = None,
226
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
226
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
227
227
  ) -> SpanBatchResponse:
228
228
  """
229
229
  Create Spans in Batch
@@ -249,30 +249,30 @@ class SpansResource(SyncAPIResource):
249
249
  def search(
250
250
  self,
251
251
  *,
252
- ending_before: str | NotGiven = NOT_GIVEN,
253
- from_ts: Union[str, datetime] | NotGiven = NOT_GIVEN,
254
- limit: int | NotGiven = NOT_GIVEN,
255
- sort_order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
256
- starting_after: str | NotGiven = NOT_GIVEN,
257
- to_ts: Union[str, datetime] | NotGiven = NOT_GIVEN,
258
- application_variant_ids: List[str] | NotGiven = NOT_GIVEN,
259
- excluded_span_ids: List[str] | NotGiven = NOT_GIVEN,
260
- excluded_trace_ids: List[str] | NotGiven = NOT_GIVEN,
261
- extra_metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
262
- group_id: str | NotGiven = NOT_GIVEN,
263
- names: List[str] | NotGiven = NOT_GIVEN,
264
- parents_only: bool | NotGiven = NOT_GIVEN,
265
- search_texts: List[str] | NotGiven = NOT_GIVEN,
266
- span_ids: List[str] | NotGiven = NOT_GIVEN,
267
- statuses: List[SpanStatus] | NotGiven = NOT_GIVEN,
268
- trace_ids: List[str] | NotGiven = NOT_GIVEN,
269
- types: List[SpanType] | NotGiven = NOT_GIVEN,
252
+ ending_before: str | Omit = omit,
253
+ from_ts: Union[str, datetime] | Omit = omit,
254
+ limit: int | Omit = omit,
255
+ sort_order: Literal["asc", "desc"] | Omit = omit,
256
+ starting_after: str | Omit = omit,
257
+ to_ts: Union[str, datetime] | Omit = omit,
258
+ application_variant_ids: SequenceNotStr[str] | Omit = omit,
259
+ excluded_span_ids: SequenceNotStr[str] | Omit = omit,
260
+ excluded_trace_ids: SequenceNotStr[str] | Omit = omit,
261
+ extra_metadata: Dict[str, object] | Omit = omit,
262
+ group_id: str | Omit = omit,
263
+ names: SequenceNotStr[str] | Omit = omit,
264
+ parents_only: bool | Omit = omit,
265
+ search_texts: SequenceNotStr[str] | Omit = omit,
266
+ span_ids: SequenceNotStr[str] | Omit = omit,
267
+ statuses: List[SpanStatus] | Omit = omit,
268
+ trace_ids: SequenceNotStr[str] | Omit = omit,
269
+ types: List[SpanType] | Omit = omit,
270
270
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
271
271
  # The extra values given here take precedence over values defined on the client or passed to this method.
272
272
  extra_headers: Headers | None = None,
273
273
  extra_query: Query | None = None,
274
274
  extra_body: Body | None = None,
275
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
275
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
276
276
  ) -> SyncCursorPage[Span]:
277
277
  """
278
278
  Search and list spans
@@ -362,7 +362,7 @@ class SpansResource(SyncAPIResource):
362
362
  extra_headers: Headers | None = None,
363
363
  extra_query: Query | None = None,
364
364
  extra_body: Body | None = None,
365
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
365
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
366
366
  ) -> SpanUpsertBatchResponse:
367
367
  """
368
368
  Upsert Spans in Batch
@@ -412,23 +412,23 @@ class AsyncSpansResource(AsyncAPIResource):
412
412
  name: str,
413
413
  start_timestamp: Union[str, datetime],
414
414
  trace_id: str,
415
- id: str | NotGiven = NOT_GIVEN,
416
- application_interaction_id: str | NotGiven = NOT_GIVEN,
417
- application_variant_id: str | NotGiven = NOT_GIVEN,
418
- end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
419
- group_id: str | NotGiven = NOT_GIVEN,
420
- input: Dict[str, object] | NotGiven = NOT_GIVEN,
421
- metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
422
- output: Dict[str, object] | NotGiven = NOT_GIVEN,
423
- parent_id: str | NotGiven = NOT_GIVEN,
424
- status: SpanStatus | NotGiven = NOT_GIVEN,
425
- type: SpanType | NotGiven = NOT_GIVEN,
415
+ id: str | Omit = omit,
416
+ application_interaction_id: str | Omit = omit,
417
+ application_variant_id: str | Omit = omit,
418
+ end_timestamp: Union[str, datetime] | Omit = omit,
419
+ group_id: str | Omit = omit,
420
+ input: Dict[str, object] | Omit = omit,
421
+ metadata: Dict[str, object] | Omit = omit,
422
+ output: Dict[str, object] | Omit = omit,
423
+ parent_id: str | Omit = omit,
424
+ status: SpanStatus | Omit = omit,
425
+ type: SpanType | Omit = omit,
426
426
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
427
427
  # The extra values given here take precedence over values defined on the client or passed to this method.
428
428
  extra_headers: Headers | None = None,
429
429
  extra_query: Query | None = None,
430
430
  extra_body: Body | None = None,
431
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
431
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
432
432
  ) -> Span:
433
433
  """
434
434
  Create Span
@@ -490,7 +490,7 @@ class AsyncSpansResource(AsyncAPIResource):
490
490
  extra_headers: Headers | None = None,
491
491
  extra_query: Query | None = None,
492
492
  extra_body: Body | None = None,
493
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
493
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
494
494
  ) -> Span:
495
495
  """
496
496
  Get Span
@@ -518,17 +518,17 @@ class AsyncSpansResource(AsyncAPIResource):
518
518
  self,
519
519
  span_id: str,
520
520
  *,
521
- end_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN,
522
- metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
523
- name: str | NotGiven = NOT_GIVEN,
524
- output: Dict[str, object] | NotGiven = NOT_GIVEN,
525
- status: SpanStatus | NotGiven = NOT_GIVEN,
521
+ end_timestamp: Union[str, datetime] | Omit = omit,
522
+ metadata: Dict[str, object] | Omit = omit,
523
+ name: str | Omit = omit,
524
+ output: Dict[str, object] | Omit = omit,
525
+ status: SpanStatus | Omit = omit,
526
526
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
527
527
  # The extra values given here take precedence over values defined on the client or passed to this method.
528
528
  extra_headers: Headers | None = None,
529
529
  extra_query: Query | None = None,
530
530
  extra_body: Body | None = None,
531
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
531
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
532
532
  ) -> Span:
533
533
  """
534
534
  Update Span
@@ -571,7 +571,7 @@ class AsyncSpansResource(AsyncAPIResource):
571
571
  extra_headers: Headers | None = None,
572
572
  extra_query: Query | None = None,
573
573
  extra_body: Body | None = None,
574
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
574
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
575
575
  ) -> SpanBatchResponse:
576
576
  """
577
577
  Create Spans in Batch
@@ -597,30 +597,30 @@ class AsyncSpansResource(AsyncAPIResource):
597
597
  def search(
598
598
  self,
599
599
  *,
600
- ending_before: str | NotGiven = NOT_GIVEN,
601
- from_ts: Union[str, datetime] | NotGiven = NOT_GIVEN,
602
- limit: int | NotGiven = NOT_GIVEN,
603
- sort_order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
604
- starting_after: str | NotGiven = NOT_GIVEN,
605
- to_ts: Union[str, datetime] | NotGiven = NOT_GIVEN,
606
- application_variant_ids: List[str] | NotGiven = NOT_GIVEN,
607
- excluded_span_ids: List[str] | NotGiven = NOT_GIVEN,
608
- excluded_trace_ids: List[str] | NotGiven = NOT_GIVEN,
609
- extra_metadata: Dict[str, object] | NotGiven = NOT_GIVEN,
610
- group_id: str | NotGiven = NOT_GIVEN,
611
- names: List[str] | NotGiven = NOT_GIVEN,
612
- parents_only: bool | NotGiven = NOT_GIVEN,
613
- search_texts: List[str] | NotGiven = NOT_GIVEN,
614
- span_ids: List[str] | NotGiven = NOT_GIVEN,
615
- statuses: List[SpanStatus] | NotGiven = NOT_GIVEN,
616
- trace_ids: List[str] | NotGiven = NOT_GIVEN,
617
- types: List[SpanType] | NotGiven = NOT_GIVEN,
600
+ ending_before: str | Omit = omit,
601
+ from_ts: Union[str, datetime] | Omit = omit,
602
+ limit: int | Omit = omit,
603
+ sort_order: Literal["asc", "desc"] | Omit = omit,
604
+ starting_after: str | Omit = omit,
605
+ to_ts: Union[str, datetime] | Omit = omit,
606
+ application_variant_ids: SequenceNotStr[str] | Omit = omit,
607
+ excluded_span_ids: SequenceNotStr[str] | Omit = omit,
608
+ excluded_trace_ids: SequenceNotStr[str] | Omit = omit,
609
+ extra_metadata: Dict[str, object] | Omit = omit,
610
+ group_id: str | Omit = omit,
611
+ names: SequenceNotStr[str] | Omit = omit,
612
+ parents_only: bool | Omit = omit,
613
+ search_texts: SequenceNotStr[str] | Omit = omit,
614
+ span_ids: SequenceNotStr[str] | Omit = omit,
615
+ statuses: List[SpanStatus] | Omit = omit,
616
+ trace_ids: SequenceNotStr[str] | Omit = omit,
617
+ types: List[SpanType] | Omit = omit,
618
618
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
619
619
  # The extra values given here take precedence over values defined on the client or passed to this method.
620
620
  extra_headers: Headers | None = None,
621
621
  extra_query: Query | None = None,
622
622
  extra_body: Body | None = None,
623
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
623
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
624
624
  ) -> AsyncPaginator[Span, AsyncCursorPage[Span]]:
625
625
  """
626
626
  Search and list spans
@@ -710,7 +710,7 @@ class AsyncSpansResource(AsyncAPIResource):
710
710
  extra_headers: Headers | None = None,
711
711
  extra_query: Query | None = None,
712
712
  extra_body: Body | None = None,
713
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
713
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
714
714
  ) -> SpanUpsertBatchResponse:
715
715
  """
716
716
  Upsert Spans in Batch
@@ -75,9 +75,9 @@ from .dataset_item_batch_create_response import DatasetItemBatchCreateResponse a
75
75
  # This ensures that, when building the deferred (due to cyclical references) model schema,
76
76
  # Pydantic can resolve the necessary references.
77
77
  # See: https://github.com/pydantic/pydantic/issues/11250 for more context.
78
- if _compat.PYDANTIC_V2:
79
- evaluation.Evaluation.model_rebuild(_parent_namespace_depth=0)
80
- container.Container.model_rebuild(_parent_namespace_depth=0)
81
- else:
78
+ if _compat.PYDANTIC_V1:
82
79
  evaluation.Evaluation.update_forward_refs() # type: ignore
83
80
  container.Container.update_forward_refs() # type: ignore
81
+ else:
82
+ evaluation.Evaluation.model_rebuild(_parent_namespace_depth=0)
83
+ container.Container.model_rebuild(_parent_namespace_depth=0)
@@ -41,12 +41,17 @@ class ChoiceMessageAnnotationURLCitation(BaseModel):
41
41
 
42
42
  url: str
43
43
 
44
- __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
45
44
  if TYPE_CHECKING:
45
+ # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
46
+ # value to this field, so for compatibility we avoid doing it at runtime.
47
+ __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
48
+
46
49
  # Stub to indicate that arbitrary properties are accepted.
47
50
  # To access properties that are not valid identifiers you can use `getattr`, e.g.
48
51
  # `getattr(obj, '$type')`
49
52
  def __getattr__(self, attr: str) -> object: ...
53
+ else:
54
+ __pydantic_extra__: Dict[str, object]
50
55
 
51
56
 
52
57
  class ChoiceMessageAnnotation(BaseModel):
@@ -54,12 +59,17 @@ class ChoiceMessageAnnotation(BaseModel):
54
59
 
55
60
  url_citation: ChoiceMessageAnnotationURLCitation
56
61
 
57
- __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
58
62
  if TYPE_CHECKING:
63
+ # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
64
+ # value to this field, so for compatibility we avoid doing it at runtime.
65
+ __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
66
+
59
67
  # Stub to indicate that arbitrary properties are accepted.
60
68
  # To access properties that are not valid identifiers you can use `getattr`, e.g.
61
69
  # `getattr(obj, '$type')`
62
70
  def __getattr__(self, attr: str) -> object: ...
71
+ else:
72
+ __pydantic_extra__: Dict[str, object]
63
73
 
64
74
 
65
75
  class ChoiceMessageAudio(BaseModel):
@@ -71,12 +81,17 @@ class ChoiceMessageAudio(BaseModel):
71
81
 
72
82
  transcript: str
73
83
 
74
- __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
75
84
  if TYPE_CHECKING:
85
+ # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
86
+ # value to this field, so for compatibility we avoid doing it at runtime.
87
+ __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
88
+
76
89
  # Stub to indicate that arbitrary properties are accepted.
77
90
  # To access properties that are not valid identifiers you can use `getattr`, e.g.
78
91
  # `getattr(obj, '$type')`
79
92
  def __getattr__(self, attr: str) -> object: ...
93
+ else:
94
+ __pydantic_extra__: Dict[str, object]
80
95
 
81
96
 
82
97
  class ChoiceMessageFunctionCall(BaseModel):
@@ -84,12 +99,17 @@ class ChoiceMessageFunctionCall(BaseModel):
84
99
 
85
100
  name: str
86
101
 
87
- __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
88
102
  if TYPE_CHECKING:
103
+ # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
104
+ # value to this field, so for compatibility we avoid doing it at runtime.
105
+ __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
106
+
89
107
  # Stub to indicate that arbitrary properties are accepted.
90
108
  # To access properties that are not valid identifiers you can use `getattr`, e.g.
91
109
  # `getattr(obj, '$type')`
92
110
  def __getattr__(self, attr: str) -> object: ...
111
+ else:
112
+ __pydantic_extra__: Dict[str, object]
93
113
 
94
114
 
95
115
  class ChoiceMessageToolCallChatCompletionMessageFunctionToolCallFunction(BaseModel):
@@ -97,12 +117,17 @@ class ChoiceMessageToolCallChatCompletionMessageFunctionToolCallFunction(BaseMod
97
117
 
98
118
  name: str
99
119
 
100
- __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
101
120
  if TYPE_CHECKING:
121
+ # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
122
+ # value to this field, so for compatibility we avoid doing it at runtime.
123
+ __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
124
+
102
125
  # Stub to indicate that arbitrary properties are accepted.
103
126
  # To access properties that are not valid identifiers you can use `getattr`, e.g.
104
127
  # `getattr(obj, '$type')`
105
128
  def __getattr__(self, attr: str) -> object: ...
129
+ else:
130
+ __pydantic_extra__: Dict[str, object]
106
131
 
107
132
 
108
133
  class ChoiceMessageToolCallChatCompletionMessageFunctionToolCall(BaseModel):
@@ -112,12 +137,17 @@ class ChoiceMessageToolCallChatCompletionMessageFunctionToolCall(BaseModel):
112
137
 
113
138
  type: Literal["function"]
114
139
 
115
- __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
116
140
  if TYPE_CHECKING:
141
+ # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
142
+ # value to this field, so for compatibility we avoid doing it at runtime.
143
+ __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
144
+
117
145
  # Stub to indicate that arbitrary properties are accepted.
118
146
  # To access properties that are not valid identifiers you can use `getattr`, e.g.
119
147
  # `getattr(obj, '$type')`
120
148
  def __getattr__(self, attr: str) -> object: ...
149
+ else:
150
+ __pydantic_extra__: Dict[str, object]
121
151
 
122
152
 
123
153
  class ChoiceMessageToolCallChatCompletionMessageCustomToolCallCustom(BaseModel):
@@ -125,12 +155,17 @@ class ChoiceMessageToolCallChatCompletionMessageCustomToolCallCustom(BaseModel):
125
155
 
126
156
  name: str
127
157
 
128
- __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
129
158
  if TYPE_CHECKING:
159
+ # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
160
+ # value to this field, so for compatibility we avoid doing it at runtime.
161
+ __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
162
+
130
163
  # Stub to indicate that arbitrary properties are accepted.
131
164
  # To access properties that are not valid identifiers you can use `getattr`, e.g.
132
165
  # `getattr(obj, '$type')`
133
166
  def __getattr__(self, attr: str) -> object: ...
167
+ else:
168
+ __pydantic_extra__: Dict[str, object]
134
169
 
135
170
 
136
171
  class ChoiceMessageToolCallChatCompletionMessageCustomToolCall(BaseModel):
@@ -140,12 +175,17 @@ class ChoiceMessageToolCallChatCompletionMessageCustomToolCall(BaseModel):
140
175
 
141
176
  type: Literal["custom"]
142
177
 
143
- __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
144
178
  if TYPE_CHECKING:
179
+ # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
180
+ # value to this field, so for compatibility we avoid doing it at runtime.
181
+ __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
182
+
145
183
  # Stub to indicate that arbitrary properties are accepted.
146
184
  # To access properties that are not valid identifiers you can use `getattr`, e.g.
147
185
  # `getattr(obj, '$type')`
148
186
  def __getattr__(self, attr: str) -> object: ...
187
+ else:
188
+ __pydantic_extra__: Dict[str, object]
149
189
 
150
190
 
151
191
  ChoiceMessageToolCall: TypeAlias = Union[
@@ -168,12 +208,17 @@ class ChoiceMessage(BaseModel):
168
208
 
169
209
  tool_calls: Optional[List[ChoiceMessageToolCall]] = None
170
210
 
171
- __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
172
211
  if TYPE_CHECKING:
212
+ # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
213
+ # value to this field, so for compatibility we avoid doing it at runtime.
214
+ __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
215
+
173
216
  # Stub to indicate that arbitrary properties are accepted.
174
217
  # To access properties that are not valid identifiers you can use `getattr`, e.g.
175
218
  # `getattr(obj, '$type')`
176
219
  def __getattr__(self, attr: str) -> object: ...
220
+ else:
221
+ __pydantic_extra__: Dict[str, object]
177
222
 
178
223
 
179
224
  class ChoiceLogprobsContentTopLogprob(BaseModel):
@@ -183,12 +228,17 @@ class ChoiceLogprobsContentTopLogprob(BaseModel):
183
228
 
184
229
  bytes: Optional[List[int]] = None
185
230
 
186
- __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
187
231
  if TYPE_CHECKING:
232
+ # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
233
+ # value to this field, so for compatibility we avoid doing it at runtime.
234
+ __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
235
+
188
236
  # Stub to indicate that arbitrary properties are accepted.
189
237
  # To access properties that are not valid identifiers you can use `getattr`, e.g.
190
238
  # `getattr(obj, '$type')`
191
239
  def __getattr__(self, attr: str) -> object: ...
240
+ else:
241
+ __pydantic_extra__: Dict[str, object]
192
242
 
193
243
 
194
244
  class ChoiceLogprobsContent(BaseModel):
@@ -200,12 +250,17 @@ class ChoiceLogprobsContent(BaseModel):
200
250
 
201
251
  bytes: Optional[List[int]] = None
202
252
 
203
- __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
204
253
  if TYPE_CHECKING:
254
+ # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
255
+ # value to this field, so for compatibility we avoid doing it at runtime.
256
+ __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
257
+
205
258
  # Stub to indicate that arbitrary properties are accepted.
206
259
  # To access properties that are not valid identifiers you can use `getattr`, e.g.
207
260
  # `getattr(obj, '$type')`
208
261
  def __getattr__(self, attr: str) -> object: ...
262
+ else:
263
+ __pydantic_extra__: Dict[str, object]
209
264
 
210
265
 
211
266
  class ChoiceLogprobsRefusalTopLogprob(BaseModel):
@@ -215,12 +270,17 @@ class ChoiceLogprobsRefusalTopLogprob(BaseModel):
215
270
 
216
271
  bytes: Optional[List[int]] = None
217
272
 
218
- __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
219
273
  if TYPE_CHECKING:
274
+ # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
275
+ # value to this field, so for compatibility we avoid doing it at runtime.
276
+ __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
277
+
220
278
  # Stub to indicate that arbitrary properties are accepted.
221
279
  # To access properties that are not valid identifiers you can use `getattr`, e.g.
222
280
  # `getattr(obj, '$type')`
223
281
  def __getattr__(self, attr: str) -> object: ...
282
+ else:
283
+ __pydantic_extra__: Dict[str, object]
224
284
 
225
285
 
226
286
  class ChoiceLogprobsRefusal(BaseModel):
@@ -232,12 +292,17 @@ class ChoiceLogprobsRefusal(BaseModel):
232
292
 
233
293
  bytes: Optional[List[int]] = None
234
294
 
235
- __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
236
295
  if TYPE_CHECKING:
296
+ # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
297
+ # value to this field, so for compatibility we avoid doing it at runtime.
298
+ __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
299
+
237
300
  # Stub to indicate that arbitrary properties are accepted.
238
301
  # To access properties that are not valid identifiers you can use `getattr`, e.g.
239
302
  # `getattr(obj, '$type')`
240
303
  def __getattr__(self, attr: str) -> object: ...
304
+ else:
305
+ __pydantic_extra__: Dict[str, object]
241
306
 
242
307
 
243
308
  class ChoiceLogprobs(BaseModel):
@@ -245,12 +310,17 @@ class ChoiceLogprobs(BaseModel):
245
310
 
246
311
  refusal: Optional[List[ChoiceLogprobsRefusal]] = None
247
312
 
248
- __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
249
313
  if TYPE_CHECKING:
314
+ # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
315
+ # value to this field, so for compatibility we avoid doing it at runtime.
316
+ __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
317
+
250
318
  # Stub to indicate that arbitrary properties are accepted.
251
319
  # To access properties that are not valid identifiers you can use `getattr`, e.g.
252
320
  # `getattr(obj, '$type')`
253
321
  def __getattr__(self, attr: str) -> object: ...
322
+ else:
323
+ __pydantic_extra__: Dict[str, object]
254
324
 
255
325
 
256
326
  class Choice(BaseModel):
@@ -262,12 +332,17 @@ class Choice(BaseModel):
262
332
 
263
333
  logprobs: Optional[ChoiceLogprobs] = None
264
334
 
265
- __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
266
335
  if TYPE_CHECKING:
336
+ # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
337
+ # value to this field, so for compatibility we avoid doing it at runtime.
338
+ __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
339
+
267
340
  # Stub to indicate that arbitrary properties are accepted.
268
341
  # To access properties that are not valid identifiers you can use `getattr`, e.g.
269
342
  # `getattr(obj, '$type')`
270
343
  def __getattr__(self, attr: str) -> object: ...
344
+ else:
345
+ __pydantic_extra__: Dict[str, object]
271
346
 
272
347
 
273
348
  class UsageCompletionTokensDetails(BaseModel):
@@ -279,12 +354,17 @@ class UsageCompletionTokensDetails(BaseModel):
279
354
 
280
355
  rejected_prediction_tokens: Optional[int] = None
281
356
 
282
- __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
283
357
  if TYPE_CHECKING:
358
+ # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
359
+ # value to this field, so for compatibility we avoid doing it at runtime.
360
+ __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
361
+
284
362
  # Stub to indicate that arbitrary properties are accepted.
285
363
  # To access properties that are not valid identifiers you can use `getattr`, e.g.
286
364
  # `getattr(obj, '$type')`
287
365
  def __getattr__(self, attr: str) -> object: ...
366
+ else:
367
+ __pydantic_extra__: Dict[str, object]
288
368
 
289
369
 
290
370
  class UsagePromptTokensDetails(BaseModel):
@@ -292,12 +372,17 @@ class UsagePromptTokensDetails(BaseModel):
292
372
 
293
373
  cached_tokens: Optional[int] = None
294
374
 
295
- __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
296
375
  if TYPE_CHECKING:
376
+ # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
377
+ # value to this field, so for compatibility we avoid doing it at runtime.
378
+ __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
379
+
297
380
  # Stub to indicate that arbitrary properties are accepted.
298
381
  # To access properties that are not valid identifiers you can use `getattr`, e.g.
299
382
  # `getattr(obj, '$type')`
300
383
  def __getattr__(self, attr: str) -> object: ...
384
+ else:
385
+ __pydantic_extra__: Dict[str, object]
301
386
 
302
387
 
303
388
  class Usage(BaseModel):
@@ -311,12 +396,17 @@ class Usage(BaseModel):
311
396
 
312
397
  prompt_tokens_details: Optional[UsagePromptTokensDetails] = None
313
398
 
314
- __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
315
399
  if TYPE_CHECKING:
400
+ # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
401
+ # value to this field, so for compatibility we avoid doing it at runtime.
402
+ __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
403
+
316
404
  # Stub to indicate that arbitrary properties are accepted.
317
405
  # To access properties that are not valid identifiers you can use `getattr`, e.g.
318
406
  # `getattr(obj, '$type')`
319
407
  def __getattr__(self, attr: str) -> object: ...
408
+ else:
409
+ __pydantic_extra__: Dict[str, object]
320
410
 
321
411
 
322
412
  class ChatCompletion(BaseModel):
@@ -336,9 +426,14 @@ class ChatCompletion(BaseModel):
336
426
 
337
427
  usage: Optional[Usage] = None
338
428
 
339
- __pydantic_extra__: Dict[str, builtins.object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
340
429
  if TYPE_CHECKING:
430
+ # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
431
+ # value to this field, so for compatibility we avoid doing it at runtime.
432
+ __pydantic_extra__: Dict[str, builtins.object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
433
+
341
434
  # Stub to indicate that arbitrary properties are accepted.
342
435
  # To access properties that are not valid identifiers you can use `getattr`, e.g.
343
436
  # `getattr(obj, '$type')`
344
437
  def __getattr__(self, attr: str) -> builtins.object: ...
438
+ else:
439
+ __pydantic_extra__: Dict[str, builtins.object]