orq-ai-sdk 4.2.0rc49__py3-none-any.whl → 4.2.12__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 (103) hide show
  1. orq_ai_sdk/_hooks/globalhook.py +0 -1
  2. orq_ai_sdk/_version.py +3 -3
  3. orq_ai_sdk/audio.py +30 -0
  4. orq_ai_sdk/chat.py +22 -0
  5. orq_ai_sdk/completions.py +438 -0
  6. orq_ai_sdk/contacts.py +43 -886
  7. orq_ai_sdk/deployments.py +61 -0
  8. orq_ai_sdk/edits.py +364 -0
  9. orq_ai_sdk/embeddings.py +344 -0
  10. orq_ai_sdk/generations.py +370 -0
  11. orq_ai_sdk/images.py +28 -0
  12. orq_ai_sdk/models/__init__.py +3839 -424
  13. orq_ai_sdk/models/conversationresponse.py +1 -1
  14. orq_ai_sdk/models/conversationwithmessagesresponse.py +1 -1
  15. orq_ai_sdk/models/createagentrequestop.py +768 -12
  16. orq_ai_sdk/models/createagentresponse.py +68 -2
  17. orq_ai_sdk/models/createchatcompletionop.py +538 -313
  18. orq_ai_sdk/models/createcompletionop.py +2078 -0
  19. orq_ai_sdk/models/createcontactop.py +5 -10
  20. orq_ai_sdk/models/createconversationop.py +1 -1
  21. orq_ai_sdk/models/createconversationresponseop.py +2 -2
  22. orq_ai_sdk/models/createdatasetitemop.py +4 -4
  23. orq_ai_sdk/models/createdatasetop.py +1 -1
  24. orq_ai_sdk/models/createdatasourceop.py +1 -1
  25. orq_ai_sdk/models/createembeddingop.py +579 -0
  26. orq_ai_sdk/models/createevalop.py +14 -14
  27. orq_ai_sdk/models/createidentityop.py +1 -1
  28. orq_ai_sdk/models/createimageeditop.py +715 -0
  29. orq_ai_sdk/models/createimageop.py +228 -82
  30. orq_ai_sdk/models/createimagevariationop.py +706 -0
  31. orq_ai_sdk/models/creatememoryop.py +4 -2
  32. orq_ai_sdk/models/createmoderationop.py +521 -0
  33. orq_ai_sdk/models/createpromptop.py +375 -6
  34. orq_ai_sdk/models/creatererankop.py +608 -0
  35. orq_ai_sdk/models/createresponseop.py +2567 -0
  36. orq_ai_sdk/models/createspeechop.py +466 -0
  37. orq_ai_sdk/models/createtoolop.py +6 -6
  38. orq_ai_sdk/models/createtranscriptionop.py +732 -0
  39. orq_ai_sdk/models/createtranslationop.py +702 -0
  40. orq_ai_sdk/models/deploymentgetconfigop.py +17 -7
  41. orq_ai_sdk/models/deploymentsop.py +1 -0
  42. orq_ai_sdk/models/deploymentstreamop.py +7 -0
  43. orq_ai_sdk/models/filegetop.py +1 -1
  44. orq_ai_sdk/models/filelistop.py +1 -1
  45. orq_ai_sdk/models/fileuploadop.py +1 -1
  46. orq_ai_sdk/models/generateconversationnameop.py +1 -1
  47. orq_ai_sdk/models/getallmemoriesop.py +4 -2
  48. orq_ai_sdk/models/getallpromptsop.py +188 -3
  49. orq_ai_sdk/models/getalltoolsop.py +6 -6
  50. orq_ai_sdk/models/getevalsop.py +17 -17
  51. orq_ai_sdk/models/getonepromptop.py +188 -3
  52. orq_ai_sdk/models/getpromptversionop.py +188 -3
  53. orq_ai_sdk/models/invokedeploymentrequest.py +11 -4
  54. orq_ai_sdk/models/listagentsop.py +372 -0
  55. orq_ai_sdk/models/listdatasetdatapointsop.py +4 -4
  56. orq_ai_sdk/models/listdatasetsop.py +1 -1
  57. orq_ai_sdk/models/listdatasourcesop.py +1 -1
  58. orq_ai_sdk/models/listidentitiesop.py +1 -1
  59. orq_ai_sdk/models/listmodelsop.py +1 -0
  60. orq_ai_sdk/models/listpromptversionsop.py +188 -3
  61. orq_ai_sdk/models/partdoneevent.py +1 -1
  62. orq_ai_sdk/models/post_v2_router_ocrop.py +408 -0
  63. orq_ai_sdk/models/publiccontact.py +9 -3
  64. orq_ai_sdk/models/publicidentity.py +62 -0
  65. orq_ai_sdk/models/reasoningpart.py +1 -1
  66. orq_ai_sdk/models/responsedoneevent.py +14 -11
  67. orq_ai_sdk/models/retrieveagentrequestop.py +382 -0
  68. orq_ai_sdk/models/retrievedatapointop.py +4 -4
  69. orq_ai_sdk/models/retrievedatasetop.py +1 -1
  70. orq_ai_sdk/models/retrievedatasourceop.py +1 -1
  71. orq_ai_sdk/models/retrieveidentityop.py +1 -1
  72. orq_ai_sdk/models/retrievememoryop.py +4 -2
  73. orq_ai_sdk/models/retrievetoolop.py +6 -6
  74. orq_ai_sdk/models/runagentop.py +379 -9
  75. orq_ai_sdk/models/streamrunagentop.py +385 -9
  76. orq_ai_sdk/models/updateagentop.py +770 -12
  77. orq_ai_sdk/models/updateconversationop.py +1 -1
  78. orq_ai_sdk/models/updatedatapointop.py +4 -4
  79. orq_ai_sdk/models/updatedatasetop.py +1 -1
  80. orq_ai_sdk/models/updatedatasourceop.py +1 -1
  81. orq_ai_sdk/models/updateevalop.py +14 -14
  82. orq_ai_sdk/models/updateidentityop.py +1 -1
  83. orq_ai_sdk/models/updatememoryop.py +4 -2
  84. orq_ai_sdk/models/updatepromptop.py +375 -6
  85. orq_ai_sdk/models/updatetoolop.py +7 -7
  86. orq_ai_sdk/moderations.py +218 -0
  87. orq_ai_sdk/orq_completions.py +666 -0
  88. orq_ai_sdk/orq_responses.py +398 -0
  89. orq_ai_sdk/rerank.py +330 -0
  90. orq_ai_sdk/router.py +89 -641
  91. orq_ai_sdk/speech.py +333 -0
  92. orq_ai_sdk/transcriptions.py +416 -0
  93. orq_ai_sdk/translations.py +384 -0
  94. orq_ai_sdk/variations.py +364 -0
  95. orq_ai_sdk-4.2.12.dist-info/METADATA +888 -0
  96. {orq_ai_sdk-4.2.0rc49.dist-info → orq_ai_sdk-4.2.12.dist-info}/RECORD +98 -75
  97. {orq_ai_sdk-4.2.0rc49.dist-info → orq_ai_sdk-4.2.12.dist-info}/WHEEL +1 -1
  98. orq_ai_sdk/models/deletecontactop.py +0 -44
  99. orq_ai_sdk/models/listcontactsop.py +0 -265
  100. orq_ai_sdk/models/retrievecontactop.py +0 -142
  101. orq_ai_sdk/models/updatecontactop.py +0 -233
  102. orq_ai_sdk-4.2.0rc49.dist-info/METADATA +0 -788
  103. {orq_ai_sdk-4.2.0rc49.dist-info → orq_ai_sdk-4.2.12.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,715 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .publiccontact import PublicContact, PublicContactTypedDict
5
+ from .publicidentity import PublicIdentity, PublicIdentityTypedDict
6
+ from orq_ai_sdk.types import (
7
+ BaseModel,
8
+ Nullable,
9
+ OptionalNullable,
10
+ UNSET,
11
+ UNSET_SENTINEL,
12
+ )
13
+ from orq_ai_sdk.utils import FieldMetadata, MultipartFormMetadata
14
+ import pydantic
15
+ from pydantic import model_serializer
16
+ from typing import Any, List, Literal, Optional
17
+ from typing_extensions import Annotated, NotRequired, TypedDict
18
+
19
+
20
+ CreateImageEditQuality = Literal[
21
+ "auto",
22
+ "high",
23
+ "medium",
24
+ "low",
25
+ "standard",
26
+ ]
27
+ r"""The quality of the image that will be generated. Auto will automatically select the best quality for the given model."""
28
+
29
+
30
+ CreateImageEditResponseFormat = Literal[
31
+ "url",
32
+ "b64_json",
33
+ ]
34
+ r"""The format in which the generated images are returned. Some of the models only return the image in base64 format."""
35
+
36
+
37
+ class CreateImageEditFallbacksTypedDict(TypedDict):
38
+ model: str
39
+ r"""Fallback model identifier"""
40
+
41
+
42
+ class CreateImageEditFallbacks(BaseModel):
43
+ model: str
44
+ r"""Fallback model identifier"""
45
+
46
+
47
+ class CreateImageEditRetryTypedDict(TypedDict):
48
+ r"""Retry configuration for the request"""
49
+
50
+ count: NotRequired[float]
51
+ r"""Number of retry attempts (1-5)"""
52
+ on_codes: NotRequired[List[float]]
53
+ r"""HTTP status codes that trigger retry logic"""
54
+
55
+
56
+ class CreateImageEditRetry(BaseModel):
57
+ r"""Retry configuration for the request"""
58
+
59
+ count: Optional[float] = 3
60
+ r"""Number of retry attempts (1-5)"""
61
+
62
+ on_codes: Optional[List[float]] = None
63
+ r"""HTTP status codes that trigger retry logic"""
64
+
65
+ @model_serializer(mode="wrap")
66
+ def serialize_model(self, handler):
67
+ optional_fields = set(["count", "on_codes"])
68
+ serialized = handler(self)
69
+ m = {}
70
+
71
+ for n, f in type(self).model_fields.items():
72
+ k = f.alias or n
73
+ val = serialized.get(k)
74
+
75
+ if val != UNSET_SENTINEL:
76
+ if val is not None or k not in optional_fields:
77
+ m[k] = val
78
+
79
+ return m
80
+
81
+
82
+ CreateImageEditType = Literal["exact_match",]
83
+
84
+
85
+ class CreateImageEditCacheTypedDict(TypedDict):
86
+ r"""Cache configuration for the request."""
87
+
88
+ type: CreateImageEditType
89
+ ttl: NotRequired[float]
90
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
91
+
92
+
93
+ class CreateImageEditCache(BaseModel):
94
+ r"""Cache configuration for the request."""
95
+
96
+ type: CreateImageEditType
97
+
98
+ ttl: Optional[float] = 1800
99
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
100
+
101
+ @model_serializer(mode="wrap")
102
+ def serialize_model(self, handler):
103
+ optional_fields = set(["ttl"])
104
+ serialized = handler(self)
105
+ m = {}
106
+
107
+ for n, f in type(self).model_fields.items():
108
+ k = f.alias or n
109
+ val = serialized.get(k)
110
+
111
+ if val != UNSET_SENTINEL:
112
+ if val is not None or k not in optional_fields:
113
+ m[k] = val
114
+
115
+ return m
116
+
117
+
118
+ CreateImageEditLoadBalancerType = Literal["weight_based",]
119
+
120
+
121
+ class CreateImageEditLoadBalancerModelsTypedDict(TypedDict):
122
+ model: str
123
+ r"""Model identifier for load balancing"""
124
+ weight: NotRequired[float]
125
+ r"""Weight assigned to this model for load balancing"""
126
+
127
+
128
+ class CreateImageEditLoadBalancerModels(BaseModel):
129
+ model: str
130
+ r"""Model identifier for load balancing"""
131
+
132
+ weight: Optional[float] = 0.5
133
+ r"""Weight assigned to this model for load balancing"""
134
+
135
+ @model_serializer(mode="wrap")
136
+ def serialize_model(self, handler):
137
+ optional_fields = set(["weight"])
138
+ serialized = handler(self)
139
+ m = {}
140
+
141
+ for n, f in type(self).model_fields.items():
142
+ k = f.alias or n
143
+ val = serialized.get(k)
144
+
145
+ if val != UNSET_SENTINEL:
146
+ if val is not None or k not in optional_fields:
147
+ m[k] = val
148
+
149
+ return m
150
+
151
+
152
+ class CreateImageEditLoadBalancer1TypedDict(TypedDict):
153
+ type: CreateImageEditLoadBalancerType
154
+ models: List[CreateImageEditLoadBalancerModelsTypedDict]
155
+
156
+
157
+ class CreateImageEditLoadBalancer1(BaseModel):
158
+ type: CreateImageEditLoadBalancerType
159
+
160
+ models: List[CreateImageEditLoadBalancerModels]
161
+
162
+
163
+ CreateImageEditLoadBalancerTypedDict = CreateImageEditLoadBalancer1TypedDict
164
+ r"""Load balancer configuration for the request."""
165
+
166
+
167
+ CreateImageEditLoadBalancer = CreateImageEditLoadBalancer1
168
+ r"""Load balancer configuration for the request."""
169
+
170
+
171
+ class CreateImageEditTimeoutTypedDict(TypedDict):
172
+ 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."""
173
+
174
+ call_timeout: float
175
+ r"""Timeout value in milliseconds"""
176
+
177
+
178
+ class CreateImageEditTimeout(BaseModel):
179
+ 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."""
180
+
181
+ call_timeout: float
182
+ r"""Timeout value in milliseconds"""
183
+
184
+
185
+ class CreateImageEditRouterImagesEditsRetryTypedDict(TypedDict):
186
+ r"""Retry configuration for the request"""
187
+
188
+ count: NotRequired[float]
189
+ r"""Number of retry attempts (1-5)"""
190
+ on_codes: NotRequired[List[float]]
191
+ r"""HTTP status codes that trigger retry logic"""
192
+
193
+
194
+ class CreateImageEditRouterImagesEditsRetry(BaseModel):
195
+ r"""Retry configuration for the request"""
196
+
197
+ count: Optional[float] = 3
198
+ r"""Number of retry attempts (1-5)"""
199
+
200
+ on_codes: Optional[List[float]] = None
201
+ r"""HTTP status codes that trigger retry logic"""
202
+
203
+ @model_serializer(mode="wrap")
204
+ def serialize_model(self, handler):
205
+ optional_fields = set(["count", "on_codes"])
206
+ serialized = handler(self)
207
+ m = {}
208
+
209
+ for n, f in type(self).model_fields.items():
210
+ k = f.alias or n
211
+ val = serialized.get(k)
212
+
213
+ if val != UNSET_SENTINEL:
214
+ if val is not None or k not in optional_fields:
215
+ m[k] = val
216
+
217
+ return m
218
+
219
+
220
+ class CreateImageEditRouterImagesEditsFallbacksTypedDict(TypedDict):
221
+ model: str
222
+ r"""Fallback model identifier"""
223
+
224
+
225
+ class CreateImageEditRouterImagesEditsFallbacks(BaseModel):
226
+ model: str
227
+ r"""Fallback model identifier"""
228
+
229
+
230
+ CreateImageEditVersion = Literal["latest",]
231
+ r"""Version of the prompt to use (currently only \"latest\" supported)"""
232
+
233
+
234
+ class CreateImageEditPromptTypedDict(TypedDict):
235
+ r"""Prompt configuration for the request"""
236
+
237
+ id: str
238
+ r"""Unique identifier of the prompt to use"""
239
+ version: CreateImageEditVersion
240
+ r"""Version of the prompt to use (currently only \"latest\" supported)"""
241
+
242
+
243
+ class CreateImageEditPrompt(BaseModel):
244
+ r"""Prompt configuration for the request"""
245
+
246
+ id: str
247
+ r"""Unique identifier of the prompt to use"""
248
+
249
+ version: CreateImageEditVersion
250
+ r"""Version of the prompt to use (currently only \"latest\" supported)"""
251
+
252
+
253
+ CreateImageEditRouterImagesEditsType = Literal["exact_match",]
254
+
255
+
256
+ class CreateImageEditRouterImagesEditsCacheTypedDict(TypedDict):
257
+ r"""Cache configuration for the request."""
258
+
259
+ type: CreateImageEditRouterImagesEditsType
260
+ ttl: NotRequired[float]
261
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
262
+
263
+
264
+ class CreateImageEditRouterImagesEditsCache(BaseModel):
265
+ r"""Cache configuration for the request."""
266
+
267
+ type: CreateImageEditRouterImagesEditsType
268
+
269
+ ttl: Optional[float] = 1800
270
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
271
+
272
+ @model_serializer(mode="wrap")
273
+ def serialize_model(self, handler):
274
+ optional_fields = set(["ttl"])
275
+ serialized = handler(self)
276
+ m = {}
277
+
278
+ for n, f in type(self).model_fields.items():
279
+ k = f.alias or n
280
+ val = serialized.get(k)
281
+
282
+ if val != UNSET_SENTINEL:
283
+ if val is not None or k not in optional_fields:
284
+ m[k] = val
285
+
286
+ return m
287
+
288
+
289
+ CreateImageEditLoadBalancerRouterImagesEditsType = Literal["weight_based",]
290
+
291
+
292
+ class CreateImageEditLoadBalancerRouterImagesEditsModelsTypedDict(TypedDict):
293
+ model: str
294
+ r"""Model identifier for load balancing"""
295
+ weight: NotRequired[float]
296
+ r"""Weight assigned to this model for load balancing"""
297
+
298
+
299
+ class CreateImageEditLoadBalancerRouterImagesEditsModels(BaseModel):
300
+ model: str
301
+ r"""Model identifier for load balancing"""
302
+
303
+ weight: Optional[float] = 0.5
304
+ r"""Weight assigned to this model for load balancing"""
305
+
306
+ @model_serializer(mode="wrap")
307
+ def serialize_model(self, handler):
308
+ optional_fields = set(["weight"])
309
+ serialized = handler(self)
310
+ m = {}
311
+
312
+ for n, f in type(self).model_fields.items():
313
+ k = f.alias or n
314
+ val = serialized.get(k)
315
+
316
+ if val != UNSET_SENTINEL:
317
+ if val is not None or k not in optional_fields:
318
+ m[k] = val
319
+
320
+ return m
321
+
322
+
323
+ class CreateImageEditLoadBalancerRouterImagesEdits1TypedDict(TypedDict):
324
+ type: CreateImageEditLoadBalancerRouterImagesEditsType
325
+ models: List[CreateImageEditLoadBalancerRouterImagesEditsModelsTypedDict]
326
+
327
+
328
+ class CreateImageEditLoadBalancerRouterImagesEdits1(BaseModel):
329
+ type: CreateImageEditLoadBalancerRouterImagesEditsType
330
+
331
+ models: List[CreateImageEditLoadBalancerRouterImagesEditsModels]
332
+
333
+
334
+ CreateImageEditRouterImagesEditsLoadBalancerTypedDict = (
335
+ CreateImageEditLoadBalancerRouterImagesEdits1TypedDict
336
+ )
337
+ r"""Array of models with weights for load balancing requests"""
338
+
339
+
340
+ CreateImageEditRouterImagesEditsLoadBalancer = (
341
+ CreateImageEditLoadBalancerRouterImagesEdits1
342
+ )
343
+ r"""Array of models with weights for load balancing requests"""
344
+
345
+
346
+ class CreateImageEditRouterImagesEditsTimeoutTypedDict(TypedDict):
347
+ 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."""
348
+
349
+ call_timeout: float
350
+ r"""Timeout value in milliseconds"""
351
+
352
+
353
+ class CreateImageEditRouterImagesEditsTimeout(BaseModel):
354
+ 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."""
355
+
356
+ call_timeout: float
357
+ r"""Timeout value in milliseconds"""
358
+
359
+
360
+ class CreateImageEditOrqTypedDict(TypedDict):
361
+ name: NotRequired[str]
362
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
363
+ retry: NotRequired[CreateImageEditRouterImagesEditsRetryTypedDict]
364
+ r"""Retry configuration for the request"""
365
+ fallbacks: NotRequired[List[CreateImageEditRouterImagesEditsFallbacksTypedDict]]
366
+ r"""Array of fallback models to use if primary model fails"""
367
+ prompt: NotRequired[CreateImageEditPromptTypedDict]
368
+ r"""Prompt configuration for the request"""
369
+ identity: NotRequired[PublicIdentityTypedDict]
370
+ r"""Information about the identity making the request. If the identity does not exist, it will be created automatically."""
371
+ contact: NotRequired[PublicContactTypedDict]
372
+ r"""@deprecated Use identity instead. Information about the contact making the request."""
373
+ cache: NotRequired[CreateImageEditRouterImagesEditsCacheTypedDict]
374
+ r"""Cache configuration for the request."""
375
+ load_balancer: NotRequired[CreateImageEditRouterImagesEditsLoadBalancerTypedDict]
376
+ r"""Array of models with weights for load balancing requests"""
377
+ timeout: NotRequired[CreateImageEditRouterImagesEditsTimeoutTypedDict]
378
+ 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."""
379
+
380
+
381
+ class CreateImageEditOrq(BaseModel):
382
+ name: Optional[str] = None
383
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
384
+
385
+ retry: Optional[CreateImageEditRouterImagesEditsRetry] = None
386
+ r"""Retry configuration for the request"""
387
+
388
+ fallbacks: Optional[List[CreateImageEditRouterImagesEditsFallbacks]] = None
389
+ r"""Array of fallback models to use if primary model fails"""
390
+
391
+ prompt: Optional[CreateImageEditPrompt] = None
392
+ r"""Prompt configuration for the request"""
393
+
394
+ identity: Optional[PublicIdentity] = None
395
+ r"""Information about the identity making the request. If the identity does not exist, it will be created automatically."""
396
+
397
+ contact: Annotated[
398
+ Optional[PublicContact],
399
+ pydantic.Field(
400
+ deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
401
+ ),
402
+ ] = None
403
+ r"""@deprecated Use identity instead. Information about the contact making the request."""
404
+
405
+ cache: Optional[CreateImageEditRouterImagesEditsCache] = None
406
+ r"""Cache configuration for the request."""
407
+
408
+ load_balancer: Optional[CreateImageEditRouterImagesEditsLoadBalancer] = None
409
+ r"""Array of models with weights for load balancing requests"""
410
+
411
+ timeout: Optional[CreateImageEditRouterImagesEditsTimeout] = None
412
+ 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."""
413
+
414
+ @model_serializer(mode="wrap")
415
+ def serialize_model(self, handler):
416
+ optional_fields = set(
417
+ [
418
+ "name",
419
+ "retry",
420
+ "fallbacks",
421
+ "prompt",
422
+ "identity",
423
+ "contact",
424
+ "cache",
425
+ "load_balancer",
426
+ "timeout",
427
+ ]
428
+ )
429
+ serialized = handler(self)
430
+ m = {}
431
+
432
+ for n, f in type(self).model_fields.items():
433
+ k = f.alias or n
434
+ val = serialized.get(k)
435
+
436
+ if val != UNSET_SENTINEL:
437
+ if val is not None or k not in optional_fields:
438
+ m[k] = val
439
+
440
+ return m
441
+
442
+
443
+ class CreateImageEditRequestBodyTypedDict(TypedDict):
444
+ model: str
445
+ r"""The model to use for image edit. [Check models](https://docs.orq.ai/docs/ai-gateway-supported-models#image-models)"""
446
+ prompt: str
447
+ r"""A text description of the desired image(s)."""
448
+ image: NotRequired[Any]
449
+ r"""The image(s) to edit. Must be a supported image file or an array of images. Each image should be a png, webp, or jpg file less than 50MB. You can provide up to 16 images."""
450
+ n: NotRequired[Nullable[int]]
451
+ r"""The number of images to generate. Must be between 1 and 10."""
452
+ size: NotRequired[Nullable[str]]
453
+ r"""The size of the generated images"""
454
+ quality: NotRequired[Nullable[CreateImageEditQuality]]
455
+ r"""The quality of the image that will be generated. Auto will automatically select the best quality for the given model."""
456
+ response_format: NotRequired[CreateImageEditResponseFormat]
457
+ r"""The format in which the generated images are returned. Some of the models only return the image in base64 format."""
458
+ user: NotRequired[str]
459
+ r"""A unique identifier representing your end-user, which can help to monitor and detect abuse."""
460
+ name: NotRequired[str]
461
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
462
+ fallbacks: NotRequired[List[CreateImageEditFallbacksTypedDict]]
463
+ r"""Array of fallback models to use if primary model fails"""
464
+ retry: NotRequired[CreateImageEditRetryTypedDict]
465
+ r"""Retry configuration for the request"""
466
+ cache: NotRequired[CreateImageEditCacheTypedDict]
467
+ r"""Cache configuration for the request."""
468
+ load_balancer: NotRequired[CreateImageEditLoadBalancerTypedDict]
469
+ r"""Load balancer configuration for the request."""
470
+ timeout: NotRequired[CreateImageEditTimeoutTypedDict]
471
+ 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."""
472
+ orq: NotRequired[CreateImageEditOrqTypedDict]
473
+
474
+
475
+ class CreateImageEditRequestBody(BaseModel):
476
+ model: Annotated[str, FieldMetadata(multipart=True)]
477
+ r"""The model to use for image edit. [Check models](https://docs.orq.ai/docs/ai-gateway-supported-models#image-models)"""
478
+
479
+ prompt: Annotated[str, FieldMetadata(multipart=True)]
480
+ r"""A text description of the desired image(s)."""
481
+
482
+ image: Annotated[Optional[Any], FieldMetadata(multipart=True)] = None
483
+ r"""The image(s) to edit. Must be a supported image file or an array of images. Each image should be a png, webp, or jpg file less than 50MB. You can provide up to 16 images."""
484
+
485
+ n: Annotated[OptionalNullable[int], FieldMetadata(multipart=True)] = 1
486
+ r"""The number of images to generate. Must be between 1 and 10."""
487
+
488
+ size: Annotated[OptionalNullable[str], FieldMetadata(multipart=True)] = UNSET
489
+ r"""The size of the generated images"""
490
+
491
+ quality: Annotated[
492
+ OptionalNullable[CreateImageEditQuality], FieldMetadata(multipart=True)
493
+ ] = UNSET
494
+ r"""The quality of the image that will be generated. Auto will automatically select the best quality for the given model."""
495
+
496
+ response_format: Annotated[
497
+ Optional[CreateImageEditResponseFormat], FieldMetadata(multipart=True)
498
+ ] = None
499
+ r"""The format in which the generated images are returned. Some of the models only return the image in base64 format."""
500
+
501
+ user: Annotated[Optional[str], FieldMetadata(multipart=True)] = None
502
+ r"""A unique identifier representing your end-user, which can help to monitor and detect abuse."""
503
+
504
+ name: Annotated[Optional[str], FieldMetadata(multipart=True)] = None
505
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
506
+
507
+ fallbacks: Annotated[
508
+ Optional[List[CreateImageEditFallbacks]],
509
+ FieldMetadata(multipart=MultipartFormMetadata(json=True)),
510
+ ] = None
511
+ r"""Array of fallback models to use if primary model fails"""
512
+
513
+ retry: Annotated[
514
+ Optional[CreateImageEditRetry],
515
+ FieldMetadata(multipart=MultipartFormMetadata(json=True)),
516
+ ] = None
517
+ r"""Retry configuration for the request"""
518
+
519
+ cache: Annotated[
520
+ Optional[CreateImageEditCache],
521
+ FieldMetadata(multipart=MultipartFormMetadata(json=True)),
522
+ ] = None
523
+ r"""Cache configuration for the request."""
524
+
525
+ load_balancer: Annotated[
526
+ Optional[CreateImageEditLoadBalancer],
527
+ FieldMetadata(multipart=MultipartFormMetadata(json=True)),
528
+ ] = None
529
+ r"""Load balancer configuration for the request."""
530
+
531
+ timeout: Annotated[
532
+ Optional[CreateImageEditTimeout],
533
+ FieldMetadata(multipart=MultipartFormMetadata(json=True)),
534
+ ] = None
535
+ 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."""
536
+
537
+ orq: Annotated[
538
+ Optional[CreateImageEditOrq],
539
+ FieldMetadata(multipart=MultipartFormMetadata(json=True)),
540
+ ] = None
541
+
542
+ @model_serializer(mode="wrap")
543
+ def serialize_model(self, handler):
544
+ optional_fields = set(
545
+ [
546
+ "image",
547
+ "n",
548
+ "size",
549
+ "quality",
550
+ "response_format",
551
+ "user",
552
+ "name",
553
+ "fallbacks",
554
+ "retry",
555
+ "cache",
556
+ "load_balancer",
557
+ "timeout",
558
+ "orq",
559
+ ]
560
+ )
561
+ nullable_fields = set(["n", "size", "quality"])
562
+ serialized = handler(self)
563
+ m = {}
564
+
565
+ for n, f in type(self).model_fields.items():
566
+ k = f.alias or n
567
+ val = serialized.get(k)
568
+ is_nullable_and_explicitly_set = (
569
+ k in nullable_fields
570
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
571
+ )
572
+
573
+ if val != UNSET_SENTINEL:
574
+ if (
575
+ val is not None
576
+ or k not in optional_fields
577
+ or is_nullable_and_explicitly_set
578
+ ):
579
+ m[k] = val
580
+
581
+ return m
582
+
583
+
584
+ class CreateImageEditDataTypedDict(TypedDict):
585
+ b64_json: NotRequired[str]
586
+ r"""The base64-encoded JSON of the generated image, if response_format is b64_json"""
587
+ url: NotRequired[str]
588
+ r"""The URL of the generated image, if response_format is url (default)"""
589
+
590
+
591
+ class CreateImageEditData(BaseModel):
592
+ b64_json: Optional[str] = None
593
+ r"""The base64-encoded JSON of the generated image, if response_format is b64_json"""
594
+
595
+ url: Optional[str] = None
596
+ r"""The URL of the generated image, if response_format is url (default)"""
597
+
598
+ @model_serializer(mode="wrap")
599
+ def serialize_model(self, handler):
600
+ optional_fields = set(["b64_json", "url"])
601
+ serialized = handler(self)
602
+ m = {}
603
+
604
+ for n, f in type(self).model_fields.items():
605
+ k = f.alias or n
606
+ val = serialized.get(k)
607
+
608
+ if val != UNSET_SENTINEL:
609
+ if val is not None or k not in optional_fields:
610
+ m[k] = val
611
+
612
+ return m
613
+
614
+
615
+ class CreateImageEditInputTokensDetailsTypedDict(TypedDict):
616
+ r"""The input tokens detailed information for the image generation."""
617
+
618
+ text_tokens: float
619
+ r"""The number of text tokens in the input prompt."""
620
+ image_tokens: float
621
+ r"""The number of image tokens in the input prompt."""
622
+
623
+
624
+ class CreateImageEditInputTokensDetails(BaseModel):
625
+ r"""The input tokens detailed information for the image generation."""
626
+
627
+ text_tokens: float
628
+ r"""The number of text tokens in the input prompt."""
629
+
630
+ image_tokens: float
631
+ r"""The number of image tokens in the input prompt."""
632
+
633
+
634
+ class CreateImageEditUsageTypedDict(TypedDict):
635
+ r"""The token usage information for the image generation."""
636
+
637
+ total_tokens: float
638
+ r"""The total number of tokens (images and text) used for the image generation."""
639
+ input_tokens: float
640
+ r"""The number of tokens (images and text) in the input prompt."""
641
+ output_tokens: float
642
+ r"""The number of output tokens generated by the model."""
643
+ input_tokens_details: CreateImageEditInputTokensDetailsTypedDict
644
+ r"""The input tokens detailed information for the image generation."""
645
+
646
+
647
+ class CreateImageEditUsage(BaseModel):
648
+ r"""The token usage information for the image generation."""
649
+
650
+ total_tokens: float
651
+ r"""The total number of tokens (images and text) used for the image generation."""
652
+
653
+ input_tokens: float
654
+ r"""The number of tokens (images and text) in the input prompt."""
655
+
656
+ output_tokens: float
657
+ r"""The number of output tokens generated by the model."""
658
+
659
+ input_tokens_details: CreateImageEditInputTokensDetails
660
+ r"""The input tokens detailed information for the image generation."""
661
+
662
+
663
+ class CreateImageEditResponseBodyTypedDict(TypedDict):
664
+ r"""Represents an image edit response from the API."""
665
+
666
+ created: float
667
+ r"""The Unix timestamp (in seconds) of when the image was created."""
668
+ data: List[CreateImageEditDataTypedDict]
669
+ r"""The list of generated images."""
670
+ output_format: NotRequired[str]
671
+ r"""The output format of the image generation"""
672
+ size: NotRequired[str]
673
+ r"""The size of the image generated"""
674
+ quality: NotRequired[str]
675
+ r"""The quality of the image generated"""
676
+ usage: NotRequired[CreateImageEditUsageTypedDict]
677
+ r"""The token usage information for the image generation."""
678
+
679
+
680
+ class CreateImageEditResponseBody(BaseModel):
681
+ r"""Represents an image edit response from the API."""
682
+
683
+ created: float
684
+ r"""The Unix timestamp (in seconds) of when the image was created."""
685
+
686
+ data: List[CreateImageEditData]
687
+ r"""The list of generated images."""
688
+
689
+ output_format: Optional[str] = None
690
+ r"""The output format of the image generation"""
691
+
692
+ size: Optional[str] = None
693
+ r"""The size of the image generated"""
694
+
695
+ quality: Optional[str] = None
696
+ r"""The quality of the image generated"""
697
+
698
+ usage: Optional[CreateImageEditUsage] = None
699
+ r"""The token usage information for the image generation."""
700
+
701
+ @model_serializer(mode="wrap")
702
+ def serialize_model(self, handler):
703
+ optional_fields = set(["output_format", "size", "quality", "usage"])
704
+ serialized = handler(self)
705
+ m = {}
706
+
707
+ for n, f in type(self).model_fields.items():
708
+ k = f.alias or n
709
+ val = serialized.get(k)
710
+
711
+ if val != UNSET_SENTINEL:
712
+ if val is not None or k not in optional_fields:
713
+ m[k] = val
714
+
715
+ return m