orq-ai-sdk 4.2.0rc28__py3-none-any.whl → 4.3.0rc7__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 (166) hide show
  1. orq_ai_sdk/_version.py +3 -3
  2. orq_ai_sdk/agents.py +186 -186
  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 +438 -0
  7. orq_ai_sdk/contacts.py +43 -855
  8. orq_ai_sdk/deployments.py +61 -0
  9. orq_ai_sdk/edits.py +364 -0
  10. orq_ai_sdk/embeddings.py +344 -0
  11. orq_ai_sdk/generations.py +370 -0
  12. orq_ai_sdk/identities.py +1037 -0
  13. orq_ai_sdk/images.py +28 -0
  14. orq_ai_sdk/models/__init__.py +5746 -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 +1945 -383
  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 +1381 -861
  29. orq_ai_sdk/models/createchunkop.py +46 -19
  30. orq_ai_sdk/models/createcompletionop.py +2078 -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 +579 -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 +715 -0
  41. orq_ai_sdk/models/createimageop.py +407 -128
  42. orq_ai_sdk/models/createimagevariationop.py +706 -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 +2759 -1251
  49. orq_ai_sdk/models/creatererankop.py +608 -0
  50. orq_ai_sdk/models/createresponseop.py +2567 -0
  51. orq_ai_sdk/models/createspeechop.py +466 -0
  52. orq_ai_sdk/models/createtoolop.py +537 -12
  53. orq_ai_sdk/models/createtranscriptionop.py +732 -0
  54. orq_ai_sdk/models/createtranslationop.py +702 -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 +1696 -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 +1679 -230
  84. orq_ai_sdk/models/getpromptversionop.py +1676 -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 +805 -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 +1690 -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 +799 -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 +1462 -196
  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 +1439 -194
  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 +1968 -397
  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 +2854 -1448
  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 +666 -0
  152. orq_ai_sdk/orq_responses.py +398 -0
  153. orq_ai_sdk/prompts.py +28 -36
  154. orq_ai_sdk/rerank.py +330 -0
  155. orq_ai_sdk/router.py +89 -641
  156. orq_ai_sdk/sdk.py +3 -0
  157. orq_ai_sdk/speech.py +333 -0
  158. orq_ai_sdk/transcriptions.py +416 -0
  159. orq_ai_sdk/translations.py +384 -0
  160. orq_ai_sdk/utils/__init__.py +13 -1
  161. orq_ai_sdk/variations.py +364 -0
  162. {orq_ai_sdk-4.2.0rc28.dist-info → orq_ai_sdk-4.3.0rc7.dist-info}/METADATA +169 -148
  163. orq_ai_sdk-4.3.0rc7.dist-info/RECORD +263 -0
  164. {orq_ai_sdk-4.2.0rc28.dist-info → orq_ai_sdk-4.3.0rc7.dist-info}/WHEEL +2 -1
  165. orq_ai_sdk-4.3.0rc7.dist-info/top_level.txt +1 -0
  166. orq_ai_sdk-4.2.0rc28.dist-info/RECORD +0 -233
