orq-ai-sdk 4.2.7__py3-none-any.whl → 4.2.9__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 (73) hide show
  1. orq_ai_sdk/_version.py +2 -2
  2. orq_ai_sdk/completions.py +107 -1
  3. orq_ai_sdk/edits.py +107 -1
  4. orq_ai_sdk/embeddings.py +107 -1
  5. orq_ai_sdk/generations.py +99 -1
  6. orq_ai_sdk/models/__init__.py +405 -0
  7. orq_ai_sdk/models/conversationresponse.py +1 -1
  8. orq_ai_sdk/models/conversationwithmessagesresponse.py +1 -1
  9. orq_ai_sdk/models/createagentrequestop.py +24 -0
  10. orq_ai_sdk/models/createchatcompletionop.py +6 -0
  11. orq_ai_sdk/models/createcompletionop.py +218 -30
  12. orq_ai_sdk/models/createcontactop.py +1 -1
  13. orq_ai_sdk/models/createconversationop.py +1 -1
  14. orq_ai_sdk/models/createconversationresponseop.py +2 -2
  15. orq_ai_sdk/models/createdatasetitemop.py +4 -4
  16. orq_ai_sdk/models/createdatasetop.py +1 -1
  17. orq_ai_sdk/models/createdatasourceop.py +1 -1
  18. orq_ai_sdk/models/createembeddingop.py +221 -26
  19. orq_ai_sdk/models/createevalop.py +14 -14
  20. orq_ai_sdk/models/createidentityop.py +1 -1
  21. orq_ai_sdk/models/createimageeditop.py +242 -31
  22. orq_ai_sdk/models/createimageop.py +210 -22
  23. orq_ai_sdk/models/createimagevariationop.py +251 -31
  24. orq_ai_sdk/models/createpromptop.py +12 -0
  25. orq_ai_sdk/models/creatererankop.py +218 -26
  26. orq_ai_sdk/models/createspeechop.py +174 -24
  27. orq_ai_sdk/models/createtoolop.py +6 -6
  28. orq_ai_sdk/models/createtranscriptionop.py +180 -10
  29. orq_ai_sdk/models/createtranslationop.py +172 -10
  30. orq_ai_sdk/models/filegetop.py +1 -1
  31. orq_ai_sdk/models/filelistop.py +1 -1
  32. orq_ai_sdk/models/fileuploadop.py +1 -1
  33. orq_ai_sdk/models/generateconversationnameop.py +1 -1
  34. orq_ai_sdk/models/getallpromptsop.py +6 -0
  35. orq_ai_sdk/models/getalltoolsop.py +6 -6
  36. orq_ai_sdk/models/getevalsop.py +14 -14
  37. orq_ai_sdk/models/getonepromptop.py +6 -0
  38. orq_ai_sdk/models/getpromptversionop.py +6 -0
  39. orq_ai_sdk/models/listagentsop.py +12 -0
  40. orq_ai_sdk/models/listdatasetdatapointsop.py +4 -4
  41. orq_ai_sdk/models/listdatasetsop.py +1 -1
  42. orq_ai_sdk/models/listdatasourcesop.py +1 -1
  43. orq_ai_sdk/models/listidentitiesop.py +1 -1
  44. orq_ai_sdk/models/listpromptversionsop.py +6 -0
  45. orq_ai_sdk/models/partdoneevent.py +1 -1
  46. orq_ai_sdk/models/reasoningpart.py +1 -1
  47. orq_ai_sdk/models/retrieveagentrequestop.py +12 -0
  48. orq_ai_sdk/models/retrievedatapointop.py +4 -4
  49. orq_ai_sdk/models/retrievedatasetop.py +1 -1
  50. orq_ai_sdk/models/retrievedatasourceop.py +1 -1
  51. orq_ai_sdk/models/retrieveidentityop.py +1 -1
  52. orq_ai_sdk/models/retrievetoolop.py +6 -6
  53. orq_ai_sdk/models/runagentop.py +13 -1
  54. orq_ai_sdk/models/streamrunagentop.py +13 -1
  55. orq_ai_sdk/models/updateagentop.py +24 -0
  56. orq_ai_sdk/models/updateconversationop.py +1 -1
  57. orq_ai_sdk/models/updatedatapointop.py +4 -4
  58. orq_ai_sdk/models/updatedatasetop.py +1 -1
  59. orq_ai_sdk/models/updatedatasourceop.py +1 -1
  60. orq_ai_sdk/models/updateevalop.py +14 -14
  61. orq_ai_sdk/models/updateidentityop.py +1 -1
  62. orq_ai_sdk/models/updatepromptop.py +12 -0
  63. orq_ai_sdk/models/updatetoolop.py +7 -7
  64. orq_ai_sdk/orq_completions.py +6 -0
  65. orq_ai_sdk/rerank.py +98 -0
  66. orq_ai_sdk/speech.py +83 -1
  67. orq_ai_sdk/transcriptions.py +90 -0
  68. orq_ai_sdk/translations.py +87 -1
  69. orq_ai_sdk/variations.py +111 -1
  70. {orq_ai_sdk-4.2.7.dist-info → orq_ai_sdk-4.2.9.dist-info}/METADATA +1 -1
  71. {orq_ai_sdk-4.2.7.dist-info → orq_ai_sdk-4.2.9.dist-info}/RECORD +73 -73
  72. {orq_ai_sdk-4.2.7.dist-info → orq_ai_sdk-4.2.9.dist-info}/WHEEL +1 -1
  73. {orq_ai_sdk-4.2.7.dist-info → orq_ai_sdk-4.2.9.dist-info}/top_level.txt +0 -0
