orq-ai-sdk 4.2.0rc28__py3-none-any.whl → 4.2.6__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 (167) 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/basesdk.py +20 -6
  5. orq_ai_sdk/chat.py +22 -0
  6. orq_ai_sdk/completions.py +332 -0
  7. orq_ai_sdk/contacts.py +43 -855
  8. orq_ai_sdk/deployments.py +61 -0
  9. orq_ai_sdk/edits.py +258 -0
  10. orq_ai_sdk/embeddings.py +238 -0
  11. orq_ai_sdk/generations.py +272 -0
  12. orq_ai_sdk/identities.py +1037 -0
  13. orq_ai_sdk/images.py +28 -0
  14. orq_ai_sdk/models/__init__.py +5341 -737
  15. orq_ai_sdk/models/actionreviewedstreamingevent.py +18 -1
  16. orq_ai_sdk/models/actionreviewrequestedstreamingevent.py +44 -1
  17. orq_ai_sdk/models/agenterroredstreamingevent.py +18 -1
  18. orq_ai_sdk/models/agentinactivestreamingevent.py +168 -70
  19. orq_ai_sdk/models/agentmessagecreatedstreamingevent.py +18 -2
  20. orq_ai_sdk/models/agentresponsemessage.py +18 -2
  21. orq_ai_sdk/models/agentstartedstreamingevent.py +127 -2
  22. orq_ai_sdk/models/agentthoughtstreamingevent.py +178 -211
  23. orq_ai_sdk/models/conversationresponse.py +31 -20
  24. orq_ai_sdk/models/conversationwithmessagesresponse.py +31 -20
  25. orq_ai_sdk/models/createagentrequestop.py +1922 -384
  26. orq_ai_sdk/models/createagentresponse.py +147 -91
  27. orq_ai_sdk/models/createagentresponserequestop.py +111 -2
  28. orq_ai_sdk/models/createchatcompletionop.py +1375 -861
  29. orq_ai_sdk/models/createchunkop.py +46 -19
  30. orq_ai_sdk/models/createcompletionop.py +1890 -0
  31. orq_ai_sdk/models/createcontactop.py +45 -56
  32. orq_ai_sdk/models/createconversationop.py +61 -39
  33. orq_ai_sdk/models/createconversationresponseop.py +68 -4
  34. orq_ai_sdk/models/createdatasetitemop.py +424 -80
  35. orq_ai_sdk/models/createdatasetop.py +19 -2
  36. orq_ai_sdk/models/createdatasourceop.py +92 -26
  37. orq_ai_sdk/models/createembeddingop.py +384 -0
  38. orq_ai_sdk/models/createevalop.py +552 -24
  39. orq_ai_sdk/models/createidentityop.py +176 -0
  40. orq_ai_sdk/models/createimageeditop.py +504 -0
  41. orq_ai_sdk/models/createimageop.py +208 -117
  42. orq_ai_sdk/models/createimagevariationop.py +486 -0
  43. orq_ai_sdk/models/createknowledgeop.py +186 -121
  44. orq_ai_sdk/models/creatememorydocumentop.py +50 -1
  45. orq_ai_sdk/models/creatememoryop.py +34 -21
  46. orq_ai_sdk/models/creatememorystoreop.py +34 -1
  47. orq_ai_sdk/models/createmoderationop.py +521 -0
  48. orq_ai_sdk/models/createpromptop.py +2748 -1252
  49. orq_ai_sdk/models/creatererankop.py +416 -0
  50. orq_ai_sdk/models/createresponseop.py +2567 -0
  51. orq_ai_sdk/models/createspeechop.py +316 -0
  52. orq_ai_sdk/models/createtoolop.py +537 -12
  53. orq_ai_sdk/models/createtranscriptionop.py +562 -0
  54. orq_ai_sdk/models/createtranslationop.py +540 -0
  55. orq_ai_sdk/models/datapart.py +18 -1
  56. orq_ai_sdk/models/deletechunksop.py +34 -1
  57. orq_ai_sdk/models/{deletecontactop.py → deleteidentityop.py} +9 -9
  58. orq_ai_sdk/models/deletepromptop.py +26 -0
  59. orq_ai_sdk/models/deploymentcreatemetricop.py +362 -76
  60. orq_ai_sdk/models/deploymentgetconfigop.py +635 -194
  61. orq_ai_sdk/models/deploymentinvokeop.py +168 -173
  62. orq_ai_sdk/models/deploymentsop.py +195 -58
  63. orq_ai_sdk/models/deploymentstreamop.py +652 -304
  64. orq_ai_sdk/models/errorpart.py +18 -1
  65. orq_ai_sdk/models/filecontentpartschema.py +18 -1
  66. orq_ai_sdk/models/filegetop.py +19 -2
  67. orq_ai_sdk/models/filelistop.py +35 -2
  68. orq_ai_sdk/models/filepart.py +50 -1
  69. orq_ai_sdk/models/fileuploadop.py +51 -2
  70. orq_ai_sdk/models/generateconversationnameop.py +31 -20
  71. orq_ai_sdk/models/get_v2_evaluators_id_versionsop.py +34 -1
  72. orq_ai_sdk/models/get_v2_tools_tool_id_versions_version_id_op.py +18 -1
  73. orq_ai_sdk/models/get_v2_tools_tool_id_versionsop.py +34 -1
  74. orq_ai_sdk/models/getallmemoriesop.py +34 -21
  75. orq_ai_sdk/models/getallmemorydocumentsop.py +42 -1
  76. orq_ai_sdk/models/getallmemorystoresop.py +34 -1
  77. orq_ai_sdk/models/getallpromptsop.py +1690 -230
  78. orq_ai_sdk/models/getalltoolsop.py +325 -8
  79. orq_ai_sdk/models/getchunkscountop.py +34 -1
  80. orq_ai_sdk/models/getevalsop.py +395 -43
  81. orq_ai_sdk/models/getonechunkop.py +14 -19
  82. orq_ai_sdk/models/getoneknowledgeop.py +116 -96
  83. orq_ai_sdk/models/getonepromptop.py +1673 -230
  84. orq_ai_sdk/models/getpromptversionop.py +1670 -216
  85. orq_ai_sdk/models/imagecontentpartschema.py +50 -1
  86. orq_ai_sdk/models/internal/globals.py +18 -1
  87. orq_ai_sdk/models/invokeagentop.py +140 -2
  88. orq_ai_sdk/models/invokedeploymentrequest.py +418 -80
  89. orq_ai_sdk/models/invokeevalop.py +160 -131
  90. orq_ai_sdk/models/listagentsop.py +793 -166
  91. orq_ai_sdk/models/listchunksop.py +32 -19
  92. orq_ai_sdk/models/listchunkspaginatedop.py +46 -19
  93. orq_ai_sdk/models/listconversationsop.py +18 -1
  94. orq_ai_sdk/models/listdatasetdatapointsop.py +252 -42
  95. orq_ai_sdk/models/listdatasetsop.py +35 -2
  96. orq_ai_sdk/models/listdatasourcesop.py +35 -26
  97. orq_ai_sdk/models/{listcontactsop.py → listidentitiesop.py} +89 -79
  98. orq_ai_sdk/models/listknowledgebasesop.py +132 -96
  99. orq_ai_sdk/models/listmodelsop.py +1 -0
  100. orq_ai_sdk/models/listpromptversionsop.py +1684 -216
  101. orq_ai_sdk/models/parseop.py +161 -17
  102. orq_ai_sdk/models/partdoneevent.py +19 -2
  103. orq_ai_sdk/models/post_v2_router_ocrop.py +408 -0
  104. orq_ai_sdk/models/publiccontact.py +27 -4
  105. orq_ai_sdk/models/publicidentity.py +62 -0
  106. orq_ai_sdk/models/reasoningpart.py +19 -2
  107. orq_ai_sdk/models/refusalpartschema.py +18 -1
  108. orq_ai_sdk/models/remoteconfigsgetconfigop.py +34 -1
  109. orq_ai_sdk/models/responsedoneevent.py +114 -84
  110. orq_ai_sdk/models/responsestartedevent.py +18 -1
  111. orq_ai_sdk/models/retrieveagentrequestop.py +787 -166
  112. orq_ai_sdk/models/retrievedatapointop.py +236 -42
  113. orq_ai_sdk/models/retrievedatasetop.py +19 -2
  114. orq_ai_sdk/models/retrievedatasourceop.py +17 -26
  115. orq_ai_sdk/models/{retrievecontactop.py → retrieveidentityop.py} +38 -41
  116. orq_ai_sdk/models/retrievememorydocumentop.py +18 -1
  117. orq_ai_sdk/models/retrievememoryop.py +18 -21
  118. orq_ai_sdk/models/retrievememorystoreop.py +18 -1
  119. orq_ai_sdk/models/retrievetoolop.py +309 -8
  120. orq_ai_sdk/models/runagentop.py +1451 -197
  121. orq_ai_sdk/models/searchknowledgeop.py +108 -1
  122. orq_ai_sdk/models/security.py +18 -1
  123. orq_ai_sdk/models/streamagentop.py +93 -2
  124. orq_ai_sdk/models/streamrunagentop.py +1428 -195
  125. orq_ai_sdk/models/textcontentpartschema.py +34 -1
  126. orq_ai_sdk/models/thinkingconfigenabledschema.py +18 -1
  127. orq_ai_sdk/models/toolcallpart.py +18 -1
  128. orq_ai_sdk/models/tooldoneevent.py +18 -1
  129. orq_ai_sdk/models/toolexecutionfailedstreamingevent.py +50 -1
  130. orq_ai_sdk/models/toolexecutionfinishedstreamingevent.py +34 -1
  131. orq_ai_sdk/models/toolexecutionstartedstreamingevent.py +34 -1
  132. orq_ai_sdk/models/toolresultpart.py +18 -1
  133. orq_ai_sdk/models/toolreviewrequestedevent.py +18 -1
  134. orq_ai_sdk/models/toolstartedevent.py +18 -1
  135. orq_ai_sdk/models/updateagentop.py +1951 -404
  136. orq_ai_sdk/models/updatechunkop.py +46 -19
  137. orq_ai_sdk/models/updateconversationop.py +61 -39
  138. orq_ai_sdk/models/updatedatapointop.py +424 -80
  139. orq_ai_sdk/models/updatedatasetop.py +51 -2
  140. orq_ai_sdk/models/updatedatasourceop.py +17 -26
  141. orq_ai_sdk/models/updateevalop.py +577 -16
  142. orq_ai_sdk/models/{updatecontactop.py → updateidentityop.py} +78 -68
  143. orq_ai_sdk/models/updateknowledgeop.py +234 -190
  144. orq_ai_sdk/models/updatememorydocumentop.py +50 -1
  145. orq_ai_sdk/models/updatememoryop.py +50 -21
  146. orq_ai_sdk/models/updatememorystoreop.py +66 -1
  147. orq_ai_sdk/models/updatepromptop.py +2844 -1450
  148. orq_ai_sdk/models/updatetoolop.py +592 -9
  149. orq_ai_sdk/models/usermessagerequest.py +18 -2
  150. orq_ai_sdk/moderations.py +218 -0
  151. orq_ai_sdk/orq_completions.py +660 -0
  152. orq_ai_sdk/orq_responses.py +398 -0
  153. orq_ai_sdk/prompts.py +28 -36
  154. orq_ai_sdk/rerank.py +232 -0
  155. orq_ai_sdk/router.py +89 -641
  156. orq_ai_sdk/sdk.py +3 -0
  157. orq_ai_sdk/speech.py +251 -0
  158. orq_ai_sdk/transcriptions.py +326 -0
  159. orq_ai_sdk/translations.py +298 -0
  160. orq_ai_sdk/utils/__init__.py +13 -1
  161. orq_ai_sdk/variations.py +254 -0
  162. orq_ai_sdk-4.2.6.dist-info/METADATA +888 -0
  163. orq_ai_sdk-4.2.6.dist-info/RECORD +263 -0
  164. {orq_ai_sdk-4.2.0rc28.dist-info → orq_ai_sdk-4.2.6.dist-info}/WHEEL +2 -1
  165. orq_ai_sdk-4.2.6.dist-info/top_level.txt +1 -0
  166. orq_ai_sdk-4.2.0rc28.dist-info/METADATA +0 -867
  167. orq_ai_sdk-4.2.0rc28.dist-info/RECORD +0 -233
