orq-ai-sdk 4.2.0rc49__py3-none-any.whl → 4.2.12__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. orq_ai_sdk/_hooks/globalhook.py +0 -1
  2. orq_ai_sdk/_version.py +3 -3
  3. orq_ai_sdk/audio.py +30 -0
  4. orq_ai_sdk/chat.py +22 -0
  5. orq_ai_sdk/completions.py +438 -0
  6. orq_ai_sdk/contacts.py +43 -886
  7. orq_ai_sdk/deployments.py +61 -0
  8. orq_ai_sdk/edits.py +364 -0
  9. orq_ai_sdk/embeddings.py +344 -0
  10. orq_ai_sdk/generations.py +370 -0
  11. orq_ai_sdk/images.py +28 -0
  12. orq_ai_sdk/models/__init__.py +3839 -424
  13. orq_ai_sdk/models/conversationresponse.py +1 -1
  14. orq_ai_sdk/models/conversationwithmessagesresponse.py +1 -1
  15. orq_ai_sdk/models/createagentrequestop.py +768 -12
  16. orq_ai_sdk/models/createagentresponse.py +68 -2
  17. orq_ai_sdk/models/createchatcompletionop.py +538 -313
  18. orq_ai_sdk/models/createcompletionop.py +2078 -0
  19. orq_ai_sdk/models/createcontactop.py +5 -10
  20. orq_ai_sdk/models/createconversationop.py +1 -1
  21. orq_ai_sdk/models/createconversationresponseop.py +2 -2
  22. orq_ai_sdk/models/createdatasetitemop.py +4 -4
  23. orq_ai_sdk/models/createdatasetop.py +1 -1
  24. orq_ai_sdk/models/createdatasourceop.py +1 -1
  25. orq_ai_sdk/models/createembeddingop.py +579 -0
  26. orq_ai_sdk/models/createevalop.py +14 -14
  27. orq_ai_sdk/models/createidentityop.py +1 -1
  28. orq_ai_sdk/models/createimageeditop.py +715 -0
  29. orq_ai_sdk/models/createimageop.py +228 -82
  30. orq_ai_sdk/models/createimagevariationop.py +706 -0
  31. orq_ai_sdk/models/creatememoryop.py +4 -2
  32. orq_ai_sdk/models/createmoderationop.py +521 -0
  33. orq_ai_sdk/models/createpromptop.py +375 -6
  34. orq_ai_sdk/models/creatererankop.py +608 -0
  35. orq_ai_sdk/models/createresponseop.py +2567 -0
  36. orq_ai_sdk/models/createspeechop.py +466 -0
  37. orq_ai_sdk/models/createtoolop.py +6 -6
  38. orq_ai_sdk/models/createtranscriptionop.py +732 -0
  39. orq_ai_sdk/models/createtranslationop.py +702 -0
  40. orq_ai_sdk/models/deploymentgetconfigop.py +17 -7
  41. orq_ai_sdk/models/deploymentsop.py +1 -0
  42. orq_ai_sdk/models/deploymentstreamop.py +7 -0
  43. orq_ai_sdk/models/filegetop.py +1 -1
  44. orq_ai_sdk/models/filelistop.py +1 -1
  45. orq_ai_sdk/models/fileuploadop.py +1 -1
  46. orq_ai_sdk/models/generateconversationnameop.py +1 -1
  47. orq_ai_sdk/models/getallmemoriesop.py +4 -2
  48. orq_ai_sdk/models/getallpromptsop.py +188 -3
  49. orq_ai_sdk/models/getalltoolsop.py +6 -6
  50. orq_ai_sdk/models/getevalsop.py +17 -17
  51. orq_ai_sdk/models/getonepromptop.py +188 -3
  52. orq_ai_sdk/models/getpromptversionop.py +188 -3
  53. orq_ai_sdk/models/invokedeploymentrequest.py +11 -4
  54. orq_ai_sdk/models/listagentsop.py +372 -0
  55. orq_ai_sdk/models/listdatasetdatapointsop.py +4 -4
  56. orq_ai_sdk/models/listdatasetsop.py +1 -1
  57. orq_ai_sdk/models/listdatasourcesop.py +1 -1
  58. orq_ai_sdk/models/listidentitiesop.py +1 -1
  59. orq_ai_sdk/models/listmodelsop.py +1 -0
  60. orq_ai_sdk/models/listpromptversionsop.py +188 -3
  61. orq_ai_sdk/models/partdoneevent.py +1 -1
  62. orq_ai_sdk/models/post_v2_router_ocrop.py +408 -0
  63. orq_ai_sdk/models/publiccontact.py +9 -3
  64. orq_ai_sdk/models/publicidentity.py +62 -0
  65. orq_ai_sdk/models/reasoningpart.py +1 -1
  66. orq_ai_sdk/models/responsedoneevent.py +14 -11
  67. orq_ai_sdk/models/retrieveagentrequestop.py +382 -0
  68. orq_ai_sdk/models/retrievedatapointop.py +4 -4
  69. orq_ai_sdk/models/retrievedatasetop.py +1 -1
  70. orq_ai_sdk/models/retrievedatasourceop.py +1 -1
  71. orq_ai_sdk/models/retrieveidentityop.py +1 -1
  72. orq_ai_sdk/models/retrievememoryop.py +4 -2
  73. orq_ai_sdk/models/retrievetoolop.py +6 -6
  74. orq_ai_sdk/models/runagentop.py +379 -9
  75. orq_ai_sdk/models/streamrunagentop.py +385 -9
  76. orq_ai_sdk/models/updateagentop.py +770 -12
  77. orq_ai_sdk/models/updateconversationop.py +1 -1
  78. orq_ai_sdk/models/updatedatapointop.py +4 -4
  79. orq_ai_sdk/models/updatedatasetop.py +1 -1
  80. orq_ai_sdk/models/updatedatasourceop.py +1 -1
  81. orq_ai_sdk/models/updateevalop.py +14 -14
  82. orq_ai_sdk/models/updateidentityop.py +1 -1
  83. orq_ai_sdk/models/updatememoryop.py +4 -2
  84. orq_ai_sdk/models/updatepromptop.py +375 -6
  85. orq_ai_sdk/models/updatetoolop.py +7 -7
  86. orq_ai_sdk/moderations.py +218 -0
  87. orq_ai_sdk/orq_completions.py +666 -0
  88. orq_ai_sdk/orq_responses.py +398 -0
  89. orq_ai_sdk/rerank.py +330 -0
  90. orq_ai_sdk/router.py +89 -641
  91. orq_ai_sdk/speech.py +333 -0
  92. orq_ai_sdk/transcriptions.py +416 -0
  93. orq_ai_sdk/translations.py +384 -0
  94. orq_ai_sdk/variations.py +364 -0
  95. orq_ai_sdk-4.2.12.dist-info/METADATA +888 -0
  96. {orq_ai_sdk-4.2.0rc49.dist-info → orq_ai_sdk-4.2.12.dist-info}/RECORD +98 -75
  97. {orq_ai_sdk-4.2.0rc49.dist-info → orq_ai_sdk-4.2.12.dist-info}/WHEEL +1 -1
  98. orq_ai_sdk/models/deletecontactop.py +0 -44
  99. orq_ai_sdk/models/listcontactsop.py +0 -265
  100. orq_ai_sdk/models/retrievecontactop.py +0 -142
  101. orq_ai_sdk/models/updatecontactop.py +0 -233
  102. orq_ai_sdk-4.2.0rc49.dist-info/METADATA +0 -788
  103. {orq_ai_sdk-4.2.0rc49.dist-info → orq_ai_sdk-4.2.12.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,384 @@
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 createtranslationop as models_createtranslationop
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 Translations(BaseSDK):
14
+ def create(
15
+ self,
16
+ *,
17
+ model: str,
18
+ prompt: Optional[str] = None,
19
+ enable_logging: Optional[bool] = True,
20
+ diarize: Optional[bool] = False,
21
+ response_format: Optional[
22
+ models_createtranslationop.CreateTranslationResponseFormat
23
+ ] = None,
24
+ tag_audio_events: Optional[bool] = True,
25
+ num_speakers: Optional[float] = None,
26
+ timestamps_granularity: Optional[
27
+ models_createtranslationop.CreateTranslationTimestampsGranularity
28
+ ] = "word",
29
+ temperature: Optional[float] = None,
30
+ name: Optional[str] = None,
31
+ fallbacks: Optional[
32
+ Union[
33
+ List[models_createtranslationop.CreateTranslationFallbacks],
34
+ List[models_createtranslationop.CreateTranslationFallbacksTypedDict],
35
+ ]
36
+ ] = None,
37
+ retry: Optional[
38
+ Union[
39
+ models_createtranslationop.CreateTranslationRetry,
40
+ models_createtranslationop.CreateTranslationRetryTypedDict,
41
+ ]
42
+ ] = None,
43
+ load_balancer: Optional[
44
+ Union[
45
+ models_createtranslationop.CreateTranslationLoadBalancer,
46
+ models_createtranslationop.CreateTranslationLoadBalancerTypedDict,
47
+ ]
48
+ ] = None,
49
+ timeout: Optional[
50
+ Union[
51
+ models_createtranslationop.CreateTranslationTimeout,
52
+ models_createtranslationop.CreateTranslationTimeoutTypedDict,
53
+ ]
54
+ ] = None,
55
+ orq: Optional[
56
+ Union[
57
+ models_createtranslationop.CreateTranslationOrq,
58
+ models_createtranslationop.CreateTranslationOrqTypedDict,
59
+ ]
60
+ ] = None,
61
+ file: Optional[
62
+ Union[
63
+ models_createtranslationop.CreateTranslationFile,
64
+ models_createtranslationop.CreateTranslationFileTypedDict,
65
+ ]
66
+ ] = None,
67
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
68
+ server_url: Optional[str] = None,
69
+ timeout_ms: Optional[int] = None,
70
+ http_headers: Optional[Mapping[str, str]] = None,
71
+ ) -> models.CreateTranslationResponseBody:
72
+ r"""Create translation
73
+
74
+ :param model: ID of the model to use
75
+ :param prompt: An optional text to guide the model's style or continue a previous audio segment. The prompt should match the audio language.
76
+ :param enable_logging: When enable_logging is set to false, zero retention mode is used. This disables history features like request stitching and is only available to enterprise customers.
77
+ :param diarize: Whether to annotate which speaker is currently talking in the uploaded file.
78
+ :param response_format: The format of the transcript output, in one of these options: json, text, srt, verbose_json, or vtt.
79
+ :param tag_audio_events: Whether to tag audio events like (laughter), (footsteps), etc. in the transcription.
80
+ :param num_speakers: The maximum amount of speakers talking in the uploaded file. Helps with predicting who speaks when, the maximum is 32.
81
+ :param timestamps_granularity: The granularity of the timestamps in the transcription. Word provides word-level timestamps and character provides character-level timestamps per word.
82
+ :param temperature: The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.
83
+ :param name: The name to display on the trace. If not specified, the default system name will be used.
84
+ :param fallbacks: Array of fallback models to use if primary model fails
85
+ :param retry: Retry configuration for the request
86
+ :param load_balancer: Load balancer configuration for the request.
87
+ :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.
88
+ :param orq:
89
+ :param file: The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
90
+ :param retries: Override the default retry configuration for this method
91
+ :param server_url: Override the default server URL for this method
92
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
93
+ :param http_headers: Additional headers to set or replace on requests.
94
+ """
95
+ base_url = None
96
+ url_variables = None
97
+ if timeout_ms is None:
98
+ timeout_ms = self.sdk_configuration.timeout_ms
99
+
100
+ if timeout_ms is None:
101
+ timeout_ms = 600000
102
+
103
+ if server_url is not None:
104
+ base_url = server_url
105
+ else:
106
+ base_url = self._get_url(base_url, url_variables)
107
+
108
+ request = models.CreateTranslationRequestBody(
109
+ model=model,
110
+ prompt=prompt,
111
+ enable_logging=enable_logging,
112
+ diarize=diarize,
113
+ response_format=response_format,
114
+ tag_audio_events=tag_audio_events,
115
+ num_speakers=num_speakers,
116
+ timestamps_granularity=timestamps_granularity,
117
+ temperature=temperature,
118
+ name=name,
119
+ fallbacks=utils.get_pydantic_model(
120
+ fallbacks, Optional[List[models.CreateTranslationFallbacks]]
121
+ ),
122
+ retry=utils.get_pydantic_model(
123
+ retry, Optional[models.CreateTranslationRetry]
124
+ ),
125
+ load_balancer=utils.get_pydantic_model(
126
+ load_balancer, Optional[models.CreateTranslationLoadBalancer]
127
+ ),
128
+ timeout=utils.get_pydantic_model(
129
+ timeout, Optional[models.CreateTranslationTimeout]
130
+ ),
131
+ orq=utils.get_pydantic_model(orq, Optional[models.CreateTranslationOrq]),
132
+ file=utils.get_pydantic_model(file, Optional[models.CreateTranslationFile]),
133
+ )
134
+
135
+ req = self._build_request(
136
+ method="POST",
137
+ path="/v2/router/audio/translations",
138
+ base_url=base_url,
139
+ url_variables=url_variables,
140
+ request=request,
141
+ request_body_required=True,
142
+ request_has_path_params=False,
143
+ request_has_query_params=True,
144
+ user_agent_header="user-agent",
145
+ accept_header_value="application/json",
146
+ http_headers=http_headers,
147
+ security=self.sdk_configuration.security,
148
+ get_serialized_body=lambda: utils.serialize_request_body(
149
+ request, False, False, "multipart", models.CreateTranslationRequestBody
150
+ ),
151
+ allow_empty_value=None,
152
+ timeout_ms=timeout_ms,
153
+ )
154
+
155
+ if retries == UNSET:
156
+ if self.sdk_configuration.retry_config is not UNSET:
157
+ retries = self.sdk_configuration.retry_config
158
+
159
+ retry_config = None
160
+ if isinstance(retries, utils.RetryConfig):
161
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
162
+
163
+ http_res = self.do_request(
164
+ hook_ctx=HookContext(
165
+ config=self.sdk_configuration,
166
+ base_url=base_url or "",
167
+ operation_id="createTranslation",
168
+ oauth2_scopes=None,
169
+ security_source=get_security_from_env(
170
+ self.sdk_configuration.security, models.Security
171
+ ),
172
+ ),
173
+ request=req,
174
+ error_status_codes=["422", "4XX", "5XX"],
175
+ retry_config=retry_config,
176
+ )
177
+
178
+ response_data: Any = None
179
+ if utils.match_response(http_res, "200", "application/json"):
180
+ return unmarshal_json_response(
181
+ models.CreateTranslationResponseBody, http_res
182
+ )
183
+ if utils.match_response(http_res, "422", "application/json"):
184
+ response_data = unmarshal_json_response(
185
+ models.CreateTranslationRouterAudioTranslationsResponseBodyData,
186
+ http_res,
187
+ )
188
+ raise models.CreateTranslationRouterAudioTranslationsResponseBody(
189
+ response_data, http_res
190
+ )
191
+ if utils.match_response(http_res, "4XX", "*"):
192
+ http_res_text = utils.stream_to_text(http_res)
193
+ raise models.APIError("API error occurred", http_res, http_res_text)
194
+ if utils.match_response(http_res, "5XX", "*"):
195
+ http_res_text = utils.stream_to_text(http_res)
196
+ raise models.APIError("API error occurred", http_res, http_res_text)
197
+
198
+ raise models.APIError("Unexpected response received", http_res)
199
+
200
+ async def create_async(
201
+ self,
202
+ *,
203
+ model: str,
204
+ prompt: Optional[str] = None,
205
+ enable_logging: Optional[bool] = True,
206
+ diarize: Optional[bool] = False,
207
+ response_format: Optional[
208
+ models_createtranslationop.CreateTranslationResponseFormat
209
+ ] = None,
210
+ tag_audio_events: Optional[bool] = True,
211
+ num_speakers: Optional[float] = None,
212
+ timestamps_granularity: Optional[
213
+ models_createtranslationop.CreateTranslationTimestampsGranularity
214
+ ] = "word",
215
+ temperature: Optional[float] = None,
216
+ name: Optional[str] = None,
217
+ fallbacks: Optional[
218
+ Union[
219
+ List[models_createtranslationop.CreateTranslationFallbacks],
220
+ List[models_createtranslationop.CreateTranslationFallbacksTypedDict],
221
+ ]
222
+ ] = None,
223
+ retry: Optional[
224
+ Union[
225
+ models_createtranslationop.CreateTranslationRetry,
226
+ models_createtranslationop.CreateTranslationRetryTypedDict,
227
+ ]
228
+ ] = None,
229
+ load_balancer: Optional[
230
+ Union[
231
+ models_createtranslationop.CreateTranslationLoadBalancer,
232
+ models_createtranslationop.CreateTranslationLoadBalancerTypedDict,
233
+ ]
234
+ ] = None,
235
+ timeout: Optional[
236
+ Union[
237
+ models_createtranslationop.CreateTranslationTimeout,
238
+ models_createtranslationop.CreateTranslationTimeoutTypedDict,
239
+ ]
240
+ ] = None,
241
+ orq: Optional[
242
+ Union[
243
+ models_createtranslationop.CreateTranslationOrq,
244
+ models_createtranslationop.CreateTranslationOrqTypedDict,
245
+ ]
246
+ ] = None,
247
+ file: Optional[
248
+ Union[
249
+ models_createtranslationop.CreateTranslationFile,
250
+ models_createtranslationop.CreateTranslationFileTypedDict,
251
+ ]
252
+ ] = None,
253
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
254
+ server_url: Optional[str] = None,
255
+ timeout_ms: Optional[int] = None,
256
+ http_headers: Optional[Mapping[str, str]] = None,
257
+ ) -> models.CreateTranslationResponseBody:
258
+ r"""Create translation
259
+
260
+ :param model: ID of the model to use
261
+ :param prompt: An optional text to guide the model's style or continue a previous audio segment. The prompt should match the audio language.
262
+ :param enable_logging: When enable_logging is set to false, zero retention mode is used. This disables history features like request stitching and is only available to enterprise customers.
263
+ :param diarize: Whether to annotate which speaker is currently talking in the uploaded file.
264
+ :param response_format: The format of the transcript output, in one of these options: json, text, srt, verbose_json, or vtt.
265
+ :param tag_audio_events: Whether to tag audio events like (laughter), (footsteps), etc. in the transcription.
266
+ :param num_speakers: The maximum amount of speakers talking in the uploaded file. Helps with predicting who speaks when, the maximum is 32.
267
+ :param timestamps_granularity: The granularity of the timestamps in the transcription. Word provides word-level timestamps and character provides character-level timestamps per word.
268
+ :param temperature: The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.
269
+ :param name: The name to display on the trace. If not specified, the default system name will be used.
270
+ :param fallbacks: Array of fallback models to use if primary model fails
271
+ :param retry: Retry configuration for the request
272
+ :param load_balancer: Load balancer configuration for the request.
273
+ :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.
274
+ :param orq:
275
+ :param file: The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
276
+ :param retries: Override the default retry configuration for this method
277
+ :param server_url: Override the default server URL for this method
278
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
279
+ :param http_headers: Additional headers to set or replace on requests.
280
+ """
281
+ base_url = None
282
+ url_variables = None
283
+ if timeout_ms is None:
284
+ timeout_ms = self.sdk_configuration.timeout_ms
285
+
286
+ if timeout_ms is None:
287
+ timeout_ms = 600000
288
+
289
+ if server_url is not None:
290
+ base_url = server_url
291
+ else:
292
+ base_url = self._get_url(base_url, url_variables)
293
+
294
+ request = models.CreateTranslationRequestBody(
295
+ model=model,
296
+ prompt=prompt,
297
+ enable_logging=enable_logging,
298
+ diarize=diarize,
299
+ response_format=response_format,
300
+ tag_audio_events=tag_audio_events,
301
+ num_speakers=num_speakers,
302
+ timestamps_granularity=timestamps_granularity,
303
+ temperature=temperature,
304
+ name=name,
305
+ fallbacks=utils.get_pydantic_model(
306
+ fallbacks, Optional[List[models.CreateTranslationFallbacks]]
307
+ ),
308
+ retry=utils.get_pydantic_model(
309
+ retry, Optional[models.CreateTranslationRetry]
310
+ ),
311
+ load_balancer=utils.get_pydantic_model(
312
+ load_balancer, Optional[models.CreateTranslationLoadBalancer]
313
+ ),
314
+ timeout=utils.get_pydantic_model(
315
+ timeout, Optional[models.CreateTranslationTimeout]
316
+ ),
317
+ orq=utils.get_pydantic_model(orq, Optional[models.CreateTranslationOrq]),
318
+ file=utils.get_pydantic_model(file, Optional[models.CreateTranslationFile]),
319
+ )
320
+
321
+ req = self._build_request_async(
322
+ method="POST",
323
+ path="/v2/router/audio/translations",
324
+ base_url=base_url,
325
+ url_variables=url_variables,
326
+ request=request,
327
+ request_body_required=True,
328
+ request_has_path_params=False,
329
+ request_has_query_params=True,
330
+ user_agent_header="user-agent",
331
+ accept_header_value="application/json",
332
+ http_headers=http_headers,
333
+ security=self.sdk_configuration.security,
334
+ get_serialized_body=lambda: utils.serialize_request_body(
335
+ request, False, False, "multipart", models.CreateTranslationRequestBody
336
+ ),
337
+ allow_empty_value=None,
338
+ timeout_ms=timeout_ms,
339
+ )
340
+
341
+ if retries == UNSET:
342
+ if self.sdk_configuration.retry_config is not UNSET:
343
+ retries = self.sdk_configuration.retry_config
344
+
345
+ retry_config = None
346
+ if isinstance(retries, utils.RetryConfig):
347
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
348
+
349
+ http_res = await self.do_request_async(
350
+ hook_ctx=HookContext(
351
+ config=self.sdk_configuration,
352
+ base_url=base_url or "",
353
+ operation_id="createTranslation",
354
+ oauth2_scopes=None,
355
+ security_source=get_security_from_env(
356
+ self.sdk_configuration.security, models.Security
357
+ ),
358
+ ),
359
+ request=req,
360
+ error_status_codes=["422", "4XX", "5XX"],
361
+ retry_config=retry_config,
362
+ )
363
+
364
+ response_data: Any = None
365
+ if utils.match_response(http_res, "200", "application/json"):
366
+ return unmarshal_json_response(
367
+ models.CreateTranslationResponseBody, http_res
368
+ )
369
+ if utils.match_response(http_res, "422", "application/json"):
370
+ response_data = unmarshal_json_response(
371
+ models.CreateTranslationRouterAudioTranslationsResponseBodyData,
372
+ http_res,
373
+ )
374
+ raise models.CreateTranslationRouterAudioTranslationsResponseBody(
375
+ response_data, http_res
376
+ )
377
+ if utils.match_response(http_res, "4XX", "*"):
378
+ http_res_text = await utils.stream_to_text_async(http_res)
379
+ raise models.APIError("API error occurred", http_res, http_res_text)
380
+ if utils.match_response(http_res, "5XX", "*"):
381
+ http_res_text = await utils.stream_to_text_async(http_res)
382
+ raise models.APIError("API error occurred", http_res, http_res_text)
383
+
384
+ raise models.APIError("Unexpected response received", http_res)