@@ -26,6 +26,41 @@ class CreateRerankFallbacks(BaseModel):
26
26
  r"""Fallback model identifier"""
27
27
 
28
28
 
29
+ class CreateRerankRetryTypedDict(TypedDict):
30
+ r"""Retry configuration for the request"""
31
+
32
+ count: NotRequired[float]
33
+ r"""Number of retry attempts (1-5)"""
34
+ on_codes: NotRequired[List[float]]
35
+ r"""HTTP status codes that trigger retry logic"""
36
+
37
+
38
+ class CreateRerankRetry(BaseModel):
39
+ r"""Retry configuration for the request"""
40
+
41
+ count: Optional[float] = 3
42
+ r"""Number of retry attempts (1-5)"""
43
+
44
+ on_codes: Optional[List[float]] = None
45
+ r"""HTTP status codes that trigger retry logic"""
46
+
47
+ @model_serializer(mode="wrap")
48
+ def serialize_model(self, handler):
49
+ optional_fields = set(["count", "on_codes"])
50
+ serialized = handler(self)
51
+ m = {}
52
+
53
+ for n, f in type(self).model_fields.items():
54
+ k = f.alias or n
55
+ val = serialized.get(k)
56
+
57
+ if val != UNSET_SENTINEL:
58
+ if val is not None or k not in optional_fields:
59
+ m[k] = val
60
+
61
+ return m
62
+
63
+
29
64
  CreateRerankType = Literal["exact_match",]
30
65
 
31
66
 
@@ -62,7 +97,120 @@ class CreateRerankCache(BaseModel):
62
97
  return m
63
98
 
64
99
 