@@ -0,0 +1,486 @@
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 BaseModel, Nullable, OptionalNullable, UNSET_SENTINEL
7
+ from orq_ai_sdk.utils import FieldMetadata, MultipartFormMetadata
8
+ import pydantic
9
+ from pydantic import model_serializer
10
+ from typing import Any, List, Literal, Optional
11
+ from typing_extensions import Annotated, NotRequired, TypedDict
12
+
13
+
14
+ CreateImageVariationResponseFormat = Literal[
15
+ "url",
16
+ "b64_json",
17
+ ]
18
+ r"""The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated."""
19
+
20
+
21
+ Size = Literal[
22
+ "256x256",
23
+ "512x512",
24
+ "1024x1024",
25
+ ]
26
+ r"""The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`."""
27
+
28
+
29
+ class CreateImageVariationRetryTypedDict(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 CreateImageVariationRetry(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
+ class CreateImageVariationFallbacksTypedDict(TypedDict):
65
+ model: str
66
+ r"""Fallback model identifier"""
67
+
68
+
69
+ class CreateImageVariationFallbacks(BaseModel):
70
+ model: str
71
+ r"""Fallback model identifier"""
72
+
73
+
74
+ CreateImageVariationVersion = Literal["latest",]
75
+ r"""Version of the prompt to use (currently only \"latest\" supported)"""
76
+
77
+
78
+ class CreateImageVariationPromptTypedDict(TypedDict):
79
+ r"""Prompt configuration for the request"""
80
+
81
+ id: str
82
+ r"""Unique identifier of the prompt to use"""
83
+ version: CreateImageVariationVersion
84
+ r"""Version of the prompt to use (currently only \"latest\" supported)"""
85
+
86
+
87
+ class CreateImageVariationPrompt(BaseModel):
88
+ r"""Prompt configuration for the request"""
89
+
90
+ id: str
91
+ r"""Unique identifier of the prompt to use"""
92
+
93
+ version: CreateImageVariationVersion
94
+ r"""Version of the prompt to use (currently only \"latest\" supported)"""
95
+
96
+
97
+ CreateImageVariationType = Literal["exact_match",]
98
+
99
+
100
+ class CreateImageVariationCacheTypedDict(TypedDict):
101
+ r"""Cache configuration for the request."""
102
+
103
+ type: CreateImageVariationType
104
+ ttl: NotRequired[float]
105
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
106
+
107
+
108
+ class CreateImageVariationCache(BaseModel):
109
+ r"""Cache configuration for the request."""
110
+
111
+ type: CreateImageVariationType
112
+
113
+ ttl: Optional[float] = 1800
114
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
115
+
116
+ @model_serializer(mode="wrap")
117
+ def serialize_model(self, handler):
118
+ optional_fields = set(["ttl"])
119
+ serialized = handler(self)
120
+ m = {}
121
+
122
+ for n, f in type(self).model_fields.items():
123
+ k = f.alias or n
124
+ val = serialized.get(k)
125
+
126
+ if val != UNSET_SENTINEL:
127
+ if val is not None or k not in optional_fields:
128
+ m[k] = val
129
+
130
+ return m
131
+
132
+
133
+ CreateImageVariationLoadBalancerType = Literal["weight_based",]
134
+
135
+
136
+ class CreateImageVariationLoadBalancerModelsTypedDict(TypedDict):
137
+ model: str
138
+ r"""Model identifier for load balancing"""
139
+ weight: NotRequired[float]
140
+ r"""Weight assigned to this model for load balancing"""
141
+
142
+
143
+ class CreateImageVariationLoadBalancerModels(BaseModel):
144
+ model: str
145
+ r"""Model identifier for load balancing"""
146
+
147
+ weight: Optional[float] = 0.5
148
+ r"""Weight assigned to this model for load balancing"""
149
+
150
+ @model_serializer(mode="wrap")
151
+ def serialize_model(self, handler):
152
+ optional_fields = set(["weight"])
153
+ serialized = handler(self)
154
+ m = {}
155
+
156
+ for n, f in type(self).model_fields.items():
157
+ k = f.alias or n
158
+ val = serialized.get(k)
159
+
160
+ if val != UNSET_SENTINEL:
161
+ if val is not None or k not in optional_fields:
162
+ m[k] = val
163
+
164
+ return m
165
+
166
+
167
+ class CreateImageVariationLoadBalancer1TypedDict(TypedDict):
168
+ type: CreateImageVariationLoadBalancerType
169
+ models: List[CreateImageVariationLoadBalancerModelsTypedDict]
170
+
171
+
172
+ class CreateImageVariationLoadBalancer1(BaseModel):
173
+ type: CreateImageVariationLoadBalancerType
174
+
175
+ models: List[CreateImageVariationLoadBalancerModels]
176
+
177
+
178
+ CreateImageVariationLoadBalancerTypedDict = CreateImageVariationLoadBalancer1TypedDict
179
+ r"""Array of models with weights for load balancing requests"""
180
+
181
+
182
+ CreateImageVariationLoadBalancer = CreateImageVariationLoadBalancer1
183
+ r"""Array of models with weights for load balancing requests"""
184
+
185
+
186
+ class CreateImageVariationTimeoutTypedDict(TypedDict):
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."""
188
+
189
+ call_timeout: float
190
+ r"""Timeout value in milliseconds"""
191
+
192
+
193
+ class CreateImageVariationTimeout(BaseModel):
194
+ 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."""
195
+
196
+ call_timeout: float
197
+ r"""Timeout value in milliseconds"""
198
+
199
+
200
+ class CreateImageVariationOrqTypedDict(TypedDict):
201
+ name: NotRequired[str]
202
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
203
+ retry: NotRequired[CreateImageVariationRetryTypedDict]
204
+ r"""Retry configuration for the request"""
205
+ fallbacks: NotRequired[List[CreateImageVariationFallbacksTypedDict]]
206
+ r"""Array of fallback models to use if primary model fails"""
207
+ prompt: NotRequired[CreateImageVariationPromptTypedDict]
208
+ r"""Prompt configuration for the request"""
209
+ identity: NotRequired[PublicIdentityTypedDict]
210
+ r"""Information about the identity making the request. If the identity does not exist, it will be created automatically."""
211
+ contact: NotRequired[PublicContactTypedDict]
212
+ r"""@deprecated Use identity instead. Information about the contact making the request."""
213
+ cache: NotRequired[CreateImageVariationCacheTypedDict]
214
+ r"""Cache configuration for the request."""
215
+ load_balancer: NotRequired[CreateImageVariationLoadBalancerTypedDict]
216
+ r"""Array of models with weights for load balancing requests"""
217
+ timeout: NotRequired[CreateImageVariationTimeoutTypedDict]
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."""
219
+
220
+
221
+ class CreateImageVariationOrq(BaseModel):
222
+ name: Optional[str] = None
223
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
224
+
225
+ retry: Optional[CreateImageVariationRetry] = None
226
+ r"""Retry configuration for the request"""
227
+
228
+ fallbacks: Optional[List[CreateImageVariationFallbacks]] = None
229
+ r"""Array of fallback models to use if primary model fails"""
230
+
231
+ prompt: Optional[CreateImageVariationPrompt] = None
232
+ r"""Prompt configuration for the request"""
233
+
234
+ identity: Optional[PublicIdentity] = None
235
+ r"""Information about the identity making the request. If the identity does not exist, it will be created automatically."""
236
+
237
+ contact: Annotated[
238
+ Optional[PublicContact],
239
+ pydantic.Field(
240
+ deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
241
+ ),
242
+ ] = None
243
+ r"""@deprecated Use identity instead. Information about the contact making the request."""
244
+
245
+ cache: Optional[CreateImageVariationCache] = None
246
+ r"""Cache configuration for the request."""
247
+
248
+ load_balancer: Optional[CreateImageVariationLoadBalancer] = None
249
+ r"""Array of models with weights for load balancing requests"""
250
+
251
+ timeout: Optional[CreateImageVariationTimeout] = None
252
+ 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."""
253
+
254
+ @model_serializer(mode="wrap")
255
+ def serialize_model(self, handler):
256
+ optional_fields = set(
257
+ [
258
+ "name",
259
+ "retry",
260
+ "fallbacks",
261
+ "prompt",
262
+ "identity",
263
+ "contact",
264
+ "cache",
265
+ "load_balancer",
266
+ "timeout",
267
+ ]
268
+ )
269
+ serialized = handler(self)
270
+ m = {}
271
+
272
+ for n, f in type(self).model_fields.items():
273
+ k = f.alias or n
274
+ val = serialized.get(k)
275
+
276
+ if val != UNSET_SENTINEL:
277
+ if val is not None or k not in optional_fields:
278
+ m[k] = val
279
+
280
+ return m
281
+
282
+
283
+ class CreateImageVariationRequestBodyTypedDict(TypedDict):
284
+ r"""input"""
285
+
286
+ model: str
287
+ r"""The model to use for image generation."""
288
+ image: NotRequired[Any]
289
+ r"""The image to edit. Must be a supported image file. It should be a png, webp, or jpg file less than 50MB."""
290
+ n: NotRequired[Nullable[int]]
291
+ r"""The number of images to generate. Must be between 1 and 10."""
292
+ response_format: NotRequired[CreateImageVariationResponseFormat]
293
+ r"""The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated."""
294
+ size: NotRequired[Size]
295
+ r"""The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`."""
296
+ user: NotRequired[str]
297
+ r"""A unique identifier representing your end-user, which can help to monitor and detect abuse."""
298
+ orq: NotRequired[CreateImageVariationOrqTypedDict]
299
+
300
+
301
+ class CreateImageVariationRequestBody(BaseModel):
302
+ r"""input"""
303
+
304
+ model: Annotated[str, FieldMetadata(multipart=True)]
305
+ r"""The model to use for image generation."""
306
+
307
+ image: Annotated[Optional[Any], FieldMetadata(multipart=True)] = None
308
+ r"""The image to edit. Must be a supported image file. It should be a png, webp, or jpg file less than 50MB."""
309
+
310
+ n: Annotated[OptionalNullable[int], FieldMetadata(multipart=True)] = 1
311
+ r"""The number of images to generate. Must be between 1 and 10."""
312
+
313
+ response_format: Annotated[
314
+ Optional[CreateImageVariationResponseFormat], FieldMetadata(multipart=True)
315
+ ] = "url"
316
+ r"""The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated."""
317
+
318
+ size: Annotated[Optional[Size], FieldMetadata(multipart=True)] = "1024x1024"
319
+ r"""The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`."""
320
+
321
+ user: Annotated[Optional[str], FieldMetadata(multipart=True)] = None
322
+ r"""A unique identifier representing your end-user, which can help to monitor and detect abuse."""
323
+
324
+ orq: Annotated[
325
+ Optional[CreateImageVariationOrq],
326
+ FieldMetadata(multipart=MultipartFormMetadata(json=True)),
327
+ ] = None
328
+
329
+ @model_serializer(mode="wrap")
330
+ def serialize_model(self, handler):
331
+ optional_fields = set(["image", "n", "response_format", "size", "user", "orq"])
332
+ nullable_fields = set(["n"])
333
+ serialized = handler(self)
334
+ m = {}
335
+
336
+ for n, f in type(self).model_fields.items():
337
+ k = f.alias or n
338
+ val = serialized.get(k)
339
+ is_nullable_and_explicitly_set = (
340
+ k in nullable_fields
341
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
342
+ )
343
+
344
+ if val != UNSET_SENTINEL:
345
+ if (
346
+ val is not None
347
+ or k not in optional_fields
348
+ or is_nullable_and_explicitly_set
349
+ ):
350
+ m[k] = val
351
+
352
+ return m
353
+
354
+
355
+ class CreateImageVariationDataTypedDict(TypedDict):
356
+ b64_json: NotRequired[str]
357
+ r"""The base64-encoded JSON of the generated image, if response_format is b64_json"""
358
+ url: NotRequired[str]
359
+ r"""The URL of the generated image, if response_format is url (default)"""
360
+
361
+
362
+ class CreateImageVariationData(BaseModel):
363
+ b64_json: Optional[str] = None
364
+ r"""The base64-encoded JSON of the generated image, if response_format is b64_json"""
365
+
366
+ url: Optional[str] = None
367
+ r"""The URL of the generated image, if response_format is url (default)"""
368
+
369
+ @model_serializer(mode="wrap")
370
+ def serialize_model(self, handler):
371
+ optional_fields = set(["b64_json", "url"])
372
+ serialized = handler(self)
373
+ m = {}
374
+
375
+ for n, f in type(self).model_fields.items():
376
+ k = f.alias or n
377
+ val = serialized.get(k)
378
+
379
+ if val != UNSET_SENTINEL:
380
+ if val is not None or k not in optional_fields:
381
+ m[k] = val
382
+
383
+ return m
384
+
385
+
386
+ class CreateImageVariationInputTokensDetailsTypedDict(TypedDict):
387
+ r"""The input tokens detailed information for the image generation."""
388
+
389
+ text_tokens: float
390
+ r"""The number of text tokens in the input prompt."""
391
+ image_tokens: float
392
+ r"""The number of image tokens in the input prompt."""
393
+
394
+
395
+ class CreateImageVariationInputTokensDetails(BaseModel):
396
+ r"""The input tokens detailed information for the image generation."""
397
+
398
+ text_tokens: float
399
+ r"""The number of text tokens in the input prompt."""
400
+
401
+ image_tokens: float
402
+ r"""The number of image tokens in the input prompt."""
403
+
404
+
405
+ class CreateImageVariationUsageTypedDict(TypedDict):
406
+ r"""The token usage information for the image generation."""
407
+
408
+ total_tokens: float
409
+ r"""The total number of tokens (images and text) used for the image generation."""
410
+ input_tokens: float
411
+ r"""The number of tokens (images and text) in the input prompt."""
412
+ output_tokens: float
413
+ r"""The number of output tokens generated by the model."""
414
+ input_tokens_details: CreateImageVariationInputTokensDetailsTypedDict
415
+ r"""The input tokens detailed information for the image generation."""
416
+
417
+
418
+ class CreateImageVariationUsage(BaseModel):
419
+ r"""The token usage information for the image generation."""
420
+
421
+ total_tokens: float
422
+ r"""The total number of tokens (images and text) used for the image generation."""
423
+
424
+ input_tokens: float
425
+ r"""The number of tokens (images and text) in the input prompt."""
426
+
427
+ output_tokens: float
428
+ r"""The number of output tokens generated by the model."""
429
+
430
+ input_tokens_details: CreateImageVariationInputTokensDetails
431
+ r"""The input tokens detailed information for the image generation."""
432
+
433
+
434
+ class CreateImageVariationResponseBodyTypedDict(TypedDict):
435
+ r"""Represents an image variation response from the API."""
436
+
437
+ created: float
438
+ r"""The Unix timestamp (in seconds) of when the image was created."""
439
+ data: List[CreateImageVariationDataTypedDict]
440
+ r"""The list of generated images."""
441
+ output_format: NotRequired[str]
442
+ r"""The output format of the image generation"""
443
+ size: NotRequired[str]
444
+ r"""The size of the image generated"""
445
+ quality: NotRequired[str]
446
+ r"""The quality of the image generated"""
447
+ usage: NotRequired[CreateImageVariationUsageTypedDict]
448
+ r"""The token usage information for the image generation."""
449
+
450
+
451
+ class CreateImageVariationResponseBody(BaseModel):
452
+ r"""Represents an image variation response from the API."""
453
+
454
+ created: float
455
+ r"""The Unix timestamp (in seconds) of when the image was created."""
456
+
457
+ data: List[CreateImageVariationData]
458
+ r"""The list of generated images."""
459
+
460
+ output_format: Optional[str] = None
461
+ r"""The output format of the image generation"""
462
+
463
+ size: Optional[str] = None
464
+ r"""The size of the image generated"""
465
+
466
+ quality: Optional[str] = None
467
+ r"""The quality of the image generated"""
468
+
469
+ usage: Optional[CreateImageVariationUsage] = None
470
+ r"""The token usage information for the image generation."""
471
+
472
+ @model_serializer(mode="wrap")
473
+ def serialize_model(self, handler):
474
+ optional_fields = set(["output_format", "size", "quality", "usage"])
475
+ serialized = handler(self)
476
+ m = {}
477
+
478
+ for n, f in type(self).model_fields.items():
479
+ k = f.alias or n
480
+ val = serialized.get(k)
481
+
482
+ if val != UNSET_SENTINEL:
483
+ if val is not None or k not in optional_fields:
484
+ m[k] = val
485
+
486
+ return m