@@ -0,0 +1,706 @@
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 CreateImageVariationFallbacksTypedDict(TypedDict):
30
+ model: str
31
+ r"""Fallback model identifier"""
32
+
33
+
34
+ class CreateImageVariationFallbacks(BaseModel):
35
+ model: str
36
+ r"""Fallback model identifier"""
37
+
38
+
39
+ class CreateImageVariationRetryTypedDict(TypedDict):
40
+ r"""Retry configuration for the request"""
41
+
42
+ count: NotRequired[float]
43
+ r"""Number of retry attempts (1-5)"""
44
+ on_codes: NotRequired[List[float]]
45
+ r"""HTTP status codes that trigger retry logic"""
46
+
47
+
48
+ class CreateImageVariationRetry(BaseModel):
49
+ r"""Retry configuration for the request"""
50
+
51
+ count: Optional[float] = 3
52
+ r"""Number of retry attempts (1-5)"""
53
+
54
+ on_codes: Optional[List[float]] = None
55
+ r"""HTTP status codes that trigger retry logic"""
56
+
57
+ @model_serializer(mode="wrap")
58
+ def serialize_model(self, handler):
59
+ optional_fields = set(["count", "on_codes"])
60
+ serialized = handler(self)
61
+ m = {}
62
+
63
+ for n, f in type(self).model_fields.items():
64
+ k = f.alias or n
65
+ val = serialized.get(k)
66
+
67
+ if val != UNSET_SENTINEL:
68
+ if val is not None or k not in optional_fields:
69
+ m[k] = val
70
+
71
+ return m
72
+
73
+
74
+ CreateImageVariationType = Literal["exact_match",]
75
+
76
+
77
+ class CreateImageVariationCacheTypedDict(TypedDict):
78
+ r"""Cache configuration for the request."""
79
+
80
+ type: CreateImageVariationType
81
+ ttl: NotRequired[float]
82
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
83
+
84
+
85
+ class CreateImageVariationCache(BaseModel):
86
+ r"""Cache configuration for the request."""
87
+
88
+ type: CreateImageVariationType
89
+
90
+ ttl: Optional[float] = 1800
91
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
92
+
93
+ @model_serializer(mode="wrap")
94
+ def serialize_model(self, handler):
95
+ optional_fields = set(["ttl"])
96
+ serialized = handler(self)
97
+ m = {}
98
+
99
+ for n, f in type(self).model_fields.items():
100
+ k = f.alias or n
101
+ val = serialized.get(k)
102
+
103
+ if val != UNSET_SENTINEL:
104
+ if val is not None or k not in optional_fields:
105
+ m[k] = val
106
+
107
+ return m
108
+
109
+
110
+ CreateImageVariationLoadBalancerType = Literal["weight_based",]
111
+
112
+
113
+ class CreateImageVariationLoadBalancerModelsTypedDict(TypedDict):
114
+ model: str
115
+ r"""Model identifier for load balancing"""
116
+ weight: NotRequired[float]
117
+ r"""Weight assigned to this model for load balancing"""
118
+
119
+
120
+ class CreateImageVariationLoadBalancerModels(BaseModel):
121
+ model: str
122
+ r"""Model identifier for load balancing"""
123
+
124
+ weight: Optional[float] = 0.5
125
+ r"""Weight assigned to this model for load balancing"""
126
+
127
+ @model_serializer(mode="wrap")
128
+ def serialize_model(self, handler):
129
+ optional_fields = set(["weight"])
130
+ serialized = handler(self)
131
+ m = {}
132
+
133
+ for n, f in type(self).model_fields.items():
134
+ k = f.alias or n
135
+ val = serialized.get(k)
136
+
137
+ if val != UNSET_SENTINEL:
138
+ if val is not None or k not in optional_fields:
139
+ m[k] = val
140
+
141
+ return m
142
+
143
+
144
+ class CreateImageVariationLoadBalancer1TypedDict(TypedDict):
145
+ type: CreateImageVariationLoadBalancerType
146
+ models: List[CreateImageVariationLoadBalancerModelsTypedDict]
147
+
148
+
149
+ class CreateImageVariationLoadBalancer1(BaseModel):
150
+ type: CreateImageVariationLoadBalancerType
151
+
152
+ models: List[CreateImageVariationLoadBalancerModels]
153
+
154
+
155
+ CreateImageVariationLoadBalancerTypedDict = CreateImageVariationLoadBalancer1TypedDict
156
+ r"""Load balancer configuration for the request."""
157
+
158
+
159
+ CreateImageVariationLoadBalancer = CreateImageVariationLoadBalancer1
160
+ r"""Load balancer configuration for the request."""
161
+
162
+
163
+ class CreateImageVariationTimeoutTypedDict(TypedDict):
164
+ 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."""
165
+
166
+ call_timeout: float
167
+ r"""Timeout value in milliseconds"""
168
+
169
+
170
+ class CreateImageVariationTimeout(BaseModel):
171
+ 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."""
172
+
173
+ call_timeout: float
174
+ r"""Timeout value in milliseconds"""
175
+
176
+
177
+ class CreateImageVariationRouterImagesVariationsRetryTypedDict(TypedDict):
178
+ r"""Retry configuration for the request"""
179
+
180
+ count: NotRequired[float]
181
+ r"""Number of retry attempts (1-5)"""
182
+ on_codes: NotRequired[List[float]]
183
+ r"""HTTP status codes that trigger retry logic"""
184
+
185
+
186
+ class CreateImageVariationRouterImagesVariationsRetry(BaseModel):
187
+ r"""Retry configuration for the request"""
188
+
189
+ count: Optional[float] = 3
190
+ r"""Number of retry attempts (1-5)"""
191
+
192
+ on_codes: Optional[List[float]] = None
193
+ r"""HTTP status codes that trigger retry logic"""
194
+
195
+ @model_serializer(mode="wrap")
196
+ def serialize_model(self, handler):
197
+ optional_fields = set(["count", "on_codes"])
198
+ serialized = handler(self)
199
+ m = {}
200
+
201
+ for n, f in type(self).model_fields.items():
202
+ k = f.alias or n
203
+ val = serialized.get(k)
204
+
205
+ if val != UNSET_SENTINEL:
206
+ if val is not None or k not in optional_fields:
207
+ m[k] = val
208
+
209
+ return m
210
+
211
+
212
+ class CreateImageVariationRouterImagesVariationsFallbacksTypedDict(TypedDict):
213
+ model: str
214
+ r"""Fallback model identifier"""
215
+
216
+
217
+ class CreateImageVariationRouterImagesVariationsFallbacks(BaseModel):
218
+ model: str
219
+ r"""Fallback model identifier"""
220
+
221
+
222
+ CreateImageVariationVersion = Literal["latest",]
223
+ r"""Version of the prompt to use (currently only \"latest\" supported)"""
224
+
225
+
226
+ class CreateImageVariationPromptTypedDict(TypedDict):
227
+ r"""Prompt configuration for the request"""
228
+
229
+ id: str
230
+ r"""Unique identifier of the prompt to use"""
231
+ version: CreateImageVariationVersion
232
+ r"""Version of the prompt to use (currently only \"latest\" supported)"""
233
+
234
+
235
+ class CreateImageVariationPrompt(BaseModel):
236
+ r"""Prompt configuration for the request"""
237
+
238
+ id: str
239
+ r"""Unique identifier of the prompt to use"""
240
+
241
+ version: CreateImageVariationVersion
242
+ r"""Version of the prompt to use (currently only \"latest\" supported)"""
243
+
244
+
245
+ CreateImageVariationRouterImagesVariationsType = Literal["exact_match",]
246
+
247
+
248
+ class CreateImageVariationRouterImagesVariationsCacheTypedDict(TypedDict):
249
+ r"""Cache configuration for the request."""
250
+
251
+ type: CreateImageVariationRouterImagesVariationsType
252
+ ttl: NotRequired[float]
253
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
254
+
255
+
256
+ class CreateImageVariationRouterImagesVariationsCache(BaseModel):
257
+ r"""Cache configuration for the request."""
258
+
259
+ type: CreateImageVariationRouterImagesVariationsType
260
+
261
+ ttl: Optional[float] = 1800
262
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
263
+
264
+ @model_serializer(mode="wrap")
265
+ def serialize_model(self, handler):
266
+ optional_fields = set(["ttl"])
267
+ serialized = handler(self)
268
+ m = {}
269
+
270
+ for n, f in type(self).model_fields.items():
271
+ k = f.alias or n
272
+ val = serialized.get(k)
273
+
274
+ if val != UNSET_SENTINEL:
275
+ if val is not None or k not in optional_fields:
276
+ m[k] = val
277
+
278
+ return m
279
+
280
+
281
+ CreateImageVariationLoadBalancerRouterImagesVariationsType = Literal["weight_based",]
282
+
283
+
284
+ class CreateImageVariationLoadBalancerRouterImagesVariationsModelsTypedDict(TypedDict):
285
+ model: str
286
+ r"""Model identifier for load balancing"""
287
+ weight: NotRequired[float]
288
+ r"""Weight assigned to this model for load balancing"""
289
+
290
+
291
+ class CreateImageVariationLoadBalancerRouterImagesVariationsModels(BaseModel):
292
+ model: str
293
+ r"""Model identifier for load balancing"""
294
+
295
+ weight: Optional[float] = 0.5
296
+ r"""Weight assigned to this model for load balancing"""
297
+
298
+ @model_serializer(mode="wrap")
299
+ def serialize_model(self, handler):
300
+ optional_fields = set(["weight"])
301
+ serialized = handler(self)
302
+ m = {}
303
+
304
+ for n, f in type(self).model_fields.items():
305
+ k = f.alias or n
306
+ val = serialized.get(k)
307
+
308
+ if val != UNSET_SENTINEL:
309
+ if val is not None or k not in optional_fields:
310
+ m[k] = val
311
+
312
+ return m
313
+
314
+
315
+ class CreateImageVariationLoadBalancerRouterImagesVariations1TypedDict(TypedDict):
316
+ type: CreateImageVariationLoadBalancerRouterImagesVariationsType
317
+ models: List[CreateImageVariationLoadBalancerRouterImagesVariationsModelsTypedDict]
318
+
319
+
320
+ class CreateImageVariationLoadBalancerRouterImagesVariations1(BaseModel):
321
+ type: CreateImageVariationLoadBalancerRouterImagesVariationsType
322
+
323
+ models: List[CreateImageVariationLoadBalancerRouterImagesVariationsModels]
324
+
325
+
326
+ CreateImageVariationRouterImagesVariationsLoadBalancerTypedDict = (
327
+ CreateImageVariationLoadBalancerRouterImagesVariations1TypedDict
328
+ )
329
+ r"""Array of models with weights for load balancing requests"""
330
+
331
+
332
+ CreateImageVariationRouterImagesVariationsLoadBalancer = (
333
+ CreateImageVariationLoadBalancerRouterImagesVariations1
334
+ )
335
+ r"""Array of models with weights for load balancing requests"""
336
+
337
+
338
+ class CreateImageVariationRouterImagesVariationsTimeoutTypedDict(TypedDict):
339
+ 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."""
340
+
341
+ call_timeout: float
342
+ r"""Timeout value in milliseconds"""
343
+
344
+
345
+ class CreateImageVariationRouterImagesVariationsTimeout(BaseModel):
346
+ 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."""
347
+
348
+ call_timeout: float
349
+ r"""Timeout value in milliseconds"""
350
+
351
+
352
+ class CreateImageVariationOrqTypedDict(TypedDict):
353
+ name: NotRequired[str]
354
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
355
+ retry: NotRequired[CreateImageVariationRouterImagesVariationsRetryTypedDict]
356
+ r"""Retry configuration for the request"""
357
+ fallbacks: NotRequired[
358
+ List[CreateImageVariationRouterImagesVariationsFallbacksTypedDict]
359
+ ]
360
+ r"""Array of fallback models to use if primary model fails"""
361
+ prompt: NotRequired[CreateImageVariationPromptTypedDict]
362
+ r"""Prompt configuration for the request"""
363
+ identity: NotRequired[PublicIdentityTypedDict]
364
+ r"""Information about the identity making the request. If the identity does not exist, it will be created automatically."""
365
+ contact: NotRequired[PublicContactTypedDict]
366
+ r"""@deprecated Use identity instead. Information about the contact making the request."""
367
+ cache: NotRequired[CreateImageVariationRouterImagesVariationsCacheTypedDict]
368
+ r"""Cache configuration for the request."""
369
+ load_balancer: NotRequired[
370
+ CreateImageVariationRouterImagesVariationsLoadBalancerTypedDict
371
+ ]
372
+ r"""Array of models with weights for load balancing requests"""
373
+ timeout: NotRequired[CreateImageVariationRouterImagesVariationsTimeoutTypedDict]
374
+ 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."""
375
+
376
+
377
+ class CreateImageVariationOrq(BaseModel):
378
+ name: Optional[str] = None
379
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
380
+
381
+ retry: Optional[CreateImageVariationRouterImagesVariationsRetry] = None
382
+ r"""Retry configuration for the request"""
383
+
384
+ fallbacks: Optional[List[CreateImageVariationRouterImagesVariationsFallbacks]] = (
385
+ None
386
+ )
387
+ r"""Array of fallback models to use if primary model fails"""
388
+
389
+ prompt: Optional[CreateImageVariationPrompt] = None
390
+ r"""Prompt configuration for the request"""
391
+
392
+ identity: Optional[PublicIdentity] = None
393
+ r"""Information about the identity making the request. If the identity does not exist, it will be created automatically."""
394
+
395
+ contact: Annotated[
396
+ Optional[PublicContact],
397
+ pydantic.Field(
398
+ deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
399
+ ),
400
+ ] = None
401
+ r"""@deprecated Use identity instead. Information about the contact making the request."""
402
+
403
+ cache: Optional[CreateImageVariationRouterImagesVariationsCache] = None
404
+ r"""Cache configuration for the request."""
405
+
406
+ load_balancer: Optional[CreateImageVariationRouterImagesVariationsLoadBalancer] = (
407
+ None
408
+ )
409
+ r"""Array of models with weights for load balancing requests"""
410
+
411
+ timeout: Optional[CreateImageVariationRouterImagesVariationsTimeout] = 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 CreateImageVariationRequestBodyTypedDict(TypedDict):
444
+ r"""input"""
445
+
446
+ model: str
447
+ r"""The model to use for image generation."""
448
+ image: NotRequired[Any]
449
+ r"""The image to edit. Must be a supported image file. It should be a png, webp, or jpg file less than 50MB."""
450
+ n: NotRequired[Nullable[int]]
451
+ r"""The number of images to generate. Must be between 1 and 10."""
452
+ response_format: NotRequired[CreateImageVariationResponseFormat]
453
+ 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."""
454
+ size: NotRequired[Size]
455
+ r"""The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`."""
456
+ user: NotRequired[str]
457
+ r"""A unique identifier representing your end-user, which can help to monitor and detect abuse."""
458
+ name: NotRequired[str]
459
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
460
+ fallbacks: NotRequired[List[CreateImageVariationFallbacksTypedDict]]
461
+ r"""Array of fallback models to use if primary model fails"""
462
+ retry: NotRequired[CreateImageVariationRetryTypedDict]
463
+ r"""Retry configuration for the request"""
464
+ cache: NotRequired[CreateImageVariationCacheTypedDict]
465
+ r"""Cache configuration for the request."""
466
+ load_balancer: NotRequired[CreateImageVariationLoadBalancerTypedDict]
467
+ r"""Load balancer configuration for the request."""
468
+ timeout: NotRequired[CreateImageVariationTimeoutTypedDict]
469
+ 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."""
470
+ orq: NotRequired[CreateImageVariationOrqTypedDict]
471
+
472
+
473
+ class CreateImageVariationRequestBody(BaseModel):
474
+ r"""input"""
475
+
476
+ model: Annotated[str, FieldMetadata(multipart=True)]
477
+ r"""The model to use for image generation."""
478
+
479
+ image: Annotated[Optional[Any], FieldMetadata(multipart=True)] = None
480
+ r"""The image to edit. Must be a supported image file. It should be a png, webp, or jpg file less than 50MB."""
481
+
482
+ n: Annotated[OptionalNullable[int], FieldMetadata(multipart=True)] = 1
483
+ r"""The number of images to generate. Must be between 1 and 10."""
484
+
485
+ response_format: Annotated[
486
+ Optional[CreateImageVariationResponseFormat], FieldMetadata(multipart=True)
487
+ ] = "url"
488
+ 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."""
489
+
490
+ size: Annotated[Optional[Size], FieldMetadata(multipart=True)] = "1024x1024"
491
+ r"""The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`."""
492
+
493
+ user: Annotated[Optional[str], FieldMetadata(multipart=True)] = None
494
+ r"""A unique identifier representing your end-user, which can help to monitor and detect abuse."""
495
+
496
+ name: Annotated[Optional[str], FieldMetadata(multipart=True)] = None
497
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
498
+
499
+ fallbacks: Annotated[
500
+ Optional[List[CreateImageVariationFallbacks]],
501
+ FieldMetadata(multipart=MultipartFormMetadata(json=True)),
502
+ ] = None
503
+ r"""Array of fallback models to use if primary model fails"""
504
+
505
+ retry: Annotated[
506
+ Optional[CreateImageVariationRetry],
507
+ FieldMetadata(multipart=MultipartFormMetadata(json=True)),
508
+ ] = None
509
+ r"""Retry configuration for the request"""
510
+
511
+ cache: Annotated[
512
+ Optional[CreateImageVariationCache],
513
+ FieldMetadata(multipart=MultipartFormMetadata(json=True)),
514
+ ] = None
515
+ r"""Cache configuration for the request."""
516
+
517
+ load_balancer: Annotated[
518
+ Optional[CreateImageVariationLoadBalancer],
519
+ FieldMetadata(multipart=MultipartFormMetadata(json=True)),
520
+ ] = None
521
+ r"""Load balancer configuration for the request."""
522
+
523
+ timeout: Annotated[
524
+ Optional[CreateImageVariationTimeout],
525
+ FieldMetadata(multipart=MultipartFormMetadata(json=True)),
526
+ ] = None
527
+ 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."""
528
+
529
+ orq: Annotated[
530
+ Optional[CreateImageVariationOrq],
531
+ FieldMetadata(multipart=MultipartFormMetadata(json=True)),
532
+ ] = None
533
+
534
+ @model_serializer(mode="wrap")
535
+ def serialize_model(self, handler):
536
+ optional_fields = set(
537
+ [
538
+ "image",
539
+ "n",
540
+ "response_format",
541
+ "size",
542
+ "user",
543
+ "name",
544
+ "fallbacks",
545
+ "retry",
546
+ "cache",
547
+ "load_balancer",
548
+ "timeout",
549
+ "orq",
550
+ ]
551
+ )
552
+ nullable_fields = set(["n"])
553
+ serialized = handler(self)
554
+ m = {}
555
+
556
+ for n, f in type(self).model_fields.items():
557
+ k = f.alias or n
558
+ val = serialized.get(k)
559
+ is_nullable_and_explicitly_set = (
560
+ k in nullable_fields
561
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
562
+ )
563
+
564
+ if val != UNSET_SENTINEL:
565
+ if (
566
+ val is not None
567
+ or k not in optional_fields
568
+ or is_nullable_and_explicitly_set
569
+ ):
570
+ m[k] = val
571
+
572
+ return m
573
+
574
+
575
+ class CreateImageVariationDataTypedDict(TypedDict):
576
+ b64_json: NotRequired[str]
577
+ r"""The base64-encoded JSON of the generated image, if response_format is b64_json"""
578
+ url: NotRequired[str]
579
+ r"""The URL of the generated image, if response_format is url (default)"""
580
+
581
+
582
+ class CreateImageVariationData(BaseModel):
583
+ b64_json: Optional[str] = None
584
+ r"""The base64-encoded JSON of the generated image, if response_format is b64_json"""
585
+
586
+ url: Optional[str] = None
587
+ r"""The URL of the generated image, if response_format is url (default)"""
588
+
589
+ @model_serializer(mode="wrap")
590
+ def serialize_model(self, handler):
591
+ optional_fields = set(["b64_json", "url"])
592
+ serialized = handler(self)
593
+ m = {}
594
+
595
+ for n, f in type(self).model_fields.items():
596
+ k = f.alias or n
597
+ val = serialized.get(k)
598
+
599
+ if val != UNSET_SENTINEL:
600
+ if val is not None or k not in optional_fields:
601
+ m[k] = val
602
+
603
+ return m
604
+
605
+
606
+ class CreateImageVariationInputTokensDetailsTypedDict(TypedDict):
607
+ r"""The input tokens detailed information for the image generation."""
608
+
609
+ text_tokens: float
610
+ r"""The number of text tokens in the input prompt."""
611
+ image_tokens: float
612
+ r"""The number of image tokens in the input prompt."""
613
+
614
+
615
+ class CreateImageVariationInputTokensDetails(BaseModel):
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
+
621
+ image_tokens: float
622
+ r"""The number of image tokens in the input prompt."""
623
+
624
+
625
+ class CreateImageVariationUsageTypedDict(TypedDict):
626
+ r"""The token usage information for the image generation."""
627
+
628
+ total_tokens: float
629
+ r"""The total number of tokens (images and text) used for the image generation."""
630
+ input_tokens: float
631
+ r"""The number of tokens (images and text) in the input prompt."""
632
+ output_tokens: float
633
+ r"""The number of output tokens generated by the model."""
634
+ input_tokens_details: CreateImageVariationInputTokensDetailsTypedDict
635
+ r"""The input tokens detailed information for the image generation."""
636
+
637
+
638
+ class CreateImageVariationUsage(BaseModel):
639
+ r"""The token usage information for the image generation."""
640
+
641
+ total_tokens: float
642
+ r"""The total number of tokens (images and text) used for the image generation."""
643
+
644
+ input_tokens: float
645
+ r"""The number of tokens (images and text) in the input prompt."""
646
+
647
+ output_tokens: float
648
+ r"""The number of output tokens generated by the model."""
649
+
650
+ input_tokens_details: CreateImageVariationInputTokensDetails
651
+ r"""The input tokens detailed information for the image generation."""
652
+
653
+
654
+ class CreateImageVariationResponseBodyTypedDict(TypedDict):
655
+ r"""Represents an image variation response from the API."""
656
+
657
+ created: float
658
+ r"""The Unix timestamp (in seconds) of when the image was created."""
659
+ data: List[CreateImageVariationDataTypedDict]
660
+ r"""The list of generated images."""
661
+ output_format: NotRequired[str]
662
+ r"""The output format of the image generation"""
663
+ size: NotRequired[str]
664
+ r"""The size of the image generated"""
665
+ quality: NotRequired[str]
666
+ r"""The quality of the image generated"""
667
+ usage: NotRequired[CreateImageVariationUsageTypedDict]
668
+ r"""The token usage information for the image generation."""
669
+
670
+
671
+ class CreateImageVariationResponseBody(BaseModel):
672
+ r"""Represents an image variation response from the API."""
673
+
674
+ created: float
675
+ r"""The Unix timestamp (in seconds) of when the image was created."""
676
+
677
+ data: List[CreateImageVariationData]
678
+ r"""The list of generated images."""
679
+
680
+ output_format: Optional[str] = None
681
+ r"""The output format of the image generation"""
682
+
683
+ size: Optional[str] = None
684
+ r"""The size of the image generated"""
685
+
686
+ quality: Optional[str] = None
687
+ r"""The quality of the image generated"""
688
+
689
+ usage: Optional[CreateImageVariationUsage] = None
690
+ r"""The token usage information for the image generation."""
691
+
692
+ @model_serializer(mode="wrap")
693
+ def serialize_model(self, handler):
694
+ optional_fields = set(["output_format", "size", "quality", "usage"])
695
+ serialized = handler(self)
696
+ m = {}
697
+
698
+ for n, f in type(self).model_fields.items():
699
+ k = f.alias or n
700
+ val = serialized.get(k)
701
+
702
+ if val != UNSET_SENTINEL:
703
+ if val is not None or k not in optional_fields:
704
+ m[k] = val
705
+
706
+ return m