65
- class CreateRerankRetryTypedDict(TypedDict):
100
+ CreateRerankLoadBalancerType = Literal["weight_based",]
101
+
102
+
103
+ class CreateRerankLoadBalancerModelsTypedDict(TypedDict):
104
+ model: str
105
+ r"""Model identifier for load balancing"""
106
+ weight: NotRequired[float]
107
+ r"""Weight assigned to this model for load balancing"""
108
+
109
+
110
+ class CreateRerankLoadBalancerModels(BaseModel):
111
+ model: str
112
+ r"""Model identifier for load balancing"""
113
+
114
+ weight: Optional[float] = 0.5
115
+ r"""Weight assigned to this model for load balancing"""
116
+
117
+ @model_serializer(mode="wrap")
118
+ def serialize_model(self, handler):
119
+ optional_fields = set(["weight"])
120
+ serialized = handler(self)
121
+ m = {}
122
+
123
+ for n, f in type(self).model_fields.items():
124
+ k = f.alias or n
125
+ val = serialized.get(k)
126
+
127
+ if val != UNSET_SENTINEL:
128
+ if val is not None or k not in optional_fields:
129
+ m[k] = val
130
+
131
+ return m
132
+
133
+
134
+ class CreateRerankLoadBalancer1TypedDict(TypedDict):
135
+ type: CreateRerankLoadBalancerType
136
+ models: List[CreateRerankLoadBalancerModelsTypedDict]
137
+
138
+
139
+ class CreateRerankLoadBalancer1(BaseModel):
140
+ type: CreateRerankLoadBalancerType
141
+
142
+ models: List[CreateRerankLoadBalancerModels]
143
+
144
+
145
+ CreateRerankLoadBalancerTypedDict = CreateRerankLoadBalancer1TypedDict
146
+ r"""Load balancer configuration for the request."""
147
+
148
+
149
+ CreateRerankLoadBalancer = CreateRerankLoadBalancer1
150
+ r"""Load balancer configuration for the request."""
151
+
152
+
153
+ class CreateRerankTimeoutTypedDict(TypedDict):
154
+ r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
155
+
156
+ call_timeout: float
157
+ r"""Timeout value in milliseconds"""
158
+
159
+
160
+ class CreateRerankTimeout(BaseModel):
161
+ r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
162
+
163
+ call_timeout: float
164
+ r"""Timeout value in milliseconds"""
165
+
166
+
167
+ class CreateRerankRouterRerankFallbacksTypedDict(TypedDict):
168
+ model: str
169
+ r"""Fallback model identifier"""
170
+
171
+
172
+ class CreateRerankRouterRerankFallbacks(BaseModel):
173
+ model: str
174
+ r"""Fallback model identifier"""
175
+
176
+
177
+ CreateRerankRouterRerankType = Literal["exact_match",]
178
+
179
+
180
+ class CreateRerankRouterRerankCacheTypedDict(TypedDict):
181
+ r"""Cache configuration for the request."""
182
+
183
+ type: CreateRerankRouterRerankType
184
+ ttl: NotRequired[float]
185
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
186
+
187
+
188
+ class CreateRerankRouterRerankCache(BaseModel):
189
+ r"""Cache configuration for the request."""
190
+
191
+ type: CreateRerankRouterRerankType
192
+
193
+ ttl: Optional[float] = 1800
194
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
195
+
196
+ @model_serializer(mode="wrap")
197
+ def serialize_model(self, handler):
198
+ optional_fields = set(["ttl"])
199
+ serialized = handler(self)
200
+ m = {}
201
+
202
+ for n, f in type(self).model_fields.items():
203
+ k = f.alias or n
204
+ val = serialized.get(k)
205
+
206
+ if val != UNSET_SENTINEL:
207
+ if val is not None or k not in optional_fields:
208
+ m[k] = val
209
+
210
+ return m
211
+
212
+
213
+ class CreateRerankRouterRerankRetryTypedDict(TypedDict):
66
214
  r"""Retry configuration for the request"""
67
215
 
68
216
  count: NotRequired[float]
@@ -71,7 +219,7 @@ class CreateRerankRetryTypedDict(TypedDict):
71
219
  r"""HTTP status codes that trigger retry logic"""
72
220
 
73
221
 
74
- class CreateRerankRetry(BaseModel):
222
+ class CreateRerankRouterRerankRetry(BaseModel):
75
223
  r"""Retry configuration for the request"""
76
224
 
77
225
  count: Optional[float] = 3
@@ -97,17 +245,17 @@ class CreateRerankRetry(BaseModel):
97
245
  return m
98
246
 
99
247
 
100
- CreateRerankLoadBalancerType = Literal["weight_based",]
248
+ CreateRerankLoadBalancerRouterRerankType = Literal["weight_based",]
101
249
 
102
250
 
103
- class CreateRerankLoadBalancerModelsTypedDict(TypedDict):
251
+ class CreateRerankLoadBalancerRouterRerankModelsTypedDict(TypedDict):
104
252
  model: str
105
253
  r"""Model identifier for load balancing"""
106
254
  weight: NotRequired[float]
107
255
  r"""Weight assigned to this model for load balancing"""
108
256
 
109
257
 
110
- class CreateRerankLoadBalancerModels(BaseModel):
258
+ class CreateRerankLoadBalancerRouterRerankModels(BaseModel):
111
259
  model: str
112
260
  r"""Model identifier for load balancing"""
113
261
 
@@ -131,33 +279,35 @@ class CreateRerankLoadBalancerModels(BaseModel):
131
279
  return m
132
280
 
133
281
 
