orq-ai-sdk 4.2.0rc49__py3-none-any.whl → 4.2.15__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- orq_ai_sdk/_hooks/globalhook.py +0 -1
- orq_ai_sdk/_version.py +3 -3
- orq_ai_sdk/agents.py +186 -186
- orq_ai_sdk/audio.py +30 -0
- orq_ai_sdk/chat.py +22 -0
- orq_ai_sdk/completions.py +438 -0
- orq_ai_sdk/contacts.py +43 -886
- orq_ai_sdk/deployments.py +61 -0
- orq_ai_sdk/edits.py +364 -0
- orq_ai_sdk/embeddings.py +344 -0
- orq_ai_sdk/generations.py +370 -0
- orq_ai_sdk/images.py +28 -0
- orq_ai_sdk/models/__init__.py +3839 -424
- orq_ai_sdk/models/conversationresponse.py +1 -1
- orq_ai_sdk/models/conversationwithmessagesresponse.py +1 -1
- orq_ai_sdk/models/createagentrequestop.py +768 -12
- orq_ai_sdk/models/createagentresponse.py +68 -2
- orq_ai_sdk/models/createchatcompletionop.py +538 -313
- orq_ai_sdk/models/createcompletionop.py +2078 -0
- orq_ai_sdk/models/createcontactop.py +5 -10
- orq_ai_sdk/models/createconversationop.py +1 -1
- orq_ai_sdk/models/createconversationresponseop.py +2 -2
- orq_ai_sdk/models/createdatasetitemop.py +4 -4
- orq_ai_sdk/models/createdatasetop.py +1 -1
- orq_ai_sdk/models/createdatasourceop.py +1 -1
- orq_ai_sdk/models/createembeddingop.py +579 -0
- orq_ai_sdk/models/createevalop.py +14 -14
- orq_ai_sdk/models/createidentityop.py +1 -1
- orq_ai_sdk/models/createimageeditop.py +715 -0
- orq_ai_sdk/models/createimageop.py +228 -82
- orq_ai_sdk/models/createimagevariationop.py +706 -0
- orq_ai_sdk/models/creatememoryop.py +4 -2
- orq_ai_sdk/models/createmoderationop.py +521 -0
- orq_ai_sdk/models/createpromptop.py +375 -6
- orq_ai_sdk/models/creatererankop.py +608 -0
- orq_ai_sdk/models/createresponseop.py +2567 -0
- orq_ai_sdk/models/createspeechop.py +466 -0
- orq_ai_sdk/models/createtoolop.py +6 -6
- orq_ai_sdk/models/createtranscriptionop.py +732 -0
- orq_ai_sdk/models/createtranslationop.py +702 -0
- orq_ai_sdk/models/deploymentgetconfigop.py +17 -7
- orq_ai_sdk/models/deploymentsop.py +1 -0
- orq_ai_sdk/models/deploymentstreamop.py +7 -0
- orq_ai_sdk/models/filegetop.py +1 -1
- orq_ai_sdk/models/filelistop.py +1 -1
- orq_ai_sdk/models/fileuploadop.py +1 -1
- orq_ai_sdk/models/generateconversationnameop.py +1 -1
- orq_ai_sdk/models/getallmemoriesop.py +4 -2
- orq_ai_sdk/models/getallpromptsop.py +188 -3
- orq_ai_sdk/models/getalltoolsop.py +6 -6
- orq_ai_sdk/models/getevalsop.py +17 -17
- orq_ai_sdk/models/getonepromptop.py +188 -3
- orq_ai_sdk/models/getpromptversionop.py +188 -3
- orq_ai_sdk/models/invokedeploymentrequest.py +11 -4
- orq_ai_sdk/models/listagentsop.py +372 -0
- orq_ai_sdk/models/listdatasetdatapointsop.py +4 -4
- orq_ai_sdk/models/listdatasetsop.py +1 -1
- orq_ai_sdk/models/listdatasourcesop.py +1 -1
- orq_ai_sdk/models/listidentitiesop.py +1 -1
- orq_ai_sdk/models/listmodelsop.py +1 -0
- orq_ai_sdk/models/listpromptversionsop.py +188 -3
- orq_ai_sdk/models/partdoneevent.py +1 -1
- orq_ai_sdk/models/post_v2_router_ocrop.py +408 -0
- orq_ai_sdk/models/publiccontact.py +9 -3
- orq_ai_sdk/models/publicidentity.py +62 -0
- orq_ai_sdk/models/reasoningpart.py +1 -1
- orq_ai_sdk/models/responsedoneevent.py +14 -11
- orq_ai_sdk/models/retrieveagentrequestop.py +382 -0
- orq_ai_sdk/models/retrievedatapointop.py +4 -4
- orq_ai_sdk/models/retrievedatasetop.py +1 -1
- orq_ai_sdk/models/retrievedatasourceop.py +1 -1
- orq_ai_sdk/models/retrieveidentityop.py +1 -1
- orq_ai_sdk/models/retrievememoryop.py +4 -2
- orq_ai_sdk/models/retrievetoolop.py +6 -6
- orq_ai_sdk/models/runagentop.py +379 -9
- orq_ai_sdk/models/streamrunagentop.py +385 -9
- orq_ai_sdk/models/updateagentop.py +770 -12
- orq_ai_sdk/models/updateconversationop.py +1 -1
- orq_ai_sdk/models/updatedatapointop.py +4 -4
- orq_ai_sdk/models/updatedatasetop.py +1 -1
- orq_ai_sdk/models/updatedatasourceop.py +1 -1
- orq_ai_sdk/models/updateevalop.py +14 -14
- orq_ai_sdk/models/updateidentityop.py +1 -1
- orq_ai_sdk/models/updatememoryop.py +4 -2
- orq_ai_sdk/models/updatepromptop.py +375 -6
- orq_ai_sdk/models/updatetoolop.py +7 -7
- orq_ai_sdk/moderations.py +218 -0
- orq_ai_sdk/orq_completions.py +666 -0
- orq_ai_sdk/orq_responses.py +398 -0
- orq_ai_sdk/rerank.py +330 -0
- orq_ai_sdk/router.py +89 -641
- orq_ai_sdk/speech.py +333 -0
- orq_ai_sdk/transcriptions.py +416 -0
- orq_ai_sdk/translations.py +384 -0
- orq_ai_sdk/variations.py +364 -0
- orq_ai_sdk-4.2.15.dist-info/METADATA +888 -0
- {orq_ai_sdk-4.2.0rc49.dist-info → orq_ai_sdk-4.2.15.dist-info}/RECORD +99 -76
- {orq_ai_sdk-4.2.0rc49.dist-info → orq_ai_sdk-4.2.15.dist-info}/WHEEL +1 -1
- orq_ai_sdk/models/deletecontactop.py +0 -44
- orq_ai_sdk/models/listcontactsop.py +0 -265
- orq_ai_sdk/models/retrievecontactop.py +0 -142
- orq_ai_sdk/models/updatecontactop.py +0 -233
- orq_ai_sdk-4.2.0rc49.dist-info/METADATA +0 -788
- {orq_ai_sdk-4.2.0rc49.dist-info → orq_ai_sdk-4.2.15.dist-info}/top_level.txt +0 -0
orq_ai_sdk/variations.py
ADDED
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from .basesdk import BaseSDK
|
|
4
|
+
from orq_ai_sdk import models, utils
|
|
5
|
+
from orq_ai_sdk._hooks import HookContext
|
|
6
|
+
from orq_ai_sdk.models import createimagevariationop as models_createimagevariationop
|
|
7
|
+
from orq_ai_sdk.types import OptionalNullable, UNSET
|
|
8
|
+
from orq_ai_sdk.utils import get_security_from_env
|
|
9
|
+
from orq_ai_sdk.utils.unmarshal_json_response import unmarshal_json_response
|
|
10
|
+
from typing import Any, List, Mapping, Optional, Union
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Variations(BaseSDK):
|
|
14
|
+
def create(
|
|
15
|
+
self,
|
|
16
|
+
*,
|
|
17
|
+
model: str,
|
|
18
|
+
image: Optional[Any] = None,
|
|
19
|
+
n: OptionalNullable[int] = 1,
|
|
20
|
+
response_format: Optional[
|
|
21
|
+
models_createimagevariationop.CreateImageVariationResponseFormat
|
|
22
|
+
] = "url",
|
|
23
|
+
size: Optional[models_createimagevariationop.Size] = "1024x1024",
|
|
24
|
+
user: Optional[str] = None,
|
|
25
|
+
name: Optional[str] = None,
|
|
26
|
+
fallbacks: Optional[
|
|
27
|
+
Union[
|
|
28
|
+
List[models_createimagevariationop.CreateImageVariationFallbacks],
|
|
29
|
+
List[
|
|
30
|
+
models_createimagevariationop.CreateImageVariationFallbacksTypedDict
|
|
31
|
+
],
|
|
32
|
+
]
|
|
33
|
+
] = None,
|
|
34
|
+
retry: Optional[
|
|
35
|
+
Union[
|
|
36
|
+
models_createimagevariationop.CreateImageVariationRetry,
|
|
37
|
+
models_createimagevariationop.CreateImageVariationRetryTypedDict,
|
|
38
|
+
]
|
|
39
|
+
] = None,
|
|
40
|
+
cache: Optional[
|
|
41
|
+
Union[
|
|
42
|
+
models_createimagevariationop.CreateImageVariationCache,
|
|
43
|
+
models_createimagevariationop.CreateImageVariationCacheTypedDict,
|
|
44
|
+
]
|
|
45
|
+
] = None,
|
|
46
|
+
load_balancer: Optional[
|
|
47
|
+
Union[
|
|
48
|
+
models_createimagevariationop.CreateImageVariationLoadBalancer,
|
|
49
|
+
models_createimagevariationop.CreateImageVariationLoadBalancerTypedDict,
|
|
50
|
+
]
|
|
51
|
+
] = None,
|
|
52
|
+
timeout: Optional[
|
|
53
|
+
Union[
|
|
54
|
+
models_createimagevariationop.CreateImageVariationTimeout,
|
|
55
|
+
models_createimagevariationop.CreateImageVariationTimeoutTypedDict,
|
|
56
|
+
]
|
|
57
|
+
] = None,
|
|
58
|
+
orq: Optional[
|
|
59
|
+
Union[
|
|
60
|
+
models_createimagevariationop.CreateImageVariationOrq,
|
|
61
|
+
models_createimagevariationop.CreateImageVariationOrqTypedDict,
|
|
62
|
+
]
|
|
63
|
+
] = None,
|
|
64
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
65
|
+
server_url: Optional[str] = None,
|
|
66
|
+
timeout_ms: Optional[int] = None,
|
|
67
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
68
|
+
) -> models.CreateImageVariationResponseBody:
|
|
69
|
+
r"""Create image variation
|
|
70
|
+
|
|
71
|
+
Create an Image Variation
|
|
72
|
+
|
|
73
|
+
:param model: The model to use for image generation.
|
|
74
|
+
:param image: The image to edit. Must be a supported image file. It should be a png, webp, or jpg file less than 50MB.
|
|
75
|
+
:param n: The number of images to generate. Must be between 1 and 10.
|
|
76
|
+
:param response_format: 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.
|
|
77
|
+
:param size: The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
|
|
78
|
+
:param user: A unique identifier representing your end-user, which can help to monitor and detect abuse.
|
|
79
|
+
:param name: The name to display on the trace. If not specified, the default system name will be used.
|
|
80
|
+
:param fallbacks: Array of fallback models to use if primary model fails
|
|
81
|
+
:param retry: Retry configuration for the request
|
|
82
|
+
:param cache: Cache configuration for the request.
|
|
83
|
+
:param load_balancer: Load balancer configuration for the request.
|
|
84
|
+
:param timeout: 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.
|
|
85
|
+
:param orq:
|
|
86
|
+
:param retries: Override the default retry configuration for this method
|
|
87
|
+
:param server_url: Override the default server URL for this method
|
|
88
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
89
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
90
|
+
"""
|
|
91
|
+
base_url = None
|
|
92
|
+
url_variables = None
|
|
93
|
+
if timeout_ms is None:
|
|
94
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
95
|
+
|
|
96
|
+
if timeout_ms is None:
|
|
97
|
+
timeout_ms = 600000
|
|
98
|
+
|
|
99
|
+
if server_url is not None:
|
|
100
|
+
base_url = server_url
|
|
101
|
+
else:
|
|
102
|
+
base_url = self._get_url(base_url, url_variables)
|
|
103
|
+
|
|
104
|
+
request = models.CreateImageVariationRequestBody(
|
|
105
|
+
image=image,
|
|
106
|
+
model=model,
|
|
107
|
+
n=n,
|
|
108
|
+
response_format=response_format,
|
|
109
|
+
size=size,
|
|
110
|
+
user=user,
|
|
111
|
+
name=name,
|
|
112
|
+
fallbacks=utils.get_pydantic_model(
|
|
113
|
+
fallbacks, Optional[List[models.CreateImageVariationFallbacks]]
|
|
114
|
+
),
|
|
115
|
+
retry=utils.get_pydantic_model(
|
|
116
|
+
retry, Optional[models.CreateImageVariationRetry]
|
|
117
|
+
),
|
|
118
|
+
cache=utils.get_pydantic_model(
|
|
119
|
+
cache, Optional[models.CreateImageVariationCache]
|
|
120
|
+
),
|
|
121
|
+
load_balancer=utils.get_pydantic_model(
|
|
122
|
+
load_balancer, Optional[models.CreateImageVariationLoadBalancer]
|
|
123
|
+
),
|
|
124
|
+
timeout=utils.get_pydantic_model(
|
|
125
|
+
timeout, Optional[models.CreateImageVariationTimeout]
|
|
126
|
+
),
|
|
127
|
+
orq=utils.get_pydantic_model(orq, Optional[models.CreateImageVariationOrq]),
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
req = self._build_request(
|
|
131
|
+
method="POST",
|
|
132
|
+
path="/v2/router/images/variations",
|
|
133
|
+
base_url=base_url,
|
|
134
|
+
url_variables=url_variables,
|
|
135
|
+
request=request,
|
|
136
|
+
request_body_required=True,
|
|
137
|
+
request_has_path_params=False,
|
|
138
|
+
request_has_query_params=True,
|
|
139
|
+
user_agent_header="user-agent",
|
|
140
|
+
accept_header_value="application/json",
|
|
141
|
+
http_headers=http_headers,
|
|
142
|
+
security=self.sdk_configuration.security,
|
|
143
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
144
|
+
request,
|
|
145
|
+
False,
|
|
146
|
+
False,
|
|
147
|
+
"multipart",
|
|
148
|
+
models.CreateImageVariationRequestBody,
|
|
149
|
+
),
|
|
150
|
+
allow_empty_value=None,
|
|
151
|
+
timeout_ms=timeout_ms,
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
if retries == UNSET:
|
|
155
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
156
|
+
retries = self.sdk_configuration.retry_config
|
|
157
|
+
|
|
158
|
+
retry_config = None
|
|
159
|
+
if isinstance(retries, utils.RetryConfig):
|
|
160
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
161
|
+
|
|
162
|
+
http_res = self.do_request(
|
|
163
|
+
hook_ctx=HookContext(
|
|
164
|
+
config=self.sdk_configuration,
|
|
165
|
+
base_url=base_url or "",
|
|
166
|
+
operation_id="createImageVariation",
|
|
167
|
+
oauth2_scopes=None,
|
|
168
|
+
security_source=get_security_from_env(
|
|
169
|
+
self.sdk_configuration.security, models.Security
|
|
170
|
+
),
|
|
171
|
+
),
|
|
172
|
+
request=req,
|
|
173
|
+
error_status_codes=["4XX", "5XX"],
|
|
174
|
+
retry_config=retry_config,
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
178
|
+
return unmarshal_json_response(
|
|
179
|
+
models.CreateImageVariationResponseBody, http_res
|
|
180
|
+
)
|
|
181
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
182
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
183
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
184
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
185
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
186
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
187
|
+
|
|
188
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
189
|
+
|
|
190
|
+
async def create_async(
|
|
191
|
+
self,
|
|
192
|
+
*,
|
|
193
|
+
model: str,
|
|
194
|
+
image: Optional[Any] = None,
|
|
195
|
+
n: OptionalNullable[int] = 1,
|
|
196
|
+
response_format: Optional[
|
|
197
|
+
models_createimagevariationop.CreateImageVariationResponseFormat
|
|
198
|
+
] = "url",
|
|
199
|
+
size: Optional[models_createimagevariationop.Size] = "1024x1024",
|
|
200
|
+
user: Optional[str] = None,
|
|
201
|
+
name: Optional[str] = None,
|
|
202
|
+
fallbacks: Optional[
|
|
203
|
+
Union[
|
|
204
|
+
List[models_createimagevariationop.CreateImageVariationFallbacks],
|
|
205
|
+
List[
|
|
206
|
+
models_createimagevariationop.CreateImageVariationFallbacksTypedDict
|
|
207
|
+
],
|
|
208
|
+
]
|
|
209
|
+
] = None,
|
|
210
|
+
retry: Optional[
|
|
211
|
+
Union[
|
|
212
|
+
models_createimagevariationop.CreateImageVariationRetry,
|
|
213
|
+
models_createimagevariationop.CreateImageVariationRetryTypedDict,
|
|
214
|
+
]
|
|
215
|
+
] = None,
|
|
216
|
+
cache: Optional[
|
|
217
|
+
Union[
|
|
218
|
+
models_createimagevariationop.CreateImageVariationCache,
|
|
219
|
+
models_createimagevariationop.CreateImageVariationCacheTypedDict,
|
|
220
|
+
]
|
|
221
|
+
] = None,
|
|
222
|
+
load_balancer: Optional[
|
|
223
|
+
Union[
|
|
224
|
+
models_createimagevariationop.CreateImageVariationLoadBalancer,
|
|
225
|
+
models_createimagevariationop.CreateImageVariationLoadBalancerTypedDict,
|
|
226
|
+
]
|
|
227
|
+
] = None,
|
|
228
|
+
timeout: Optional[
|
|
229
|
+
Union[
|
|
230
|
+
models_createimagevariationop.CreateImageVariationTimeout,
|
|
231
|
+
models_createimagevariationop.CreateImageVariationTimeoutTypedDict,
|
|
232
|
+
]
|
|
233
|
+
] = None,
|
|
234
|
+
orq: Optional[
|
|
235
|
+
Union[
|
|
236
|
+
models_createimagevariationop.CreateImageVariationOrq,
|
|
237
|
+
models_createimagevariationop.CreateImageVariationOrqTypedDict,
|
|
238
|
+
]
|
|
239
|
+
] = None,
|
|
240
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
241
|
+
server_url: Optional[str] = None,
|
|
242
|
+
timeout_ms: Optional[int] = None,
|
|
243
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
244
|
+
) -> models.CreateImageVariationResponseBody:
|
|
245
|
+
r"""Create image variation
|
|
246
|
+
|
|
247
|
+
Create an Image Variation
|
|
248
|
+
|
|
249
|
+
:param model: The model to use for image generation.
|
|
250
|
+
:param image: The image to edit. Must be a supported image file. It should be a png, webp, or jpg file less than 50MB.
|
|
251
|
+
:param n: The number of images to generate. Must be between 1 and 10.
|
|
252
|
+
:param response_format: 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.
|
|
253
|
+
:param size: The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
|
|
254
|
+
:param user: A unique identifier representing your end-user, which can help to monitor and detect abuse.
|
|
255
|
+
:param name: The name to display on the trace. If not specified, the default system name will be used.
|
|
256
|
+
:param fallbacks: Array of fallback models to use if primary model fails
|
|
257
|
+
:param retry: Retry configuration for the request
|
|
258
|
+
:param cache: Cache configuration for the request.
|
|
259
|
+
:param load_balancer: Load balancer configuration for the request.
|
|
260
|
+
:param timeout: 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.
|
|
261
|
+
:param orq:
|
|
262
|
+
:param retries: Override the default retry configuration for this method
|
|
263
|
+
:param server_url: Override the default server URL for this method
|
|
264
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
265
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
266
|
+
"""
|
|
267
|
+
base_url = None
|
|
268
|
+
url_variables = None
|
|
269
|
+
if timeout_ms is None:
|
|
270
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
271
|
+
|
|
272
|
+
if timeout_ms is None:
|
|
273
|
+
timeout_ms = 600000
|
|
274
|
+
|
|
275
|
+
if server_url is not None:
|
|
276
|
+
base_url = server_url
|
|
277
|
+
else:
|
|
278
|
+
base_url = self._get_url(base_url, url_variables)
|
|
279
|
+
|
|
280
|
+
request = models.CreateImageVariationRequestBody(
|
|
281
|
+
image=image,
|
|
282
|
+
model=model,
|
|
283
|
+
n=n,
|
|
284
|
+
response_format=response_format,
|
|
285
|
+
size=size,
|
|
286
|
+
user=user,
|
|
287
|
+
name=name,
|
|
288
|
+
fallbacks=utils.get_pydantic_model(
|
|
289
|
+
fallbacks, Optional[List[models.CreateImageVariationFallbacks]]
|
|
290
|
+
),
|
|
291
|
+
retry=utils.get_pydantic_model(
|
|
292
|
+
retry, Optional[models.CreateImageVariationRetry]
|
|
293
|
+
),
|
|
294
|
+
cache=utils.get_pydantic_model(
|
|
295
|
+
cache, Optional[models.CreateImageVariationCache]
|
|
296
|
+
),
|
|
297
|
+
load_balancer=utils.get_pydantic_model(
|
|
298
|
+
load_balancer, Optional[models.CreateImageVariationLoadBalancer]
|
|
299
|
+
),
|
|
300
|
+
timeout=utils.get_pydantic_model(
|
|
301
|
+
timeout, Optional[models.CreateImageVariationTimeout]
|
|
302
|
+
),
|
|
303
|
+
orq=utils.get_pydantic_model(orq, Optional[models.CreateImageVariationOrq]),
|
|
304
|
+
)
|
|
305
|
+
|
|
306
|
+
req = self._build_request_async(
|
|
307
|
+
method="POST",
|
|
308
|
+
path="/v2/router/images/variations",
|
|
309
|
+
base_url=base_url,
|
|
310
|
+
url_variables=url_variables,
|
|
311
|
+
request=request,
|
|
312
|
+
request_body_required=True,
|
|
313
|
+
request_has_path_params=False,
|
|
314
|
+
request_has_query_params=True,
|
|
315
|
+
user_agent_header="user-agent",
|
|
316
|
+
accept_header_value="application/json",
|
|
317
|
+
http_headers=http_headers,
|
|
318
|
+
security=self.sdk_configuration.security,
|
|
319
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
320
|
+
request,
|
|
321
|
+
False,
|
|
322
|
+
False,
|
|
323
|
+
"multipart",
|
|
324
|
+
models.CreateImageVariationRequestBody,
|
|
325
|
+
),
|
|
326
|
+
allow_empty_value=None,
|
|
327
|
+
timeout_ms=timeout_ms,
|
|
328
|
+
)
|
|
329
|
+
|
|
330
|
+
if retries == UNSET:
|
|
331
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
332
|
+
retries = self.sdk_configuration.retry_config
|
|
333
|
+
|
|
334
|
+
retry_config = None
|
|
335
|
+
if isinstance(retries, utils.RetryConfig):
|
|
336
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
337
|
+
|
|
338
|
+
http_res = await self.do_request_async(
|
|
339
|
+
hook_ctx=HookContext(
|
|
340
|
+
config=self.sdk_configuration,
|
|
341
|
+
base_url=base_url or "",
|
|
342
|
+
operation_id="createImageVariation",
|
|
343
|
+
oauth2_scopes=None,
|
|
344
|
+
security_source=get_security_from_env(
|
|
345
|
+
self.sdk_configuration.security, models.Security
|
|
346
|
+
),
|
|
347
|
+
),
|
|
348
|
+
request=req,
|
|
349
|
+
error_status_codes=["4XX", "5XX"],
|
|
350
|
+
retry_config=retry_config,
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
354
|
+
return unmarshal_json_response(
|
|
355
|
+
models.CreateImageVariationResponseBody, http_res
|
|
356
|
+
)
|
|
357
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
358
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
359
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
360
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
361
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
362
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
363
|
+
|
|
364
|
+
raise models.APIError("Unexpected response received", http_res)
|