camb-sdk 1.5.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. camb/__init__.py +335 -0
  2. camb/audio_separation/__init__.py +4 -0
  3. camb/audio_separation/client.py +406 -0
  4. camb/audio_separation/raw_client.py +534 -0
  5. camb/client.py +717 -0
  6. camb/core/__init__.py +105 -0
  7. camb/core/api_error.py +23 -0
  8. camb/core/client_wrapper.py +113 -0
  9. camb/core/datetime_utils.py +28 -0
  10. camb/core/file.py +67 -0
  11. camb/core/force_multipart.py +18 -0
  12. camb/core/http_client.py +663 -0
  13. camb/core/http_response.py +55 -0
  14. camb/core/http_sse/__init__.py +42 -0
  15. camb/core/http_sse/_api.py +112 -0
  16. camb/core/http_sse/_decoders.py +61 -0
  17. camb/core/http_sse/_exceptions.py +7 -0
  18. camb/core/http_sse/_models.py +17 -0
  19. camb/core/jsonable_encoder.py +100 -0
  20. camb/core/pydantic_utilities.py +260 -0
  21. camb/core/query_encoder.py +58 -0
  22. camb/core/remove_none_from_dict.py +11 -0
  23. camb/core/request_options.py +35 -0
  24. camb/core/serialization.py +276 -0
  25. camb/deprecated_streaming/__init__.py +4 -0
  26. camb/deprecated_streaming/client.py +532 -0
  27. camb/deprecated_streaming/raw_client.py +639 -0
  28. camb/dictionaries/__init__.py +4 -0
  29. camb/dictionaries/client.py +785 -0
  30. camb/dictionaries/raw_client.py +1048 -0
  31. camb/dub/__init__.py +49 -0
  32. camb/dub/client.py +846 -0
  33. camb/dub/raw_client.py +1194 -0
  34. camb/dub/types/__init__.py +53 -0
  35. camb/dub/types/dubbed_output_in_alt_format_request_payload_output_format.py +8 -0
  36. camb/dub/types/get_dubbed_output_in_alt_format_dub_alt_format_run_id_language_post_response.py +9 -0
  37. camb/dub/types/get_dubbed_run_info_dub_result_run_id_get_response.py +7 -0
  38. camb/dub/types/get_dubbing_runs_results_dubbing_results_post_response_value.py +7 -0
  39. camb/environment.py +7 -0
  40. camb/errors/__init__.py +34 -0
  41. camb/errors/unprocessable_entity_error.py +11 -0
  42. camb/folders/__init__.py +4 -0
  43. camb/folders/client.py +213 -0
  44. camb/folders/raw_client.py +278 -0
  45. camb/languages/__init__.py +4 -0
  46. camb/languages/client.py +168 -0
  47. camb/languages/raw_client.py +223 -0
  48. camb/project_setup/__init__.py +4 -0
  49. camb/project_setup/client.py +537 -0
  50. camb/project_setup/raw_client.py +655 -0
  51. camb/py.typed +0 -0
  52. camb/raw_client.py +236 -0
  53. camb/story/__init__.py +37 -0
  54. camb/story/client.py +579 -0
  55. camb/story/raw_client.py +743 -0
  56. camb/story/types/__init__.py +38 -0
  57. camb/story/types/create_story_story_post_response.py +8 -0
  58. camb/story/types/setup_story_story_setup_post_response.py +8 -0
  59. camb/streaming/__init__.py +4 -0
  60. camb/streaming/client.py +645 -0
  61. camb/streaming/raw_client.py +796 -0
  62. camb/text_to_audio/__init__.py +4 -0
  63. camb/text_to_audio/client.py +469 -0
  64. camb/text_to_audio/raw_client.py +610 -0
  65. camb/text_to_speech/__init__.py +49 -0
  66. camb/text_to_speech/baseten.py +214 -0
  67. camb/text_to_speech/client.py +742 -0
  68. camb/text_to_speech/raw_client.py +995 -0
  69. camb/text_to_speech/types/__init__.py +47 -0
  70. camb/text_to_speech/types/create_stream_tts_request_payload_language.py +71 -0
  71. camb/text_to_speech/types/create_stream_tts_request_payload_speech_model.py +7 -0
  72. camb/text_to_speech/types/get_tts_results_tts_results_post_response_value.py +7 -0
  73. camb/text_to_speech/types/get_tts_run_info_tts_result_run_id_get_response.py +7 -0
  74. camb/text_to_voice/__init__.py +4 -0
  75. camb/text_to_voice/client.py +329 -0
  76. camb/text_to_voice/raw_client.py +405 -0
  77. camb/transcription/__init__.py +4 -0
  78. camb/transcription/client.py +465 -0
  79. camb/transcription/raw_client.py +587 -0
  80. camb/translated_story/__init__.py +4 -0
  81. camb/translated_story/client.py +309 -0
  82. camb/translated_story/raw_client.py +381 -0
  83. camb/translated_tts/__init__.py +4 -0
  84. camb/translated_tts/client.py +313 -0
  85. camb/translated_tts/raw_client.py +357 -0
  86. camb/translation/__init__.py +4 -0
  87. camb/translation/client.py +631 -0
  88. camb/translation/raw_client.py +787 -0
  89. camb/types/__init__.py +236 -0
  90. camb/types/add_target_language_out.py +20 -0
  91. camb/types/audio_output_type.py +5 -0
  92. camb/types/audio_stream.py +31 -0
  93. camb/types/config_stream.py +22 -0
  94. camb/types/config_stream_pipeline.py +28 -0
  95. camb/types/create_custom_voice_out.py +19 -0
  96. camb/types/create_project_setup_out.py +19 -0
  97. camb/types/create_stream_out.py +22 -0
  98. camb/types/create_stream_request_payload.py +70 -0
  99. camb/types/create_translated_tts_out.py +19 -0
  100. camb/types/create_tts_out.py +19 -0
  101. camb/types/data_stream.py +24 -0
  102. camb/types/demixing_option.py +10 -0
  103. camb/types/dictionary_term.py +21 -0
  104. camb/types/dictionary_with_terms.py +28 -0
  105. camb/types/dubbing_result.py +22 -0
  106. camb/types/exception_reasons.py +30 -0
  107. camb/types/folder.py +20 -0
  108. camb/types/formalities.py +3 -0
  109. camb/types/gender.py +3 -0
  110. camb/types/get_audio_separation_result_out.py +20 -0
  111. camb/types/get_create_project_setup_response.py +21 -0
  112. camb/types/get_probe_stream_in.py +21 -0
  113. camb/types/get_probe_stream_out.py +24 -0
  114. camb/types/get_setup_story_result_response.py +21 -0
  115. camb/types/get_text_to_voice_result_out.py +19 -0
  116. camb/types/get_tts_result_out_file_url.py +19 -0
  117. camb/types/http_validation_error.py +20 -0
  118. camb/types/language_enums.py +154 -0
  119. camb/types/language_pydantic_model.py +21 -0
  120. camb/types/languages.py +3 -0
  121. camb/types/orchestrator_pipeline_call_result.py +19 -0
  122. camb/types/orchestrator_pipeline_result.py +25 -0
  123. camb/types/orchestrator_pipeline_result_exception_reason.py +7 -0
  124. camb/types/orchestrator_pipeline_result_message.py +5 -0
  125. camb/types/output_format.py +10 -0
  126. camb/types/overdub_config.py +37 -0
  127. camb/types/project_details.py +28 -0
  128. camb/types/revoicing_option.py +5 -0
  129. camb/types/run_i_ds_request_payload.py +19 -0
  130. camb/types/segmenting_option.py +5 -0
  131. camb/types/source_stream.py +30 -0
  132. camb/types/story_details.py +27 -0
  133. camb/types/stream_category.py +3 -0
  134. camb/types/stream_tts_inference_options.py +38 -0
  135. camb/types/stream_tts_output_configuration.py +33 -0
  136. camb/types/stream_tts_voice_settings.py +28 -0
  137. camb/types/stream_type.py +3 -0
  138. camb/types/stream_url_for_languages.py +21 -0
  139. camb/types/target_stream.py +34 -0
  140. camb/types/task_status.py +5 -0
  141. camb/types/term_translation_input.py +21 -0
  142. camb/types/term_translation_output.py +20 -0
  143. camb/types/text_to_audio_result.py +19 -0
  144. camb/types/text_to_audio_type.py +5 -0
  145. camb/types/transcribing_option.py +5 -0
  146. camb/types/transcript.py +22 -0
  147. camb/types/transcript_data_type.py +5 -0
  148. camb/types/transcript_file_format.py +5 -0
  149. camb/types/transcription_result.py +20 -0
  150. camb/types/translating_option.py +5 -0
  151. camb/types/translation_result.py +19 -0
  152. camb/types/tts_provider.py +3 -0
  153. camb/types/validation_error.py +22 -0
  154. camb/types/validation_error_loc_item.py +5 -0
  155. camb/types/video_output_type_without_avi.py +5 -0
  156. camb/types/video_stream.py +28 -0
  157. camb/types/voice.py +28 -0
  158. camb/voice_cloning/__init__.py +34 -0
  159. camb/voice_cloning/client.py +265 -0
  160. camb/voice_cloning/raw_client.py +320 -0
  161. camb/voice_cloning/types/__init__.py +36 -0
  162. camb/voice_cloning/types/list_voices_list_voices_get_response_item.py +7 -0
  163. camb_sdk-1.5.4.dist-info/METADATA +282 -0
  164. camb_sdk-1.5.4.dist-info/RECORD +167 -0
  165. camb_sdk-1.5.4.dist-info/WHEEL +5 -0
  166. camb_sdk-1.5.4.dist-info/licenses/LICENSE +21 -0
  167. camb_sdk-1.5.4.dist-info/top_level.txt +1 -0