134
- class CreateRerankLoadBalancer1TypedDict(TypedDict):
135
- type: CreateRerankLoadBalancerType
136
- models: List[CreateRerankLoadBalancerModelsTypedDict]
282
+ class CreateRerankLoadBalancerRouterRerank1TypedDict(TypedDict):
283
+ type: CreateRerankLoadBalancerRouterRerankType
284
+ models: List[CreateRerankLoadBalancerRouterRerankModelsTypedDict]
137
285
 
138
286
 
139
- class CreateRerankLoadBalancer1(BaseModel):
140
- type: CreateRerankLoadBalancerType
287
+ class CreateRerankLoadBalancerRouterRerank1(BaseModel):
288
+ type: CreateRerankLoadBalancerRouterRerankType
141
289
 
142
- models: List[CreateRerankLoadBalancerModels]
290
+ models: List[CreateRerankLoadBalancerRouterRerankModels]
143
291
 
144
292
 
145
- CreateRerankLoadBalancerTypedDict = CreateRerankLoadBalancer1TypedDict
293
+ CreateRerankRouterRerankLoadBalancerTypedDict = (
294
+ CreateRerankLoadBalancerRouterRerank1TypedDict
295
+ )
146
296
  r"""Array of models with weights for load balancing requests"""
147
297
 
148
298
 
149
- CreateRerankLoadBalancer = CreateRerankLoadBalancer1
299
+ CreateRerankRouterRerankLoadBalancer = CreateRerankLoadBalancerRouterRerank1
150
300
  r"""Array of models with weights for load balancing requests"""
151
301
 
152
302
 
153
- class CreateRerankTimeoutTypedDict(TypedDict):
303
+ class CreateRerankRouterRerankTimeoutTypedDict(TypedDict):
154
304
  r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
155
305
 
156
306
  call_timeout: float
157
307
  r"""Timeout value in milliseconds"""
158
308
 
159
309
 
160
- class CreateRerankTimeout(BaseModel):
310
+ class CreateRerankRouterRerankTimeout(BaseModel):
161
311
  r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
162
312
 
163
313
  call_timeout: float
@@ -167,19 +317,19 @@ class CreateRerankTimeout(BaseModel):
167
317
  class CreateRerankOrqTypedDict(TypedDict):
168
318
  name: NotRequired[str]
169
319
  r"""The name to display on the trace. If not specified, the default system name will be used."""
170
- fallbacks: NotRequired[List[CreateRerankFallbacksTypedDict]]
320
+ fallbacks: NotRequired[List[CreateRerankRouterRerankFallbacksTypedDict]]
171
321
  r"""Array of fallback models to use if primary model fails"""
172
- cache: NotRequired[CreateRerankCacheTypedDict]
322
+ cache: NotRequired[CreateRerankRouterRerankCacheTypedDict]
173
323
  r"""Cache configuration for the request."""
174
- retry: NotRequired[CreateRerankRetryTypedDict]
324
+ retry: NotRequired[CreateRerankRouterRerankRetryTypedDict]
175
325
  r"""Retry configuration for the request"""
176
326
  identity: NotRequired[PublicIdentityTypedDict]
177
327
  r"""Information about the identity making the request. If the identity does not exist, it will be created automatically."""
178
328
  contact: NotRequired[PublicContactTypedDict]
179
329
  r"""@deprecated Use identity instead. Information about the contact making the request."""
180
- load_balancer: NotRequired[CreateRerankLoadBalancerTypedDict]
330
+ load_balancer: NotRequired[CreateRerankRouterRerankLoadBalancerTypedDict]
181
331
  r"""Array of models with weights for load balancing requests"""
182
- timeout: NotRequired[CreateRerankTimeoutTypedDict]
332
+ timeout: NotRequired[CreateRerankRouterRerankTimeoutTypedDict]
183
333
  r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
184
334
 
185
335
 
@@ -187,13 +337,13 @@ class CreateRerankOrq(BaseModel):
187
337
  name: Optional[str] = None
188
338
  r"""The name to display on the trace. If not specified, the default system name will be used."""
189
339
 
190
- fallbacks: Optional[List[CreateRerankFallbacks]] = None
340
+ fallbacks: Optional[List[CreateRerankRouterRerankFallbacks]] = None
191
341
  r"""Array of fallback models to use if primary model fails"""
192
342
 
193
- cache: Optional[CreateRerankCache] = None
343
+ cache: Optional[CreateRerankRouterRerankCache] = None
194
344
  r"""Cache configuration for the request."""
195
345
 
