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
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
  from .publiccontact import PublicContact, PublicContactTypedDict
5
+ from .publicidentity import PublicIdentity, PublicIdentityTypedDict
5
6
  from orq_ai_sdk.types import (
6
7
  BaseModel,
7
8
  Nullable,
@@ -9,9 +10,10 @@ from orq_ai_sdk.types import (
9
10
  UNSET,
10
11
  UNSET_SENTINEL,
11
12
  )
13
+ import pydantic
12
14
  from pydantic import model_serializer
13
- from typing import Any, Dict, List, Literal, Optional
14
- from typing_extensions import NotRequired, TypedDict, deprecated
15
+ from typing import List, Literal, Optional
16
+ from typing_extensions import Annotated, NotRequired, TypedDict
15
17
 
16
18
 
17
19
  Background = Literal[
@@ -62,6 +64,16 @@ Style = Literal[
62
64
  r"""The style of the generated images. This parameter is only supported for `openai/dall-e-3`. Must be one of `vivid` or `natural`."""
63
65
 
64
66
 
67
+ class CreateImageFallbacksTypedDict(TypedDict):
68
+ model: str
69
+ r"""Fallback model identifier"""
70
+
71
+
72
+ class CreateImageFallbacks(BaseModel):
73
+ model: str
74
+ r"""Fallback model identifier"""
75
+
76
+
65
77
  class CreateImageRetryTypedDict(TypedDict):
66
78
  r"""Retry configuration for the request"""
67
79
 
@@ -80,60 +92,21 @@ class CreateImageRetry(BaseModel):
80
92
  on_codes: Optional[List[float]] = None
81
93
  r"""HTTP status codes that trigger retry logic"""
82
94
 
95
+ @model_serializer(mode="wrap")
96
+ def serialize_model(self, handler):
97
+ optional_fields = set(["count", "on_codes"])
98
+ serialized = handler(self)
99
+ m = {}
83
100
 
84
- class CreateImageFallbacksTypedDict(TypedDict):
85
- model: str
86
- r"""Fallback model identifier"""
87
-
88
-
89
- class CreateImageFallbacks(BaseModel):
90
- model: str
91
- r"""Fallback model identifier"""
92
-
93
-
94
- @deprecated(
95
- "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
96
- )
97
- class CreateImageContactTypedDict(TypedDict):
98
- r"""@deprecated Use identity instead. Information about the contact making the request."""
99
-
100
- id: str
101
- r"""Unique identifier for the contact"""
102
- display_name: NotRequired[str]
103
- r"""Display name of the contact"""
104
- email: NotRequired[str]
105
- r"""Email address of the contact"""
106
- metadata: NotRequired[List[Dict[str, Any]]]
107
- r"""A hash of key/value pairs containing any other data about the contact"""
108
- logo_url: NotRequired[str]
109
- r"""URL to the contact's avatar or logo"""
110
- tags: NotRequired[List[str]]
111
- r"""A list of tags associated with the contact"""
112
-
113
-
114
- @deprecated(
115
- "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
116
- )
117
- class CreateImageContact(BaseModel):
118
- r"""@deprecated Use identity instead. Information about the contact making the request."""
119
-
120
- id: str
121
- r"""Unique identifier for the contact"""
122
-
123
- display_name: Optional[str] = None
124
- r"""Display name of the contact"""
125
-
126
- email: Optional[str] = None
127
- r"""Email address of the contact"""
128
-
129
- metadata: Optional[List[Dict[str, Any]]] = None
130
- r"""A hash of key/value pairs containing any other data about the contact"""
101
+ for n, f in type(self).model_fields.items():
102
+ k = f.alias or n
103
+ val = serialized.get(k)
131
104
 
132
- logo_url: Optional[str] = None
133
- r"""URL to the contact's avatar or logo"""
105
+ if val != UNSET_SENTINEL:
106
+ if val is not None or k not in optional_fields:
107
+ m[k] = val
134
108
 
135
- tags: Optional[List[str]] = None
136
- r"""A list of tags associated with the contact"""
109
+ return m
137
110
 
138
111
 
139
112
  CreateImageType = Literal["exact_match",]
@@ -155,32 +128,116 @@ class CreateImageCache(BaseModel):
155
128
  ttl: Optional[float] = 1800
156
129
  r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
157
130
 
131
+ @model_serializer(mode="wrap")
132
+ def serialize_model(self, handler):
133
+ optional_fields = set(["ttl"])
134
+ serialized = handler(self)
135
+ m = {}
136
+
137
+ for n, f in type(self).model_fields.items():
138
+ k = f.alias or n
139
+ val = serialized.get(k)
140
+
141
+ if val != UNSET_SENTINEL:
142
+ if val is not None or k not in optional_fields:
143
+ m[k] = val
144
+
145
+ return m
146
+
158
147
 
159
148
  CreateImageLoadBalancerType = Literal["weight_based",]
160
149
 
161
150
 
162
- class CreateImageLoadBalancer1TypedDict(TypedDict):
163
- type: CreateImageLoadBalancerType
151
+ class CreateImageLoadBalancerModelsTypedDict(TypedDict):
164
152
  model: str
165
153
  r"""Model identifier for load balancing"""
166
154
  weight: NotRequired[float]
167
155
  r"""Weight assigned to this model for load balancing"""
168
156
 
169
157
 
158
+ class CreateImageLoadBalancerModels(BaseModel):
159
+ model: str
160
+ r"""Model identifier for load balancing"""
161
+
162
+ weight: Optional[float] = 0.5
163
+ r"""Weight assigned to this model for load balancing"""
164
+
165
+ @model_serializer(mode="wrap")
166
+ def serialize_model(self, handler):
167
+ optional_fields = set(["weight"])
168
+ serialized = handler(self)
169
+ m = {}
170
+
171
+ for n, f in type(self).model_fields.items():
172
+ k = f.alias or n
173
+ val = serialized.get(k)
174
+
175
+ if val != UNSET_SENTINEL:
176
+ if val is not None or k not in optional_fields:
177
+ m[k] = val
178
+
179
+ return m
180
+
181
+
182
+ class CreateImageLoadBalancer1TypedDict(TypedDict):
183
+ type: CreateImageLoadBalancerType
184
+ models: List[CreateImageLoadBalancerModelsTypedDict]
185
+
186
+
170
187
  class CreateImageLoadBalancer1(BaseModel):
171
188
  type: CreateImageLoadBalancerType
172
189
 
190
+ models: List[CreateImageLoadBalancerModels]
191
+
192
+
193
+ class CreateImageLoadBalancerRouterImagesGenerationsModelsTypedDict(TypedDict):
194
+ model: str
195
+ r"""Model identifier for load balancing"""
196
+ weight: NotRequired[float]
197
+ r"""Weight assigned to this model for load balancing"""
198
+
199
+
200
+ class CreateImageLoadBalancerRouterImagesGenerationsModels(BaseModel):
173
201
  model: str
174
202
  r"""Model identifier for load balancing"""
175
203
 
176
204
  weight: Optional[float] = 0.5
177
205
  r"""Weight assigned to this model for load balancing"""
178
206
 
207
+ @model_serializer(mode="wrap")
208
+ def serialize_model(self, handler):
209
+ optional_fields = set(["weight"])
210
+ serialized = handler(self)
211
+ m = {}
212
+
213
+ for n, f in type(self).model_fields.items():
214
+ k = f.alias or n
215
+ val = serialized.get(k)
216
+
217
+ if val != UNSET_SENTINEL:
218
+ if val is not None or k not in optional_fields:
219
+ m[k] = val
220
+
221
+ return m
222
+
223
+
224
+ class CreateImageLoadBalancerRouterImagesGenerations1TypedDict(TypedDict):
225
+ type: CreateImageLoadBalancerRouterImagesGenerationsType
226
+ models: List[CreateImageLoadBalancerRouterImagesGenerationsModelsTypedDict]
227
+
228
+
229
+ class CreateImageLoadBalancerRouterImagesGenerations1(BaseModel):
230
+ type: CreateImageLoadBalancerRouterImagesGenerationsType
231
+
232
+ models: List[CreateImageLoadBalancerRouterImagesGenerationsModels]
233
+
179
234
 
180
235
  CreateImageLoadBalancerTypedDict = CreateImageLoadBalancer1TypedDict
236
+ r"""Load balancer configuration for the request."""
181
237
 
182
238
 
183
239
  CreateImageLoadBalancer = CreateImageLoadBalancer1
240
+ r"""Load balancer configuration for the request."""
184
241
 
185
242
 
186
243
  class CreateImageTimeoutTypedDict(TypedDict):
@@ -197,21 +254,132 @@ class CreateImageTimeout(BaseModel):
197
254
  r"""Timeout value in milliseconds"""
198
255
 
199
256
 
257
+ class CreateImageRouterImagesGenerationsRetryTypedDict(TypedDict):
258
+ r"""Retry configuration for the request"""
259
+
260
+ count: NotRequired[float]
261
+ r"""Number of retry attempts (1-5)"""
262
+ on_codes: NotRequired[List[float]]
263
+ r"""HTTP status codes that trigger retry logic"""
264
+
265
+
266
+ class CreateImageRouterImagesGenerationsRetry(BaseModel):
267
+ r"""Retry configuration for the request"""
268
+
269
+ count: Optional[float] = 3
270
+ r"""Number of retry attempts (1-5)"""
271
+
272
+ on_codes: Optional[List[float]] = None
273
+ r"""HTTP status codes that trigger retry logic"""
274
+
275
+ @model_serializer(mode="wrap")
276
+ def serialize_model(self, handler):
277
+ optional_fields = set(["count", "on_codes"])
278
+ serialized = handler(self)
279
+ m = {}
280
+
281
+ for n, f in type(self).model_fields.items():
282
+ k = f.alias or n
283
+ val = serialized.get(k)
284
+
285
+ if val != UNSET_SENTINEL:
286
+ if val is not None or k not in optional_fields:
287
+ m[k] = val
288
+
289
+ return m
290
+
291
+
292
+ class CreateImageRouterImagesGenerationsFallbacksTypedDict(TypedDict):
293
+ model: str
294
+ r"""Fallback model identifier"""
295
+
296
+
297
+ class CreateImageRouterImagesGenerationsFallbacks(BaseModel):
298
+ model: str
299
+ r"""Fallback model identifier"""
300
+
301
+
302
+ CreateImageRouterImagesGenerationsType = Literal["exact_match",]
303
+
304
+
305
+ class CreateImageRouterImagesGenerationsCacheTypedDict(TypedDict):
306
+ r"""Cache configuration for the request."""
307
+
308
+ type: CreateImageRouterImagesGenerationsType
309
+ ttl: NotRequired[float]
310
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
311
+
312
+
313
+ class CreateImageRouterImagesGenerationsCache(BaseModel):
314
+ r"""Cache configuration for the request."""
315
+
316
+ type: CreateImageRouterImagesGenerationsType
317
+
318
+ ttl: Optional[float] = 1800
319
+ r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
320
+
321
+ @model_serializer(mode="wrap")
322
+ def serialize_model(self, handler):
323
+ optional_fields = set(["ttl"])
324
+ serialized = handler(self)
325
+ m = {}
326
+
327
+ for n, f in type(self).model_fields.items():
328
+ k = f.alias or n
329
+ val = serialized.get(k)
330
+
331
+ if val != UNSET_SENTINEL:
332
+ if val is not None or k not in optional_fields:
333
+ m[k] = val
334
+
335
+ return m
336
+
337
+
338
+ CreateImageLoadBalancerRouterImagesGenerationsType = Literal["weight_based",]
339
+
340
+
341
+ CreateImageRouterImagesGenerationsLoadBalancerTypedDict = (
342
+ CreateImageLoadBalancerRouterImagesGenerations1TypedDict
343
+ )
344
+ r"""Array of models with weights for load balancing requests"""
345
+
346
+
347
+ CreateImageRouterImagesGenerationsLoadBalancer = (
348
+ CreateImageLoadBalancerRouterImagesGenerations1
349
+ )
350
+ r"""Array of models with weights for load balancing requests"""
351
+
352
+
353
+ class CreateImageRouterImagesGenerationsTimeoutTypedDict(TypedDict):
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 CreateImageRouterImagesGenerationsTimeout(BaseModel):
361
+ 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."""
362
+
363
+ call_timeout: float
364
+ r"""Timeout value in milliseconds"""
365
+
366
+
200
367
  class CreateImageOrqTypedDict(TypedDict):
201
368
  name: NotRequired[str]
202
369
  r"""The name to display on the trace. If not specified, the default system name will be used."""
203
- retry: NotRequired[CreateImageRetryTypedDict]
370
+ retry: NotRequired[CreateImageRouterImagesGenerationsRetryTypedDict]
204
371
  r"""Retry configuration for the request"""
205
- fallbacks: NotRequired[List[CreateImageFallbacksTypedDict]]
372
+ fallbacks: NotRequired[List[CreateImageRouterImagesGenerationsFallbacksTypedDict]]
206
373
  r"""Array of fallback models to use if primary model fails"""
207
- identity: NotRequired[PublicContactTypedDict]
374
+ identity: NotRequired[PublicIdentityTypedDict]
208
375
  r"""Information about the identity making the request. If the identity does not exist, it will be created automatically."""
209
- contact: NotRequired[CreateImageContactTypedDict]
210
- cache: NotRequired[CreateImageCacheTypedDict]
376
+ contact: NotRequired[PublicContactTypedDict]
377
+ r"""@deprecated Use identity instead. Information about the contact making the request."""
378
+ cache: NotRequired[CreateImageRouterImagesGenerationsCacheTypedDict]
211
379
  r"""Cache configuration for the request."""
212
- load_balancer: NotRequired[List[CreateImageLoadBalancerTypedDict]]
380
+ load_balancer: NotRequired[CreateImageRouterImagesGenerationsLoadBalancerTypedDict]
213
381
  r"""Array of models with weights for load balancing requests"""
214
- timeout: NotRequired[CreateImageTimeoutTypedDict]
382
+ timeout: NotRequired[CreateImageRouterImagesGenerationsTimeoutTypedDict]
215
383
  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."""
216
384
 
217
385
 
@@ -219,26 +387,59 @@ class CreateImageOrq(BaseModel):
219
387
  name: Optional[str] = None
220
388
  r"""The name to display on the trace. If not specified, the default system name will be used."""
221
389
 
222
- retry: Optional[CreateImageRetry] = None
390
+ retry: Optional[CreateImageRouterImagesGenerationsRetry] = None
223
391
  r"""Retry configuration for the request"""
224
392
 
225
- fallbacks: Optional[List[CreateImageFallbacks]] = None
393
+ fallbacks: Optional[List[CreateImageRouterImagesGenerationsFallbacks]] = None
226
394
  r"""Array of fallback models to use if primary model fails"""
227
395
 
228
- identity: Optional[PublicContact] = None
396
+ identity: Optional[PublicIdentity] = None
229
397
  r"""Information about the identity making the request. If the identity does not exist, it will be created automatically."""
230
398
 
231
- contact: Optional[CreateImageContact] = None
399
+ contact: Annotated[
400
+ Optional[PublicContact],
401
+ pydantic.Field(
402
+ deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
403
+ ),
404
+ ] = None
405
+ r"""@deprecated Use identity instead. Information about the contact making the request."""
232
406
 
233
- cache: Optional[CreateImageCache] = None
407
+ cache: Optional[CreateImageRouterImagesGenerationsCache] = None
234
408
  r"""Cache configuration for the request."""
235
409
 
236
- load_balancer: Optional[List[CreateImageLoadBalancer]] = None
410
+ load_balancer: Optional[CreateImageRouterImagesGenerationsLoadBalancer] = None
237
411
  r"""Array of models with weights for load balancing requests"""
238
412
 
239
- timeout: Optional[CreateImageTimeout] = None
413
+ timeout: Optional[CreateImageRouterImagesGenerationsTimeout] = None
240
414
  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."""
241
415
 
416
+ @model_serializer(mode="wrap")
417
+ def serialize_model(self, handler):
418
+ optional_fields = set(
419
+ [
420
+ "name",
421
+ "retry",
422
+ "fallbacks",
423
+ "identity",
424
+ "contact",
425
+ "cache",
426
+ "load_balancer",
427
+ "timeout",
428
+ ]
429
+ )
430
+ serialized = handler(self)
431
+ m = {}
432
+
433
+ for n, f in type(self).model_fields.items():
434
+ k = f.alias or n
435
+ val = serialized.get(k)
436
+
437
+ if val != UNSET_SENTINEL:
438
+ if val is not None or k not in optional_fields:
439
+ m[k] = val
440
+
441
+ return m
442
+
242
443
 
243
444
  class CreateImageRequestBodyTypedDict(TypedDict):
244
445
  r"""input"""
@@ -265,6 +466,18 @@ class CreateImageRequestBodyTypedDict(TypedDict):
265
466
  r"""The size of the generated images. Must be one of the specified sizes for each model."""
266
467
  style: NotRequired[Nullable[Style]]
267
468
  r"""The style of the generated images. This parameter is only supported for `openai/dall-e-3`. Must be one of `vivid` or `natural`."""
469
+ name: NotRequired[str]
470
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
471
+ fallbacks: NotRequired[List[CreateImageFallbacksTypedDict]]
472
+ r"""Array of fallback models to use if primary model fails"""
473
+ retry: NotRequired[CreateImageRetryTypedDict]
474
+ r"""Retry configuration for the request"""
475
+ cache: NotRequired[CreateImageCacheTypedDict]
476
+ r"""Cache configuration for the request."""
477
+ load_balancer: NotRequired[CreateImageLoadBalancerTypedDict]
478
+ r"""Load balancer configuration for the request."""
479
+ timeout: NotRequired[CreateImageTimeoutTypedDict]
480
+ 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."""
268
481
  orq: NotRequired[CreateImageOrqTypedDict]
269
482
 
270
483
 
@@ -304,56 +517,79 @@ class CreateImageRequestBody(BaseModel):
304
517
  style: OptionalNullable[Style] = UNSET
305
518
  r"""The style of the generated images. This parameter is only supported for `openai/dall-e-3`. Must be one of `vivid` or `natural`."""
306
519
 
520
+ name: Optional[str] = None
521
+ r"""The name to display on the trace. If not specified, the default system name will be used."""
522
+
523
+ fallbacks: Optional[List[CreateImageFallbacks]] = None
524
+ r"""Array of fallback models to use if primary model fails"""
525
+
526
+ retry: Optional[CreateImageRetry] = None
527
+ r"""Retry configuration for the request"""
528
+
529
+ cache: Optional[CreateImageCache] = None
530
+ r"""Cache configuration for the request."""
531
+
532
+ load_balancer: Optional[CreateImageLoadBalancer] = None
533
+ r"""Load balancer configuration for the request."""
534
+
535
+ timeout: Optional[CreateImageTimeout] = None
536
+ 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."""
537
+
307
538
  orq: Optional[CreateImageOrq] = None
308
539
 
309
540
  @model_serializer(mode="wrap")
310
541
  def serialize_model(self, handler):
311
- optional_fields = [
312
- "background",
313
- "moderation",
314
- "n",
315
- "output_compression",
316
- "output_format",
317
- "quality",
318
- "response_format",
319
- "size",
320
- "style",
321
- "orq",
322
- ]
323
- nullable_fields = [
324
- "background",
325
- "moderation",
326
- "n",
327
- "output_compression",
328
- "output_format",
329
- "quality",
330
- "response_format",
331
- "size",
332
- "style",
333
- ]
334
- null_default_fields = []
335
-
542
+ optional_fields = set(
543
+ [
544
+ "background",
545
+ "moderation",
546
+ "n",
547
+ "output_compression",
548
+ "output_format",
549
+ "quality",
550
+ "response_format",
551
+ "size",
552
+ "style",
553
+ "name",
554
+ "fallbacks",
555
+ "retry",
556
+ "cache",
557
+ "load_balancer",
558
+ "timeout",
559
+ "orq",
560
+ ]
561
+ )
562
+ nullable_fields = set(
563
+ [
564
+ "background",
565
+ "moderation",
566
+ "n",
567
+ "output_compression",
568
+ "output_format",
569
+ "quality",
570
+ "response_format",
571
+ "size",
572
+ "style",
573
+ ]
574
+ )
336
575
  serialized = handler(self)
337
-
338
576
  m = {}
339
577
 
340
578
  for n, f in type(self).model_fields.items():
341
579
  k = f.alias or n
342
580
  val = serialized.get(k)
343
- serialized.pop(k, None)
344
-
345
- optional_nullable = k in optional_fields and k in nullable_fields
346
- is_set = (
347
- self.__pydantic_fields_set__.intersection({n})
348
- or k in null_default_fields
349
- ) # pylint: disable=no-member
350
-
351
- if val is not None and val != UNSET_SENTINEL:
352
- m[k] = val
353
- elif val != UNSET_SENTINEL and (
354
- not k in optional_fields or (optional_nullable and is_set)
355
- ):
356
- m[k] = val
581
+ is_nullable_and_explicitly_set = (
582
+ k in nullable_fields
583
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
584
+ )
585
+
586
+ if val != UNSET_SENTINEL:
587
+ if (
588
+ val is not None
589
+ or k not in optional_fields
590
+ or is_nullable_and_explicitly_set
591
+ ):
592
+ m[k] = val
357
593
 
358
594
  return m
359
595
 
@@ -379,31 +615,26 @@ class CreateImageData(BaseModel):
379
615
 
380
616
  @model_serializer(mode="wrap")
381
617
  def serialize_model(self, handler):
382
- optional_fields = ["revised_prompt", "b64_json", "url"]
383
- nullable_fields = ["revised_prompt"]
384
- null_default_fields = []
385
-
618
+ optional_fields = set(["revised_prompt", "b64_json", "url"])
619
+ nullable_fields = set(["revised_prompt"])
386
620
  serialized = handler(self)
387
-
388
621
  m = {}
389
622
 
390
623
  for n, f in type(self).model_fields.items():
391
624
  k = f.alias or n
392
625
  val = serialized.get(k)
393
- serialized.pop(k, None)
394
-
395
- optional_nullable = k in optional_fields and k in nullable_fields
396
- is_set = (
397
- self.__pydantic_fields_set__.intersection({n})
398
- or k in null_default_fields
399
- ) # pylint: disable=no-member
400
-
401
- if val is not None and val != UNSET_SENTINEL:
402
- m[k] = val
403
- elif val != UNSET_SENTINEL and (
404
- not k in optional_fields or (optional_nullable and is_set)
405
- ):
406
- m[k] = val
626
+ is_nullable_and_explicitly_set = (
627
+ k in nullable_fields
628
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
629
+ )
630
+
631
+ if val != UNSET_SENTINEL:
632
+ if (
633
+ val is not None
634
+ or k not in optional_fields
635
+ or is_nullable_and_explicitly_set
636
+ ):
637
+ m[k] = val
407
638
 
408
639
  return m
409
640
 
@@ -418,6 +649,22 @@ class InputTokensDetails(BaseModel):
418
649
 
419
650
  text_tokens: Optional[float] = None
420
651
 
652
+ @model_serializer(mode="wrap")
653
+ def serialize_model(self, handler):
654
+ optional_fields = set(["image_tokens", "text_tokens"])
655
+ serialized = handler(self)
656
+ m = {}
657
+
658
+ for n, f in type(self).model_fields.items():
659
+ k = f.alias or n
660
+ val = serialized.get(k)
661
+
662
+ if val != UNSET_SENTINEL:
663
+ if val is not None or k not in optional_fields:
664
+ m[k] = val
665
+
666
+ return m
667
+
421
668
 
422
669
  class CreateImageUsageTypedDict(TypedDict):
423
670
  input_tokens_details: InputTokensDetailsTypedDict
@@ -435,6 +682,22 @@ class CreateImageUsage(BaseModel):
435
682
 
436
683
  total_tokens: Optional[float] = None
437
684
 
685
+ @model_serializer(mode="wrap")
686
+ def serialize_model(self, handler):
687
+ optional_fields = set(["input_tokens", "output_tokens", "total_tokens"])
688
+ serialized = handler(self)
689
+ m = {}
690
+
691
+ for n, f in type(self).model_fields.items():
692
+ k = f.alias or n
693
+ val = serialized.get(k)
694
+
695
+ if val != UNSET_SENTINEL:
696
+ if val is not None or k not in optional_fields:
697
+ m[k] = val
698
+
699
+ return m
700
+
438
701
 
439
702
  class CreateImageResponseBodyTypedDict(TypedDict):
440
703
  r"""Represents an image generation response from the API."""
@@ -456,3 +719,19 @@ class CreateImageResponseBody(BaseModel):
456
719
  r"""Represents the url or the content of an image generated."""
457
720
 
458
721
  usage: Optional[CreateImageUsage] = None
722
+
723
+ @model_serializer(mode="wrap")
724
+ def serialize_model(self, handler):
725
+ optional_fields = set(["usage"])
726
+ serialized = handler(self)
727
+ m = {}
728
+
729
+ for n, f in type(self).model_fields.items():
730
+ k = f.alias or n
731
+ val = serialized.get(k)
732
+
733
+ if val != UNSET_SENTINEL:
734
+ if val is not None or k not in optional_fields:
735
+ m[k] = val
736
+
737
+ return m