@@ -0,0 +1,743 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from .. import core
7
+ from ..core.api_error import ApiError
8
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
10
+ from ..core.jsonable_encoder import jsonable_encoder
11
+ from ..core.pydantic_utilities import parse_obj_as
12
+ from ..core.request_options import RequestOptions
13
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
14
+ from ..types.http_validation_error import HttpValidationError
15
+ from ..types.languages import Languages
16
+ from ..types.orchestrator_pipeline_result import OrchestratorPipelineResult
17
+ from .types.create_story_story_post_response import CreateStoryStoryPostResponse
18
+ from .types.setup_story_story_setup_post_response import SetupStoryStorySetupPostResponse
19
+
20
+ # this is used as the default value for optional parameters
21
+ OMIT = typing.cast(typing.Any, ...)
22
+
23
+
24
+ class RawStoryClient:
25
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
26
+ self._client_wrapper = client_wrapper
27
+
28
+ def create_story(
29
+ self,
30
+ *,
31
+ file: core.File,
32
+ source_language: Languages,
33
+ run_id: typing.Optional[int] = None,
34
+ title: typing.Optional[str] = OMIT,
35
+ description: typing.Optional[str] = OMIT,
36
+ narrator_voice_id: typing.Optional[int] = OMIT,
37
+ folder_id: typing.Optional[int] = OMIT,
38
+ chosen_dictionaries: typing.Optional[typing.List[int]] = OMIT,
39
+ request_options: typing.Optional[RequestOptions] = None,
40
+ ) -> HttpResponse[CreateStoryStoryPostResponse]:
41
+ """
42
+ Parameters
43
+ ----------
44
+ file : core.File
45
+ See core.File for more documentation
46
+
47
+ source_language : Languages
48
+
49
+ run_id : typing.Optional[int]
50
+
51
+ title : typing.Optional[str]
52
+
53
+ description : typing.Optional[str]
54
+
55
+ narrator_voice_id : typing.Optional[int]
56
+
57
+ folder_id : typing.Optional[int]
58
+
59
+ chosen_dictionaries : typing.Optional[typing.List[int]]
60
+
61
+ request_options : typing.Optional[RequestOptions]
62
+ Request-specific configuration.
63
+
64
+ Returns
65
+ -------
66
+ HttpResponse[CreateStoryStoryPostResponse]
67
+ Successful Response
68
+ """
69
+ _response = self._client_wrapper.httpx_client.request(
70
+ "story",
71
+ method="POST",
72
+ params={
73
+ "run_id": run_id,
74
+ },
75
+ data={
76
+ "source_language": source_language,
77
+ "title": title,
78
+ "description": description,
79
+ "narrator_voice_id": narrator_voice_id,
80
+ "folder_id": folder_id,
81
+ "chosen_dictionaries": chosen_dictionaries,
82
+ },
83
+ files={
84
+ "file": file,
85
+ },
86
+ request_options=request_options,
87
+ omit=OMIT,
88
+ force_multipart=True,
89
+ )
90
+ try:
91
+ if 200 <= _response.status_code < 300:
92
+ _data = typing.cast(
93
+ CreateStoryStoryPostResponse,
94
+ parse_obj_as(
95
+ type_=CreateStoryStoryPostResponse, # type: ignore
96
+ object_=_response.json(),
97
+ ),
98
+ )
99
+ return HttpResponse(response=_response, data=_data)
100
+ if _response.status_code == 422:
101
+ raise UnprocessableEntityError(
102
+ headers=dict(_response.headers),
103
+ body=typing.cast(
104
+ HttpValidationError,
105
+ parse_obj_as(
106
+ type_=HttpValidationError, # type: ignore
107
+ object_=_response.json(),
108
+ ),
109
+ ),
110
+ )
111
+ _response_json = _response.json()
112
+ except JSONDecodeError:
113
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
114
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
115
+
116
+ def setup_story(
117
+ self,
118
+ *,
119
+ file: core.File,
120
+ source_language: Languages,
121
+ run_id: typing.Optional[int] = None,
122
+ title: typing.Optional[str] = OMIT,
123
+ description: typing.Optional[str] = OMIT,
124
+ narrator_voice_id: typing.Optional[int] = OMIT,
125
+ folder_id: typing.Optional[int] = OMIT,
126
+ chosen_dictionaries: typing.Optional[typing.List[int]] = OMIT,
127
+ request_options: typing.Optional[RequestOptions] = None,
128
+ ) -> HttpResponse[SetupStoryStorySetupPostResponse]:
129
+ """
130
+ Parameters
131
+ ----------
132
+ file : core.File
133
+ See core.File for more documentation
134
+
135
+ source_language : Languages
136
+
137
+ run_id : typing.Optional[int]
138
+
139
+ title : typing.Optional[str]
140
+
141
+ description : typing.Optional[str]
142
+
143
+ narrator_voice_id : typing.Optional[int]
144
+
145
+ folder_id : typing.Optional[int]
146
+
147
+ chosen_dictionaries : typing.Optional[typing.List[int]]
148
+
149
+ request_options : typing.Optional[RequestOptions]
150
+ Request-specific configuration.
151
+
152
+ Returns
153
+ -------
154
+ HttpResponse[SetupStoryStorySetupPostResponse]
155
+ Successful Response
156
+ """
157
+ _response = self._client_wrapper.httpx_client.request(
158
+ "story-setup",
159
+ method="POST",
160
+ params={
161
+ "run_id": run_id,
162
+ },
163
+ data={
164
+ "source_language": source_language,
165
+ "title": title,
166
+ "description": description,
167
+ "narrator_voice_id": narrator_voice_id,
168
+ "folder_id": folder_id,
169
+ "chosen_dictionaries": chosen_dictionaries,
170
+ },
171
+ files={
172
+ "file": file,
173
+ },
174
+ request_options=request_options,
175
+ omit=OMIT,
176
+ force_multipart=True,
177
+ )
178
+ try:
179
+ if 200 <= _response.status_code < 300:
180
+ _data = typing.cast(
181
+ SetupStoryStorySetupPostResponse,
182
+ parse_obj_as(
183
+ type_=SetupStoryStorySetupPostResponse, # type: ignore
184
+ object_=_response.json(),
185
+ ),
186
+ )
187
+ return HttpResponse(response=_response, data=_data)
188
+ if _response.status_code == 422:
189
+ raise UnprocessableEntityError(
190
+ headers=dict(_response.headers),
191
+ body=typing.cast(
192
+ HttpValidationError,
193
+ parse_obj_as(
194
+ type_=HttpValidationError, # type: ignore
195
+ object_=_response.json(),
196
+ ),
197
+ ),
198
+ )
199
+ _response_json = _response.json()
200
+ except JSONDecodeError:
201
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
202
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
203
+
204
+ def get_story_status(
205
+ self,
206
+ task_id: str,
207
+ *,
208
+ run_id: typing.Optional[int] = None,
209
+ request_options: typing.Optional[RequestOptions] = None,
210
+ ) -> HttpResponse[OrchestratorPipelineResult]:
211
+ """
212
+ Parameters
213
+ ----------
214
+ task_id : str
215
+
216
+ run_id : typing.Optional[int]
217
+
218
+ request_options : typing.Optional[RequestOptions]
219
+ Request-specific configuration.
220
+
221
+ Returns
222
+ -------
223
+ HttpResponse[OrchestratorPipelineResult]
224
+ Successful Response
225
+ """
226
+ _response = self._client_wrapper.httpx_client.request(
227
+ f"story/{jsonable_encoder(task_id)}",
228
+ method="GET",
229
+ params={
230
+ "run_id": run_id,
231
+ },
232
+ request_options=request_options,
233
+ )
234
+ try:
235
+ if 200 <= _response.status_code < 300:
236
+ _data = typing.cast(
237
+ OrchestratorPipelineResult,
238
+ parse_obj_as(
239
+ type_=OrchestratorPipelineResult, # type: ignore
240
+ object_=_response.json(),
241
+ ),
242
+ )
243
+ return HttpResponse(response=_response, data=_data)
244
+ if _response.status_code == 422:
245
+ raise UnprocessableEntityError(
246
+ headers=dict(_response.headers),
247
+ body=typing.cast(
248
+ HttpValidationError,
249
+ parse_obj_as(
250
+ type_=HttpValidationError, # type: ignore
251
+ object_=_response.json(),
252
+ ),
253
+ ),
254
+ )
255
+ _response_json = _response.json()
256
+ except JSONDecodeError:
257
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
258
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
259
+
260
+ def get_story_run_info(
261
+ self,
262
+ run_id: typing.Optional[int],
263
+ *,
264
+ include_transcript: typing.Optional[bool] = None,
265
+ request_options: typing.Optional[RequestOptions] = None,
266
+ ) -> HttpResponse[typing.Dict[str, typing.Any]]:
267
+ """
268
+ Parameters
269
+ ----------
270
+ run_id : typing.Optional[int]
271
+
272
+ include_transcript : typing.Optional[bool]
273
+ Whether to include the transcription in the response for fetching the result of a Stories run.
274
+
275
+ request_options : typing.Optional[RequestOptions]
276
+ Request-specific configuration.
277
+
278
+ Returns
279
+ -------
280
+ HttpResponse[typing.Dict[str, typing.Any]]
281
+ Successful Response
282
+ """
283
+ _response = self._client_wrapper.httpx_client.request(
284
+ f"story-result/{jsonable_encoder(run_id)}",
285
+ method="GET",
286
+ params={
287
+ "include_transcript": include_transcript,
288
+ },
289
+ request_options=request_options,
290
+ )
291
+ try:
292
+ if 200 <= _response.status_code < 300:
293
+ _data = typing.cast(
294
+ typing.Dict[str, typing.Any],
295
+ parse_obj_as(
296
+ type_=typing.Dict[str, typing.Any], # type: ignore
297
+ object_=_response.json(),
298
+ ),
299
+ )
300
+ return HttpResponse(response=_response, data=_data)
301
+ if _response.status_code == 422:
302
+ raise UnprocessableEntityError(
303
+ headers=dict(_response.headers),
304
+ body=typing.cast(
305
+ HttpValidationError,
306
+ parse_obj_as(
307
+ type_=HttpValidationError, # type: ignore
308
+ object_=_response.json(),
309
+ ),
310
+ ),
311
+ )
312
+ _response_json = _response.json()
313
+ except JSONDecodeError:
314
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
315
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
316
+
317
+ def get_stories_runs_results(
318
+ self,
319
+ *,
320
+ run_ids: typing.Sequence[int],
321
+ run_id: typing.Optional[int] = None,
322
+ traceparent: typing.Optional[str] = None,
323
+ request_options: typing.Optional[RequestOptions] = None,
324
+ ) -> HttpResponse[typing.Dict[str, typing.Dict[str, typing.Any]]]:
325
+ """
326
+ Parameters
327
+ ----------
328
+ run_ids : typing.Sequence[int]
329
+
330
+ run_id : typing.Optional[int]
331
+
332
+ traceparent : typing.Optional[str]
333
+
334
+ request_options : typing.Optional[RequestOptions]
335
+ Request-specific configuration.
336
+
337
+ Returns
338
+ -------
339
+ HttpResponse[typing.Dict[str, typing.Dict[str, typing.Any]]]
340
+ Successful Response
341
+ """
342
+ _response = self._client_wrapper.httpx_client.request(
343
+ "stories-results",
344
+ method="POST",
345
+ params={
346
+ "run_id": run_id,
347
+ },
348
+ json={
349
+ "run_ids": run_ids,
350
+ },
351
+ headers={
352
+ "content-type": "application/json",
353
+ "traceparent": str(traceparent) if traceparent is not None else None,
354
+ },
355
+ request_options=request_options,
356
+ omit=OMIT,
357
+ )
358
+ try:
359
+ if 200 <= _response.status_code < 300:
360
+ _data = typing.cast(
361
+ typing.Dict[str, typing.Dict[str, typing.Any]],
362
+ parse_obj_as(
363
+ type_=typing.Dict[str, typing.Dict[str, typing.Any]], # type: ignore
364
+ object_=_response.json(),
365
+ ),
366
+ )
367
+ return HttpResponse(response=_response, data=_data)
368
+ if _response.status_code == 422:
369
+ raise UnprocessableEntityError(
370
+ headers=dict(_response.headers),
371
+ body=typing.cast(
372
+ HttpValidationError,
373
+ parse_obj_as(
374
+ type_=HttpValidationError, # type: ignore
375
+ object_=_response.json(),
376
+ ),
377
+ ),
378
+ )
379
+ _response_json = _response.json()
380
+ except JSONDecodeError:
381
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
382
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
383
+
384
+
385
+ class AsyncRawStoryClient:
386
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
387
+ self._client_wrapper = client_wrapper
388
+
389
+ async def create_story(
390
+ self,
391
+ *,
392
+ file: core.File,
393
+ source_language: Languages,
394
+ run_id: typing.Optional[int] = None,
395
+ title: typing.Optional[str] = OMIT,
396
+ description: typing.Optional[str] = OMIT,
397
+ narrator_voice_id: typing.Optional[int] = OMIT,
398
+ folder_id: typing.Optional[int] = OMIT,
399
+ chosen_dictionaries: typing.Optional[typing.List[int]] = OMIT,
400
+ request_options: typing.Optional[RequestOptions] = None,
401
+ ) -> AsyncHttpResponse[CreateStoryStoryPostResponse]:
402
+ """
403
+ Parameters
404
+ ----------
405
+ file : core.File
406
+ See core.File for more documentation
407
+
408
+ source_language : Languages
409
+
410
+ run_id : typing.Optional[int]
411
+
412
+ title : typing.Optional[str]
413
+
414
+ description : typing.Optional[str]
415
+
416
+ narrator_voice_id : typing.Optional[int]
417
+
418
+ folder_id : typing.Optional[int]
419
+
420
+ chosen_dictionaries : typing.Optional[typing.List[int]]
421
+
422
+ request_options : typing.Optional[RequestOptions]
423
+ Request-specific configuration.
424
+
425
+ Returns
426
+ -------
427
+ AsyncHttpResponse[CreateStoryStoryPostResponse]
428
+ Successful Response
429
+ """
430
+ _response = await self._client_wrapper.httpx_client.request(
431
+ "story",
432
+ method="POST",
433
+ params={
434
+ "run_id": run_id,
435
+ },
436
+ data={
437
+ "source_language": source_language,
438
+ "title": title,
439
+ "description": description,
440
+ "narrator_voice_id": narrator_voice_id,
441
+ "folder_id": folder_id,
442
+ "chosen_dictionaries": chosen_dictionaries,
443
+ },
444
+ files={
445
+ "file": file,
446
+ },
447
+ request_options=request_options,
448
+ omit=OMIT,
449
+ force_multipart=True,
450
+ )
451
+ try:
452
+ if 200 <= _response.status_code < 300:
453
+ _data = typing.cast(
454
+ CreateStoryStoryPostResponse,
455
+ parse_obj_as(
456
+ type_=CreateStoryStoryPostResponse, # type: ignore
457
+ object_=_response.json(),
458
+ ),
459
+ )
460
+ return AsyncHttpResponse(response=_response, data=_data)
461
+ if _response.status_code == 422:
462
+ raise UnprocessableEntityError(
463
+ headers=dict(_response.headers),
464
+ body=typing.cast(
465
+ HttpValidationError,
466
+ parse_obj_as(
467
+ type_=HttpValidationError, # type: ignore
468
+ object_=_response.json(),
469
+ ),
470
+ ),
471
+ )
472
+ _response_json = _response.json()
473
+ except JSONDecodeError:
474
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
475
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
476
+
477
+ async def setup_story(
478
+ self,
479
+ *,
480
+ file: core.File,
481
+ source_language: Languages,
482
+ run_id: typing.Optional[int] = None,
483
+ title: typing.Optional[str] = OMIT,
484
+ description: typing.Optional[str] = OMIT,
485
+ narrator_voice_id: typing.Optional[int] = OMIT,
486
+ folder_id: typing.Optional[int] = OMIT,
487
+ chosen_dictionaries: typing.Optional[typing.List[int]] = OMIT,
488
+ request_options: typing.Optional[RequestOptions] = None,
489
+ ) -> AsyncHttpResponse[SetupStoryStorySetupPostResponse]:
490
+ """
491
+ Parameters
492
+ ----------
493
+ file : core.File
494
+ See core.File for more documentation
495
+
496
+ source_language : Languages
497
+
498
+ run_id : typing.Optional[int]
499
+
500
+ title : typing.Optional[str]
501
+
502
+ description : typing.Optional[str]
503
+
504
+ narrator_voice_id : typing.Optional[int]
505
+
506
+ folder_id : typing.Optional[int]
507
+
508
+ chosen_dictionaries : typing.Optional[typing.List[int]]
509
+
510
+ request_options : typing.Optional[RequestOptions]
511
+ Request-specific configuration.
512
+
513
+ Returns
514
+ -------
515
+ AsyncHttpResponse[SetupStoryStorySetupPostResponse]
516
+ Successful Response
517
+ """
518
+ _response = await self._client_wrapper.httpx_client.request(
519
+ "story-setup",
520
+ method="POST",
521
+ params={
522
+ "run_id": run_id,
523
+ },
524
+ data={
525
+ "source_language": source_language,
526
+ "title": title,
527
+ "description": description,
528
+ "narrator_voice_id": narrator_voice_id,
529
+ "folder_id": folder_id,
530
+ "chosen_dictionaries": chosen_dictionaries,
531
+ },
532
+ files={
533
+ "file": file,
534
+ },
535
+ request_options=request_options,
536
+ omit=OMIT,
537
+ force_multipart=True,
538
+ )
539
+ try:
540
+ if 200 <= _response.status_code < 300:
541
+ _data = typing.cast(
542
+ SetupStoryStorySetupPostResponse,
543
+ parse_obj_as(
544
+ type_=SetupStoryStorySetupPostResponse, # type: ignore
545
+ object_=_response.json(),
546
+ ),
547
+ )
548
+ return AsyncHttpResponse(response=_response, data=_data)
549
+ if _response.status_code == 422:
550
+ raise UnprocessableEntityError(
551
+ headers=dict(_response.headers),
552
+ body=typing.cast(
553
+ HttpValidationError,
554
+ parse_obj_as(
555
+ type_=HttpValidationError, # type: ignore
556
+ object_=_response.json(),
557
+ ),
558
+ ),
559
+ )
560
+ _response_json = _response.json()
561
+ except JSONDecodeError:
562
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
563
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
564
+
565
+ async def get_story_status(
566
+ self,
567
+ task_id: str,
568
+ *,
569
+ run_id: typing.Optional[int] = None,
570
+ request_options: typing.Optional[RequestOptions] = None,
571
+ ) -> AsyncHttpResponse[OrchestratorPipelineResult]:
572
+ """
573
+ Parameters
574
+ ----------
575
+ task_id : str
576
+
577
+ run_id : typing.Optional[int]
578
+
579
+ request_options : typing.Optional[RequestOptions]
580
+ Request-specific configuration.
581
+
582
+ Returns
583
+ -------
584
+ AsyncHttpResponse[OrchestratorPipelineResult]
585
+ Successful Response
586
+ """
587
+ _response = await self._client_wrapper.httpx_client.request(
588
+ f"story/{jsonable_encoder(task_id)}",
589
+ method="GET",
590
+ params={
591
+ "run_id": run_id,
592
+ },
593
+ request_options=request_options,
594
+ )
595
+ try:
596
+ if 200 <= _response.status_code < 300:
597
+ _data = typing.cast(
598
+ OrchestratorPipelineResult,
599
+ parse_obj_as(
600
+ type_=OrchestratorPipelineResult, # type: ignore
601
+ object_=_response.json(),
602
+ ),
603
+ )
604
+ return AsyncHttpResponse(response=_response, data=_data)
605
+ if _response.status_code == 422:
606
+ raise UnprocessableEntityError(
607
+ headers=dict(_response.headers),
608
+ body=typing.cast(
609
+ HttpValidationError,
610
+ parse_obj_as(
611
+ type_=HttpValidationError, # type: ignore
612
+ object_=_response.json(),
613
+ ),
614
+ ),
615
+ )
616
+ _response_json = _response.json()
617
+ except JSONDecodeError:
618
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
619
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
620
+
621
+ async def get_story_run_info(
622
+ self,
623
+ run_id: typing.Optional[int],
624
+ *,
625
+ include_transcript: typing.Optional[bool] = None,
626
+ request_options: typing.Optional[RequestOptions] = None,
627
+ ) -> AsyncHttpResponse[typing.Dict[str, typing.Any]]:
628
+ """
629
+ Parameters
630
+ ----------
631
+ run_id : typing.Optional[int]
632
+
633
+ include_transcript : typing.Optional[bool]
634
+ Whether to include the transcription in the response for fetching the result of a Stories run.
635
+
636
+ request_options : typing.Optional[RequestOptions]
637
+ Request-specific configuration.
638
+
639
+ Returns
640
+ -------
641
+ AsyncHttpResponse[typing.Dict[str, typing.Any]]
642
+ Successful Response
643
+ """
644
+ _response = await self._client_wrapper.httpx_client.request(
645
+ f"story-result/{jsonable_encoder(run_id)}",
646
+ method="GET",
647
+ params={
648
+ "include_transcript": include_transcript,
649
+ },
650
+ request_options=request_options,
651
+ )
652
+ try:
653
+ if 200 <= _response.status_code < 300:
654
+ _data = typing.cast(
655
+ typing.Dict[str, typing.Any],
656
+ parse_obj_as(
657
+ type_=typing.Dict[str, typing.Any], # type: ignore
658
+ object_=_response.json(),
659
+ ),
660
+ )
661
+ return AsyncHttpResponse(response=_response, data=_data)
662
+ if _response.status_code == 422:
663
+ raise UnprocessableEntityError(
664
+ headers=dict(_response.headers),
665
+ body=typing.cast(
666
+ HttpValidationError,
667
+ parse_obj_as(
668
+ type_=HttpValidationError, # type: ignore
669
+ object_=_response.json(),
670
+ ),
671
+ ),
672
+ )
673
+ _response_json = _response.json()
674
+ except JSONDecodeError:
675
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
676
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
677
+
678
+ async def get_stories_runs_results(
679
+ self,
680
+ *,
681
+ run_ids: typing.Sequence[int],
682
+ run_id: typing.Optional[int] = None,
683
+ traceparent: typing.Optional[str] = None,
684
+ request_options: typing.Optional[RequestOptions] = None,
685
+ ) -> AsyncHttpResponse[typing.Dict[str, typing.Dict[str, typing.Any]]]:
686
+ """
687
+ Parameters
688
+ ----------
689
+ run_ids : typing.Sequence[int]
690
+
691
+ run_id : typing.Optional[int]
692
+
693
+ traceparent : typing.Optional[str]
694
+
695
+ request_options : typing.Optional[RequestOptions]
696
+ Request-specific configuration.
697
+
698
+ Returns
699
+ -------
700
+ AsyncHttpResponse[typing.Dict[str, typing.Dict[str, typing.Any]]]
701
+ Successful Response
702
+ """
703
+ _response = await self._client_wrapper.httpx_client.request(
704
+ "stories-results",
705
+ method="POST",
706
+ params={
707
+ "run_id": run_id,
708
+ },
709
+ json={
710
+ "run_ids": run_ids,
711
+ },
712
+ headers={
713
+ "content-type": "application/json",
714
+ "traceparent": str(traceparent) if traceparent is not None else None,
715
+ },
716
+ request_options=request_options,
717
+ omit=OMIT,
718
+ )
719
+ try:
720
+ if 200 <= _response.status_code < 300:
721
+ _data = typing.cast(
722
+ typing.Dict[str, typing.Dict[str, typing.Any]],
723
+ parse_obj_as(
724
+ type_=typing.Dict[str, typing.Dict[str, typing.Any]], # type: ignore
725
+ object_=_response.json(),
726
+ ),
727
+ )
728
+ return AsyncHttpResponse(response=_response, data=_data)
729
+ if _response.status_code == 422:
730
+ raise UnprocessableEntityError(
731
+ headers=dict(_response.headers),
732
+ body=typing.cast(
733
+ HttpValidationError,
734
+ parse_obj_as(
735
+ type_=HttpValidationError, # type: ignore
736
+ object_=_response.json(),
737
+ ),
738
+ ),
739
+ )
740
+ _response_json = _response.json()
741
+ except JSONDecodeError:
742
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
743
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)