196
- retry: Optional[CreateRerankRetry] = None
346
+ retry: Optional[CreateRerankRouterRerankRetry] = None
197
347
  r"""Retry configuration for the request"""
198
348
 
199
349
  identity: Optional[PublicIdentity] = None
@@ -207,10 +357,10 @@ class CreateRerankOrq(BaseModel):
207
357
  ] = None
208
358
  r"""@deprecated Use identity instead. Information about the contact making the request."""
209
359
 
210
- load_balancer: Optional[CreateRerankLoadBalancer] = None
360
+ load_balancer: Optional[CreateRerankRouterRerankLoadBalancer] = None
211
361
  r"""Array of models with weights for load balancing requests"""
212
362
 
213
- timeout: Optional[CreateRerankTimeout] = None
363
+ timeout: Optional[CreateRerankRouterRerankTimeout] = None
214
364
  r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
215
365
 
216
366
  @model_serializer(mode="wrap")
@@ -254,6 +404,18 @@ class CreateRerankRequestBodyTypedDict(TypedDict):
254
404
  r"""The number of most relevant documents or indices to return, defaults to the length of the documents"""
255
405
  filename: NotRequired[Nullable[str]]
256
406
  r"""The filename of the document to rerank"""
407
+ name: NotRequired[str]
408
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
409
+ fallbacks: NotRequired[List[CreateRerankFallbacksTypedDict]]
410
+ r"""Array of fallback models to use if primary model fails"""
411
+ retry: NotRequired[CreateRerankRetryTypedDict]
412
+ r"""Retry configuration for the request"""
413
+ cache: NotRequired[CreateRerankCacheTypedDict]
414
+ r"""Cache configuration for the request."""
415
+ load_balancer: NotRequired[CreateRerankLoadBalancerTypedDict]
416
+ r"""Load balancer configuration for the request."""
417
+ timeout: NotRequired[CreateRerankTimeoutTypedDict]
418
+ r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
257
419
  orq: NotRequired[CreateRerankOrqTypedDict]
258
420
 
259
421
 
@@ -275,11 +437,41 @@ class CreateRerankRequestBody(BaseModel):
275
437
  filename: OptionalNullable[str] = UNSET
276
438
  r"""The filename of the document to rerank"""
277
439
 
440
+ name: Optional[str] = None
441
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
442
+
443
+ fallbacks: Optional[List[CreateRerankFallbacks]] = None
444
+ r"""Array of fallback models to use if primary model fails"""
445
+
446
+ retry: Optional[CreateRerankRetry] = None
447
+ r"""Retry configuration for the request"""
448
+
449
+ cache: Optional[CreateRerankCache] = None
450
+ r"""Cache configuration for the request."""
451
+
452
+ load_balancer: Optional[CreateRerankLoadBalancer] = None
453
+ r"""Load balancer configuration for the request."""
454
+
455
+ timeout: Optional[CreateRerankTimeout] = None
456
+ r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
457
+
278
458
  orq: Optional[CreateRerankOrq] = None
279
459
 
280
460
  @model_serializer(mode="wrap")
281
461
  def serialize_model(self, handler):
282
- optional_fields = set(["top_n", "filename", "orq"])
462
+ optional_fields = set(
463
+ [
464
+ "top_n",
465
+ "filename",
466
+ "name",
467
+ "fallbacks",
468
+ "retry",
469
+ "cache",
470
+ "load_balancer",
471
+ "timeout",
472
+ "orq",
473
+ ]
474
+ )
283
475
  nullable_fields = set(["filename"])
284
476
  serialized = handler(self)
285
477
  m = {}
