orq-ai-sdk 4.2.17__py3-none-any.whl → 4.3.0rc0__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.
- orq_ai_sdk/_hooks/globalhook.py +1 -0
- orq_ai_sdk/_version.py +3 -3
- orq_ai_sdk/agents.py +186 -186
- orq_ai_sdk/completions.py +1 -107
- orq_ai_sdk/edits.py +1 -107
- orq_ai_sdk/embeddings.py +1 -107
- orq_ai_sdk/generations.py +1 -99
- orq_ai_sdk/models/__init__.py +0 -405
- orq_ai_sdk/models/conversationresponse.py +1 -1
- orq_ai_sdk/models/conversationwithmessagesresponse.py +1 -1
- orq_ai_sdk/models/createagentrequestop.py +0 -24
- orq_ai_sdk/models/createchatcompletionop.py +0 -6
- orq_ai_sdk/models/createcompletionop.py +30 -218
- orq_ai_sdk/models/createcontactop.py +1 -1
- orq_ai_sdk/models/createconversationop.py +1 -1
- orq_ai_sdk/models/createconversationresponseop.py +2 -2
- orq_ai_sdk/models/createdatasetitemop.py +4 -4
- orq_ai_sdk/models/createdatasetop.py +1 -1
- orq_ai_sdk/models/createdatasourceop.py +1 -1
- orq_ai_sdk/models/createembeddingop.py +26 -221
- orq_ai_sdk/models/createevalop.py +14 -14
- orq_ai_sdk/models/createidentityop.py +1 -1
- orq_ai_sdk/models/createimageeditop.py +31 -242
- orq_ai_sdk/models/createimageop.py +22 -210
- orq_ai_sdk/models/createimagevariationop.py +31 -251
- orq_ai_sdk/models/createpromptop.py +0 -12
- orq_ai_sdk/models/creatererankop.py +26 -218
- orq_ai_sdk/models/createspeechop.py +24 -174
- orq_ai_sdk/models/createtoolop.py +6 -6
- orq_ai_sdk/models/createtranscriptionop.py +10 -180
- orq_ai_sdk/models/createtranslationop.py +10 -172
- orq_ai_sdk/models/filegetop.py +1 -1
- orq_ai_sdk/models/filelistop.py +1 -1
- orq_ai_sdk/models/fileuploadop.py +1 -1
- orq_ai_sdk/models/generateconversationnameop.py +1 -1
- orq_ai_sdk/models/getallpromptsop.py +0 -6
- orq_ai_sdk/models/getalltoolsop.py +6 -6
- orq_ai_sdk/models/getevalsop.py +14 -14
- orq_ai_sdk/models/getonepromptop.py +0 -6
- orq_ai_sdk/models/getpromptversionop.py +0 -6
- orq_ai_sdk/models/listagentsop.py +0 -12
- orq_ai_sdk/models/listdatasetdatapointsop.py +4 -4
- orq_ai_sdk/models/listdatasetsop.py +1 -1
- orq_ai_sdk/models/listdatasourcesop.py +1 -1
- orq_ai_sdk/models/listidentitiesop.py +1 -1
- orq_ai_sdk/models/listpromptversionsop.py +0 -6
- orq_ai_sdk/models/partdoneevent.py +1 -1
- orq_ai_sdk/models/reasoningpart.py +1 -1
- orq_ai_sdk/models/retrieveagentrequestop.py +0 -12
- orq_ai_sdk/models/retrievedatapointop.py +4 -4
- orq_ai_sdk/models/retrievedatasetop.py +1 -1
- orq_ai_sdk/models/retrievedatasourceop.py +1 -1
- orq_ai_sdk/models/retrieveidentityop.py +1 -1
- orq_ai_sdk/models/retrievetoolop.py +6 -6
- orq_ai_sdk/models/runagentop.py +1 -13
- orq_ai_sdk/models/streamrunagentop.py +1 -13
- orq_ai_sdk/models/updateagentop.py +0 -24
- orq_ai_sdk/models/updateconversationop.py +1 -1
- orq_ai_sdk/models/updatedatapointop.py +4 -4
- orq_ai_sdk/models/updatedatasetop.py +1 -1
- orq_ai_sdk/models/updatedatasourceop.py +1 -1
- orq_ai_sdk/models/updateevalop.py +14 -14
- orq_ai_sdk/models/updateidentityop.py +1 -1
- orq_ai_sdk/models/updatepromptop.py +0 -12
- orq_ai_sdk/models/updatetoolop.py +7 -7
- orq_ai_sdk/orq_completions.py +0 -6
- orq_ai_sdk/rerank.py +0 -98
- orq_ai_sdk/speech.py +1 -83
- orq_ai_sdk/transcriptions.py +0 -90
- orq_ai_sdk/translations.py +1 -87
- orq_ai_sdk/variations.py +1 -111
- {orq_ai_sdk-4.2.17.dist-info → orq_ai_sdk-4.3.0rc0.dist-info}/METADATA +202 -202
- {orq_ai_sdk-4.2.17.dist-info → orq_ai_sdk-4.3.0rc0.dist-info}/RECORD +75 -75
- {orq_ai_sdk-4.2.17.dist-info → orq_ai_sdk-4.3.0rc0.dist-info}/WHEEL +1 -1
- {orq_ai_sdk-4.2.17.dist-info → orq_ai_sdk-4.3.0rc0.dist-info}/top_level.txt +0 -0
|
@@ -26,41 +26,6 @@ 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
|
-
|
|
64
29
|
CreateRerankType = Literal["exact_match",]
|
|
65
30
|
|
|
66
31
|
|
|
@@ -97,120 +62,7 @@ class CreateRerankCache(BaseModel):
|
|
|
97
62
|
return m
|
|
98
63
|
|
|
99
64
|
|
|
100
|
-
|
|
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):
|
|
65
|
+
class CreateRerankRetryTypedDict(TypedDict):
|
|
214
66
|
r"""Retry configuration for the request"""
|
|
215
67
|
|
|
216
68
|
count: NotRequired[float]
|
|
@@ -219,7 +71,7 @@ class CreateRerankRouterRerankRetryTypedDict(TypedDict):
|
|
|
219
71
|
r"""HTTP status codes that trigger retry logic"""
|
|
220
72
|
|
|
221
73
|
|
|
222
|
-
class
|
|
74
|
+
class CreateRerankRetry(BaseModel):
|
|
223
75
|
r"""Retry configuration for the request"""
|
|
224
76
|
|
|
225
77
|
count: Optional[float] = 3
|
|
@@ -245,17 +97,17 @@ class CreateRerankRouterRerankRetry(BaseModel):
|
|
|
245
97
|
return m
|
|
246
98
|
|
|
247
99
|
|
|
248
|
-
|
|
100
|
+
CreateRerankLoadBalancerType = Literal["weight_based",]
|
|
249
101
|
|
|
250
102
|
|
|
251
|
-
class
|
|
103
|
+
class CreateRerankLoadBalancerModelsTypedDict(TypedDict):
|
|
252
104
|
model: str
|
|
253
105
|
r"""Model identifier for load balancing"""
|
|
254
106
|
weight: NotRequired[float]
|
|
255
107
|
r"""Weight assigned to this model for load balancing"""
|
|
256
108
|
|
|
257
109
|
|
|
258
|
-
class
|
|
110
|
+
class CreateRerankLoadBalancerModels(BaseModel):
|
|
259
111
|
model: str
|
|
260
112
|
r"""Model identifier for load balancing"""
|
|
261
113
|
|
|
@@ -279,35 +131,33 @@ class CreateRerankLoadBalancerRouterRerankModels(BaseModel):
|
|
|
279
131
|
return m
|
|
280
132
|
|
|
281
133
|
|
|
282
|
-
class
|
|
283
|
-
type:
|
|
284
|
-
models: List[
|
|
134
|
+
class CreateRerankLoadBalancer1TypedDict(TypedDict):
|
|
135
|
+
type: CreateRerankLoadBalancerType
|
|
136
|
+
models: List[CreateRerankLoadBalancerModelsTypedDict]
|
|
285
137
|
|
|
286
138
|
|
|
287
|
-
class
|
|
288
|
-
type:
|
|
139
|
+
class CreateRerankLoadBalancer1(BaseModel):
|
|
140
|
+
type: CreateRerankLoadBalancerType
|
|
289
141
|
|
|
290
|
-
models: List[
|
|
142
|
+
models: List[CreateRerankLoadBalancerModels]
|
|
291
143
|
|
|
292
144
|
|
|
293
|
-
|
|
294
|
-
CreateRerankLoadBalancerRouterRerank1TypedDict
|
|
295
|
-
)
|
|
145
|
+
CreateRerankLoadBalancerTypedDict = CreateRerankLoadBalancer1TypedDict
|
|
296
146
|
r"""Array of models with weights for load balancing requests"""
|
|
297
147
|
|
|
298
148
|
|
|
299
|
-
|
|
149
|
+
CreateRerankLoadBalancer = CreateRerankLoadBalancer1
|
|
300
150
|
r"""Array of models with weights for load balancing requests"""
|
|
301
151
|
|
|
302
152
|
|
|
303
|
-
class
|
|
153
|
+
class CreateRerankTimeoutTypedDict(TypedDict):
|
|
304
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."""
|
|
305
155
|
|
|
306
156
|
call_timeout: float
|
|
307
157
|
r"""Timeout value in milliseconds"""
|
|
308
158
|
|
|
309
159
|
|
|
310
|
-
class
|
|
160
|
+
class CreateRerankTimeout(BaseModel):
|
|
311
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."""
|
|
312
162
|
|
|
313
163
|
call_timeout: float
|
|
@@ -317,19 +167,19 @@ class CreateRerankRouterRerankTimeout(BaseModel):
|
|
|
317
167
|
class CreateRerankOrqTypedDict(TypedDict):
|
|
318
168
|
name: NotRequired[str]
|
|
319
169
|
r"""The name to display on the trace. If not specified, the default system name will be used."""
|
|
320
|
-
fallbacks: NotRequired[List[
|
|
170
|
+
fallbacks: NotRequired[List[CreateRerankFallbacksTypedDict]]
|
|
321
171
|
r"""Array of fallback models to use if primary model fails"""
|
|
322
|
-
cache: NotRequired[
|
|
172
|
+
cache: NotRequired[CreateRerankCacheTypedDict]
|
|
323
173
|
r"""Cache configuration for the request."""
|
|
324
|
-
retry: NotRequired[
|
|
174
|
+
retry: NotRequired[CreateRerankRetryTypedDict]
|
|
325
175
|
r"""Retry configuration for the request"""
|
|
326
176
|
identity: NotRequired[PublicIdentityTypedDict]
|
|
327
177
|
r"""Information about the identity making the request. If the identity does not exist, it will be created automatically."""
|
|
328
178
|
contact: NotRequired[PublicContactTypedDict]
|
|
329
179
|
r"""@deprecated Use identity instead. Information about the contact making the request."""
|
|
330
|
-
load_balancer: NotRequired[
|
|
180
|
+
load_balancer: NotRequired[CreateRerankLoadBalancerTypedDict]
|
|
331
181
|
r"""Array of models with weights for load balancing requests"""
|
|
332
|
-
timeout: NotRequired[
|
|
182
|
+
timeout: NotRequired[CreateRerankTimeoutTypedDict]
|
|
333
183
|
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."""
|
|
334
184
|
|
|
335
185
|
|
|
@@ -337,13 +187,13 @@ class CreateRerankOrq(BaseModel):
|
|
|
337
187
|
name: Optional[str] = None
|
|
338
188
|
r"""The name to display on the trace. If not specified, the default system name will be used."""
|
|
339
189
|
|
|
340
|
-
fallbacks: Optional[List[
|
|
190
|
+
fallbacks: Optional[List[CreateRerankFallbacks]] = None
|
|
341
191
|
r"""Array of fallback models to use if primary model fails"""
|
|
342
192
|
|
|
343
|
-
cache: Optional[
|
|
193
|
+
cache: Optional[CreateRerankCache] = None
|
|
344
194
|
r"""Cache configuration for the request."""
|
|
345
195
|
|
|
346
|
-
retry: Optional[
|
|
196
|
+
retry: Optional[CreateRerankRetry] = None
|
|
347
197
|
r"""Retry configuration for the request"""
|
|
348
198
|
|
|
349
199
|
identity: Optional[PublicIdentity] = None
|
|
@@ -357,10 +207,10 @@ class CreateRerankOrq(BaseModel):
|
|
|
357
207
|
] = None
|
|
358
208
|
r"""@deprecated Use identity instead. Information about the contact making the request."""
|
|
359
209
|
|
|
360
|
-
load_balancer: Optional[
|
|
210
|
+
load_balancer: Optional[CreateRerankLoadBalancer] = None
|
|
361
211
|
r"""Array of models with weights for load balancing requests"""
|
|
362
212
|
|
|
363
|
-
timeout: Optional[
|
|
213
|
+
timeout: Optional[CreateRerankTimeout] = None
|
|
364
214
|
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."""
|
|
365
215
|
|
|
366
216
|
@model_serializer(mode="wrap")
|
|
@@ -404,18 +254,6 @@ class CreateRerankRequestBodyTypedDict(TypedDict):
|
|
|
404
254
|
r"""The number of most relevant documents or indices to return, defaults to the length of the documents"""
|
|
405
255
|
filename: NotRequired[Nullable[str]]
|
|
406
256
|
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."""
|
|
419
257
|
orq: NotRequired[CreateRerankOrqTypedDict]
|
|
420
258
|
|
|
421
259
|
|
|
@@ -437,41 +275,11 @@ class CreateRerankRequestBody(BaseModel):
|
|
|
437
275
|
filename: OptionalNullable[str] = UNSET
|
|
438
276
|
r"""The filename of the document to rerank"""
|
|
439
277
|
|
|
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
|
-
|
|
458
278
|
orq: Optional[CreateRerankOrq] = None
|
|
459
279
|
|
|
460
280
|
@model_serializer(mode="wrap")
|
|
461
281
|
def serialize_model(self, handler):
|
|
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
|
-
)
|
|
282
|
+
optional_fields = set(["top_n", "filename", "orq"])
|
|
475
283
|
nullable_fields = set(["filename"])
|
|
476
284
|
serialized = handler(self)
|
|
477
285
|
m = {}
|
|
@@ -21,16 +21,6 @@ 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
|
-
|
|
34
24
|
class CreateSpeechRetryTypedDict(TypedDict):
|
|
35
25
|
r"""Retry configuration for the request"""
|
|
36
26
|
|
|
@@ -66,114 +56,12 @@ class CreateSpeechRetry(BaseModel):
|
|
|
66
56
|
return m
|
|
67
57
|
|
|
68
58
|
|
|
69
|
-
|
|
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):
|
|
59
|
+
class CreateSpeechFallbacksTypedDict(TypedDict):
|
|
172
60
|
model: str
|
|
173
61
|
r"""Fallback model identifier"""
|
|
174
62
|
|
|
175
63
|
|
|
176
|
-
class
|
|
64
|
+
class CreateSpeechFallbacks(BaseModel):
|
|
177
65
|
model: str
|
|
178
66
|
r"""Fallback model identifier"""
|
|
179
67
|
|
|
@@ -213,17 +101,17 @@ class CreateSpeechThread(BaseModel):
|
|
|
213
101
|
return m
|
|
214
102
|
|
|
215
103
|
|
|
216
|
-
|
|
104
|
+
CreateSpeechLoadBalancerType = Literal["weight_based",]
|
|
217
105
|
|
|
218
106
|
|
|
219
|
-
class
|
|
107
|
+
class CreateSpeechLoadBalancerModelsTypedDict(TypedDict):
|
|
220
108
|
model: str
|
|
221
109
|
r"""Model identifier for load balancing"""
|
|
222
110
|
weight: NotRequired[float]
|
|
223
111
|
r"""Weight assigned to this model for load balancing"""
|
|
224
112
|
|
|
225
113
|
|
|
226
|
-
class
|
|
114
|
+
class CreateSpeechLoadBalancerModels(BaseModel):
|
|
227
115
|
model: str
|
|
228
116
|
r"""Model identifier for load balancing"""
|
|
229
117
|
|
|
@@ -247,35 +135,33 @@ class CreateSpeechLoadBalancerRouterAudioSpeechModels(BaseModel):
|
|
|
247
135
|
return m
|
|
248
136
|
|
|
249
137
|
|
|
250
|
-
class
|
|
251
|
-
type:
|
|
252
|
-
models: List[
|
|
138
|
+
class CreateSpeechLoadBalancer1TypedDict(TypedDict):
|
|
139
|
+
type: CreateSpeechLoadBalancerType
|
|
140
|
+
models: List[CreateSpeechLoadBalancerModelsTypedDict]
|
|
253
141
|
|
|
254
142
|
|
|
255
|
-
class
|
|
256
|
-
type:
|
|
143
|
+
class CreateSpeechLoadBalancer1(BaseModel):
|
|
144
|
+
type: CreateSpeechLoadBalancerType
|
|
257
145
|
|
|
258
|
-
models: List[
|
|
146
|
+
models: List[CreateSpeechLoadBalancerModels]
|
|
259
147
|
|
|
260
148
|
|
|
261
|
-
|
|
262
|
-
CreateSpeechLoadBalancerRouterAudioSpeech1TypedDict
|
|
263
|
-
)
|
|
149
|
+
CreateSpeechLoadBalancerTypedDict = CreateSpeechLoadBalancer1TypedDict
|
|
264
150
|
r"""Array of models with weights for load balancing requests"""
|
|
265
151
|
|
|
266
152
|
|
|
267
|
-
|
|
153
|
+
CreateSpeechLoadBalancer = CreateSpeechLoadBalancer1
|
|
268
154
|
r"""Array of models with weights for load balancing requests"""
|
|
269
155
|
|
|
270
156
|
|
|
271
|
-
class
|
|
157
|
+
class CreateSpeechTimeoutTypedDict(TypedDict):
|
|
272
158
|
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."""
|
|
273
159
|
|
|
274
160
|
call_timeout: float
|
|
275
161
|
r"""Timeout value in milliseconds"""
|
|
276
162
|
|
|
277
163
|
|
|
278
|
-
class
|
|
164
|
+
class CreateSpeechTimeout(BaseModel):
|
|
279
165
|
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."""
|
|
280
166
|
|
|
281
167
|
call_timeout: float
|
|
@@ -283,9 +169,9 @@ class CreateSpeechRouterAudioSpeechTimeout(BaseModel):
|
|
|
283
169
|
|
|
284
170
|
|
|
285
171
|
class CreateSpeechOrqTypedDict(TypedDict):
|
|
286
|
-
retry: NotRequired[
|
|
172
|
+
retry: NotRequired[CreateSpeechRetryTypedDict]
|
|
287
173
|
r"""Retry configuration for the request"""
|
|
288
|
-
fallbacks: NotRequired[List[
|
|
174
|
+
fallbacks: NotRequired[List[CreateSpeechFallbacksTypedDict]]
|
|
289
175
|
r"""Array of fallback models to use if primary model fails"""
|
|
290
176
|
name: NotRequired[str]
|
|
291
177
|
r"""The name to display on the trace. If not specified, the default system name will be used."""
|
|
@@ -295,17 +181,17 @@ class CreateSpeechOrqTypedDict(TypedDict):
|
|
|
295
181
|
r"""@deprecated Use identity instead. Information about the contact making the request."""
|
|
296
182
|
thread: NotRequired[CreateSpeechThreadTypedDict]
|
|
297
183
|
r"""Thread information to group related requests"""
|
|
298
|
-
load_balancer: NotRequired[
|
|
184
|
+
load_balancer: NotRequired[CreateSpeechLoadBalancerTypedDict]
|
|
299
185
|
r"""Array of models with weights for load balancing requests"""
|
|
300
|
-
timeout: NotRequired[
|
|
186
|
+
timeout: NotRequired[CreateSpeechTimeoutTypedDict]
|
|
301
187
|
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."""
|
|
302
188
|
|
|
303
189
|
|
|
304
190
|
class CreateSpeechOrq(BaseModel):
|
|
305
|
-
retry: Optional[
|
|
191
|
+
retry: Optional[CreateSpeechRetry] = None
|
|
306
192
|
r"""Retry configuration for the request"""
|
|
307
193
|
|
|
308
|
-
fallbacks: Optional[List[
|
|
194
|
+
fallbacks: Optional[List[CreateSpeechFallbacks]] = None
|
|
309
195
|
r"""Array of fallback models to use if primary model fails"""
|
|
310
196
|
|
|
311
197
|
name: Optional[str] = None
|
|
@@ -325,10 +211,10 @@ class CreateSpeechOrq(BaseModel):
|
|
|
325
211
|
thread: Optional[CreateSpeechThread] = None
|
|
326
212
|
r"""Thread information to group related requests"""
|
|
327
213
|
|
|
328
|
-
load_balancer: Optional[
|
|
214
|
+
load_balancer: Optional[CreateSpeechLoadBalancer] = None
|
|
329
215
|
r"""Array of models with weights for load balancing requests"""
|
|
330
216
|
|
|
331
|
-
timeout: Optional[
|
|
217
|
+
timeout: Optional[CreateSpeechTimeout] = None
|
|
332
218
|
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."""
|
|
333
219
|
|
|
334
220
|
@model_serializer(mode="wrap")
|
|
@@ -381,16 +267,6 @@ class CreateSpeechRequestBodyTypedDict(TypedDict):
|
|
|
381
267
|
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."""
|
|
382
268
|
speed: NotRequired[float]
|
|
383
269
|
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."""
|
|
394
270
|
orq: NotRequired[CreateSpeechOrqTypedDict]
|
|
395
271
|
|
|
396
272
|
|
|
@@ -421,37 +297,11 @@ class CreateSpeechRequestBody(BaseModel):
|
|
|
421
297
|
speed: Optional[float] = 1
|
|
422
298
|
r"""The speed of the generated audio."""
|
|
423
299
|
|
|
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
|
-
|
|
439
300
|
orq: Optional[CreateSpeechOrq] = None
|
|
440
301
|
|
|
441
302
|
@model_serializer(mode="wrap")
|
|
442
303
|
def serialize_model(self, handler):
|
|
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
|
-
)
|
|
304
|
+
optional_fields = set(["response_format", "speed", "orq"])
|
|
455
305
|
serialized = handler(self)
|
|
456
306
|
m = {}
|
|
457
307
|
|