@@ -21,6 +21,16 @@ CreateSpeechResponseFormat = Literal[
21
21
  r"""The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`. If a format is provided but not supported by the provider, the response will be in the default format. When the provided format is not supported by the provider, the response will be in the default format."""
22
22
 
23
23
 
24
+ class CreateSpeechFallbacksTypedDict(TypedDict):
25
+ model: str
26
+ r"""Fallback model identifier"""
27
+
28
+
29
+ class CreateSpeechFallbacks(BaseModel):
30
+ model: str
31
+ r"""Fallback model identifier"""
32
+
33
+
24
34
  class CreateSpeechRetryTypedDict(TypedDict):
25
35
  r"""Retry configuration for the request"""
26
36
 
@@ -56,12 +66,114 @@ class CreateSpeechRetry(BaseModel):
56
66
  return m
57
67
 
58
68
 
59
- class CreateSpeechFallbacksTypedDict(TypedDict):
69
+ CreateSpeechLoadBalancerType = Literal["weight_based",]
70
+
71
+
72
+ class CreateSpeechLoadBalancerModelsTypedDict(TypedDict):
73
+ model: str
74
+ r"""Model identifier for load balancing"""
75
+ weight: NotRequired[float]
76
+ r"""Weight assigned to this model for load balancing"""
77
+
78
+
79
+ class CreateSpeechLoadBalancerModels(BaseModel):
80
+ model: str
81
+ r"""Model identifier for load balancing"""
82
+
83
+ weight: Optional[float] = 0.5
84
+ r"""Weight assigned to this model for load balancing"""
85
+
86
+ @model_serializer(mode="wrap")
87
+ def serialize_model(self, handler):
88
+ optional_fields = set(["weight"])
89
+ serialized = handler(self)
90
+ m = {}
91
+
92
+ for n, f in type(self).model_fields.items():
93
+ k = f.alias or n
94
+ val = serialized.get(k)
95
+
96
+ if val != UNSET_SENTINEL:
97
+ if val is not None or k not in optional_fields:
98
+ m[k] = val
99
+
100
+ return m
101
+
102
+
103
+ class CreateSpeechLoadBalancer1TypedDict(TypedDict):
104
+ type: CreateSpeechLoadBalancerType
105
+ models: List[CreateSpeechLoadBalancerModelsTypedDict]
106
+
107
+
108
+ class CreateSpeechLoadBalancer1(BaseModel):
109
+ type: CreateSpeechLoadBalancerType
110
+
111
+ models: List[CreateSpeechLoadBalancerModels]
112
+
113
+
114
+ CreateSpeechLoadBalancerTypedDict = CreateSpeechLoadBalancer1TypedDict
115
+ r"""Load balancer configuration for the request."""
116
+
117
+
118
+ CreateSpeechLoadBalancer = CreateSpeechLoadBalancer1
119
+ r"""Load balancer configuration for the request."""
120
+
121
+
122
+ class CreateSpeechTimeoutTypedDict(TypedDict):
123
+ r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
124
+
125
+ call_timeout: float
126
+ r"""Timeout value in milliseconds"""
127
+
128
+
129
+ class CreateSpeechTimeout(BaseModel):
130
+ r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
131
+
132
+ call_timeout: float
133
+ r"""Timeout value in milliseconds"""
134
+
135
+
136
+ class CreateSpeechRouterAudioSpeechRetryTypedDict(TypedDict):
137
+ r"""Retry configuration for the request"""
138
+
139
+ count: NotRequired[float]
140
+ r"""Number of retry attempts (1-5)"""
141
+ on_codes: NotRequired[List[float]]
142
+ r"""HTTP status codes that trigger retry logic"""
143
+
144
+
145
+ class CreateSpeechRouterAudioSpeechRetry(BaseModel):
146
+ r"""Retry configuration for the request"""
147
+
148
+ count: Optional[float] = 3
149
+ r"""Number of retry attempts (1-5)"""
150
+
151
+ on_codes: Optional[List[float]] = None
152
+ r"""HTTP status codes that trigger retry logic"""
153
+
154
+ @model_serializer(mode="wrap")
155
+ def serialize_model(self, handler):
156
+ optional_fields = set(["count", "on_codes"])
157
+ serialized = handler(self)
158
+ m = {}
159
+
160
+ for n, f in type(self).model_fields.items():
161
+ k = f.alias or n
162
+ val = serialized.get(k)
163
+
164
+ if val != UNSET_SENTINEL:
165
+ if val is not None or k not in optional_fields:
166
+ m[k] = val
167
+
168
+ return m
169
+
170
+
171
+ class CreateSpeechRouterAudioSpeechFallbacksTypedDict(TypedDict):
60
172
  model: str
61
173
  r"""Fallback model identifier"""
62
174
 
63
175
 
64
- class CreateSpeechFallbacks(BaseModel):
176
+ class CreateSpeechRouterAudioSpeechFallbacks(BaseModel):
65
177
  model: str
66
178
  r"""Fallback model identifier"""
67
179
 
@@ -101,17 +213,17 @@ class CreateSpeechThread(BaseModel):
101
213
  return m
102
214
 
103
215
 
104
- CreateSpeechLoadBalancerType = Literal["weight_based",]
216
+ CreateSpeechLoadBalancerRouterAudioSpeechType = Literal["weight_based",]
105
217
 
106
218
 
107
- class CreateSpeechLoadBalancerModelsTypedDict(TypedDict):
219
+ class CreateSpeechLoadBalancerRouterAudioSpeechModelsTypedDict(TypedDict):
108
220
  model: str
109
221
  r"""Model identifier for load balancing"""
110
222
  weight: NotRequired[float]
111
223
  r"""Weight assigned to this model for load balancing"""
112
224
 
113
225
 
114
- class CreateSpeechLoadBalancerModels(BaseModel):
226
+ class CreateSpeechLoadBalancerRouterAudioSpeechModels(BaseModel):
115
227
  model: str
116
228
  r"""Model identifier for load balancing"""
117
229
 
@@ -135,33 +247,35 @@ class CreateSpeechLoadBalancerModels(BaseModel):
135
247
  return m
136
248
 
137
249
 
138
- class CreateSpeechLoadBalancer1TypedDict(TypedDict):
139
- type: CreateSpeechLoadBalancerType
140
- models: List[CreateSpeechLoadBalancerModelsTypedDict]
250
+ class CreateSpeechLoadBalancerRouterAudioSpeech1TypedDict(TypedDict):
251
+ type: CreateSpeechLoadBalancerRouterAudioSpeechType
252
+ models: List[CreateSpeechLoadBalancerRouterAudioSpeechModelsTypedDict]
141
253
 
142
254
 
143
- class CreateSpeechLoadBalancer1(BaseModel):
144
- type: CreateSpeechLoadBalancerType
255
+ class CreateSpeechLoadBalancerRouterAudioSpeech1(BaseModel):
256
+ type: CreateSpeechLoadBalancerRouterAudioSpeechType
145
257
 
146
- models: List[CreateSpeechLoadBalancerModels]
258
+ models: List[CreateSpeechLoadBalancerRouterAudioSpeechModels]
147
259
 
148
260
 
149
- CreateSpeechLoadBalancerTypedDict = CreateSpeechLoadBalancer1TypedDict
261
+ CreateSpeechRouterAudioSpeechLoadBalancerTypedDict = (
262
+ CreateSpeechLoadBalancerRouterAudioSpeech1TypedDict
263
+ )
150
264
  r"""Array of models with weights for load balancing requests"""
151
265
 
152
266
 
153
- CreateSpeechLoadBalancer = CreateSpeechLoadBalancer1
267
+ CreateSpeechRouterAudioSpeechLoadBalancer = CreateSpeechLoadBalancerRouterAudioSpeech1
154
268
  r"""Array of models with weights for load balancing requests"""
155
269
 
156
270
 
157
- class CreateSpeechTimeoutTypedDict(TypedDict):
271
+ class CreateSpeechRouterAudioSpeechTimeoutTypedDict(TypedDict):
158
272
  r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
159
273
 
160
274
  call_timeout: float
161
275
  r"""Timeout value in milliseconds"""
162
276
 
163
277
 
164
- class CreateSpeechTimeout(BaseModel):
278
+ class CreateSpeechRouterAudioSpeechTimeout(BaseModel):
165
279
  r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
166
280
 
167
281
  call_timeout: float
@@ -169,9 +283,9 @@ class CreateSpeechTimeout(BaseModel):
169
283
 
170
284
 
171
285
  class CreateSpeechOrqTypedDict(TypedDict):
172
- retry: NotRequired[CreateSpeechRetryTypedDict]
286
+ retry: NotRequired[CreateSpeechRouterAudioSpeechRetryTypedDict]
173
287
  r"""Retry configuration for the request"""
174
- fallbacks: NotRequired[List[CreateSpeechFallbacksTypedDict]]
288
+ fallbacks: NotRequired[List[CreateSpeechRouterAudioSpeechFallbacksTypedDict]]
175
289
  r"""Array of fallback models to use if primary model fails"""
176
290
  name: NotRequired[str]
177
291
  r"""The name to display on the trace. If not specified, the default system name will be used."""
@@ -181,17 +295,17 @@ class CreateSpeechOrqTypedDict(TypedDict):
181
295
  r"""@deprecated Use identity instead. Information about the contact making the request."""
182
296
  thread: NotRequired[CreateSpeechThreadTypedDict]
183
297
  r"""Thread information to group related requests"""
184
- load_balancer: NotRequired[CreateSpeechLoadBalancerTypedDict]
298
+ load_balancer: NotRequired[CreateSpeechRouterAudioSpeechLoadBalancerTypedDict]
185
299
  r"""Array of models with weights for load balancing requests"""
186
- timeout: NotRequired[CreateSpeechTimeoutTypedDict]
300
+ timeout: NotRequired[CreateSpeechRouterAudioSpeechTimeoutTypedDict]
187
301
  r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
188
302
 
189
303
 
190
304
  class CreateSpeechOrq(BaseModel):
191
- retry: Optional[CreateSpeechRetry] = None
305
+ retry: Optional[CreateSpeechRouterAudioSpeechRetry] = None
192
306
  r"""Retry configuration for the request"""
193
307
 
194
- fallbacks: Optional[List[CreateSpeechFallbacks]] = None
308
+ fallbacks: Optional[List[CreateSpeechRouterAudioSpeechFallbacks]] = None
195
309
  r"""Array of fallback models to use if primary model fails"""
196
310
 
197
311
  name: Optional[str] = None
@@ -211,10 +325,10 @@ class CreateSpeechOrq(BaseModel):
211
325
  thread: Optional[CreateSpeechThread] = None
212
326
  r"""Thread information to group related requests"""
213
327
 
214
- load_balancer: Optional[CreateSpeechLoadBalancer] = None
328
+ load_balancer: Optional[CreateSpeechRouterAudioSpeechLoadBalancer] = None
215
329
  r"""Array of models with weights for load balancing requests"""
216
330
 
217
- timeout: Optional[CreateSpeechTimeout] = None
331
+ timeout: Optional[CreateSpeechRouterAudioSpeechTimeout] = None
218
332
  r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
219
333
 
220
334
  @model_serializer(mode="wrap")
@@ -267,6 +381,16 @@ class CreateSpeechRequestBodyTypedDict(TypedDict):
267
381
  r"""The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`. If a format is provided but not supported by the provider, the response will be in the default format. When the provided format is not supported by the provider, the response will be in the default format."""
268
382
  speed: NotRequired[float]
269
383
  r"""The speed of the generated audio."""
384
+ name: NotRequired[str]
385
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
386
+ fallbacks: NotRequired[List[CreateSpeechFallbacksTypedDict]]
387
+ r"""Array of fallback models to use if primary model fails"""
388
+ retry: NotRequired[CreateSpeechRetryTypedDict]
389
+ r"""Retry configuration for the request"""
390
+ load_balancer: NotRequired[CreateSpeechLoadBalancerTypedDict]
391
+ r"""Load balancer configuration for the request."""
392
+ timeout: NotRequired[CreateSpeechTimeoutTypedDict]
393
+ r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
270
394
  orq: NotRequired[CreateSpeechOrqTypedDict]
271
395
 
272
396
 
@@ -297,11 +421,37 @@ class CreateSpeechRequestBody(BaseModel):
297
421
  speed: Optional[float] = 1
298
422
  r"""The speed of the generated audio."""
299
423
 
424
+ name: Optional[str] = None
425
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
426
+
427
+ fallbacks: Optional[List[CreateSpeechFallbacks]] = None
428
+ r"""Array of fallback models to use if primary model fails"""
429
+
430
+ retry: Optional[CreateSpeechRetry] = None
431
+ r"""Retry configuration for the request"""
432
+
433
+ load_balancer: Optional[CreateSpeechLoadBalancer] = None
434
+ r"""Load balancer configuration for the request."""
435
+
436
+ timeout: Optional[CreateSpeechTimeout] = None
437
+ r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
438
+
300
439
  orq: Optional[CreateSpeechOrq] = None
301
440
 
302
441
  @model_serializer(mode="wrap")
303
442
  def serialize_model(self, handler):
304
- optional_fields = set(["response_format", "speed", "orq"])
443
+ optional_fields = set(
444
+ [
445
+ "response_format",
446
+ "speed",
447
+ "name",
448
+ "fallbacks",
449
+ "retry",
450
+ "load_balancer",
451
+ "timeout",
452
+ "orq",
453
+ ]
454
+ )
305
455
  serialized = handler(self)
306
456
  m = {}
307
457