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,309 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6
+ from ..core.request_options import RequestOptions
7
+ from ..types.add_target_language_out import AddTargetLanguageOut
8
+ from ..types.languages import Languages
9
+ from ..types.orchestrator_pipeline_result import OrchestratorPipelineResult
10
+ from .raw_client import AsyncRawTranslatedStoryClient, RawTranslatedStoryClient
11
+
12
+ # this is used as the default value for optional parameters
13
+ OMIT = typing.cast(typing.Any, ...)
14
+
15
+
16
+ class TranslatedStoryClient:
17
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
18
+ self._raw_client = RawTranslatedStoryClient(client_wrapper=client_wrapper)
19
+
20
+ @property
21
+ def with_raw_response(self) -> RawTranslatedStoryClient:
22
+ """
23
+ Retrieves a raw implementation of this client that returns raw responses.
24
+
25
+ Returns
26
+ -------
27
+ RawTranslatedStoryClient
28
+ """
29
+ return self._raw_client
30
+
31
+ def create_translation_for_existing_story(
32
+ self,
33
+ run_id: typing.Optional[int],
34
+ *,
35
+ target_language: Languages,
36
+ request_options: typing.Optional[RequestOptions] = None,
37
+ ) -> AddTargetLanguageOut:
38
+ """
39
+ Parameters
40
+ ----------
41
+ run_id : typing.Optional[int]
42
+
43
+ target_language : Languages
44
+
45
+ request_options : typing.Optional[RequestOptions]
46
+ Request-specific configuration.
47
+
48
+ Returns
49
+ -------
50
+ AddTargetLanguageOut
51
+ Successful Response
52
+
53
+ Examples
54
+ --------
55
+ from camb import CambApi
56
+
57
+ client = CambApi(
58
+ api_key="YOUR_API_KEY",
59
+ )
60
+ client.translated_story.create_translation_for_existing_story(
61
+ run_id=1,
62
+ target_language=1,
63
+ )
64
+ """
65
+ _response = self._raw_client.create_translation_for_existing_story(
66
+ run_id, target_language=target_language, request_options=request_options
67
+ )
68
+ return _response.data
69
+
70
+ def get_translated_story_status(
71
+ self,
72
+ task_id: str,
73
+ *,
74
+ run_id: typing.Optional[int] = None,
75
+ request_options: typing.Optional[RequestOptions] = None,
76
+ ) -> OrchestratorPipelineResult:
77
+ """
78
+ Parameters
79
+ ----------
80
+ task_id : str
81
+
82
+ run_id : typing.Optional[int]
83
+
84
+ request_options : typing.Optional[RequestOptions]
85
+ Request-specific configuration.
86
+
87
+ Returns
88
+ -------
89
+ OrchestratorPipelineResult
90
+ Successful Response
91
+
92
+ Examples
93
+ --------
94
+ from camb import CambApi
95
+
96
+ client = CambApi(
97
+ api_key="YOUR_API_KEY",
98
+ )
99
+ client.translated_story.get_translated_story_status(
100
+ task_id="task_id",
101
+ )
102
+ """
103
+ _response = self._raw_client.get_translated_story_status(
104
+ task_id, run_id=run_id, request_options=request_options
105
+ )
106
+ return _response.data
107
+
108
+ def get_translated_story_run_info(
109
+ self,
110
+ run_id: typing.Optional[int],
111
+ target_language: Languages,
112
+ *,
113
+ include_transcript: typing.Optional[bool] = None,
114
+ request_options: typing.Optional[RequestOptions] = None,
115
+ ) -> typing.Dict[str, typing.Any]:
116
+ """
117
+ Parameters
118
+ ----------
119
+ run_id : typing.Optional[int]
120
+
121
+ target_language : Languages
122
+
123
+ include_transcript : typing.Optional[bool]
124
+ Whether to include the transcription in the response for fetching the result of a Stories Translation run.
125
+
126
+ request_options : typing.Optional[RequestOptions]
127
+ Request-specific configuration.
128
+
129
+ Returns
130
+ -------
131
+ typing.Dict[str, typing.Any]
132
+ Successful Response
133
+
134
+ Examples
135
+ --------
136
+ from camb import CambApi
137
+
138
+ client = CambApi(
139
+ api_key="YOUR_API_KEY",
140
+ )
141
+ client.translated_story.get_translated_story_run_info(
142
+ run_id=1,
143
+ target_language=1,
144
+ )
145
+ """
146
+ _response = self._raw_client.get_translated_story_run_info(
147
+ run_id, target_language, include_transcript=include_transcript, request_options=request_options
148
+ )
149
+ return _response.data
150
+
151
+
152
+ class AsyncTranslatedStoryClient:
153
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
154
+ self._raw_client = AsyncRawTranslatedStoryClient(client_wrapper=client_wrapper)
155
+
156
+ @property
157
+ def with_raw_response(self) -> AsyncRawTranslatedStoryClient:
158
+ """
159
+ Retrieves a raw implementation of this client that returns raw responses.
160
+
161
+ Returns
162
+ -------
163
+ AsyncRawTranslatedStoryClient
164
+ """
165
+ return self._raw_client
166
+
167
+ async def create_translation_for_existing_story(
168
+ self,
169
+ run_id: typing.Optional[int],
170
+ *,
171
+ target_language: Languages,
172
+ request_options: typing.Optional[RequestOptions] = None,
173
+ ) -> AddTargetLanguageOut:
174
+ """
175
+ Parameters
176
+ ----------
177
+ run_id : typing.Optional[int]
178
+
179
+ target_language : Languages
180
+
181
+ request_options : typing.Optional[RequestOptions]
182
+ Request-specific configuration.
183
+
184
+ Returns
185
+ -------
186
+ AddTargetLanguageOut
187
+ Successful Response
188
+
189
+ Examples
190
+ --------
191
+ import asyncio
192
+
193
+ from camb import AsyncCambApi
194
+
195
+ client = AsyncCambApi(
196
+ api_key="YOUR_API_KEY",
197
+ )
198
+
199
+
200
+ async def main() -> None:
201
+ await client.translated_story.create_translation_for_existing_story(
202
+ run_id=1,
203
+ target_language=1,
204
+ )
205
+
206
+
207
+ asyncio.run(main())
208
+ """
209
+ _response = await self._raw_client.create_translation_for_existing_story(
210
+ run_id, target_language=target_language, request_options=request_options
211
+ )
212
+ return _response.data
213
+
214
+ async def get_translated_story_status(
215
+ self,
216
+ task_id: str,
217
+ *,
218
+ run_id: typing.Optional[int] = None,
219
+ request_options: typing.Optional[RequestOptions] = None,
220
+ ) -> OrchestratorPipelineResult:
221
+ """
222
+ Parameters
223
+ ----------
224
+ task_id : str
225
+
226
+ run_id : typing.Optional[int]
227
+
228
+ request_options : typing.Optional[RequestOptions]
229
+ Request-specific configuration.
230
+
231
+ Returns
232
+ -------
233
+ OrchestratorPipelineResult
234
+ Successful Response
235
+
236
+ Examples
237
+ --------
238
+ import asyncio
239
+
240
+ from camb import AsyncCambApi
241
+
242
+ client = AsyncCambApi(
243
+ api_key="YOUR_API_KEY",
244
+ )
245
+
246
+
247
+ async def main() -> None:
248
+ await client.translated_story.get_translated_story_status(
249
+ task_id="task_id",
250
+ )
251
+
252
+
253
+ asyncio.run(main())
254
+ """
255
+ _response = await self._raw_client.get_translated_story_status(
256
+ task_id, run_id=run_id, request_options=request_options
257
+ )
258
+ return _response.data
259
+
260
+ async def get_translated_story_run_info(
261
+ self,
262
+ run_id: typing.Optional[int],
263
+ target_language: Languages,
264
+ *,
265
+ include_transcript: typing.Optional[bool] = None,
266
+ request_options: typing.Optional[RequestOptions] = None,
267
+ ) -> typing.Dict[str, typing.Any]:
268
+ """
269
+ Parameters
270
+ ----------
271
+ run_id : typing.Optional[int]
272
+
273
+ target_language : Languages
274
+
275
+ include_transcript : typing.Optional[bool]
276
+ Whether to include the transcription in the response for fetching the result of a Stories Translation run.
277
+
278
+ request_options : typing.Optional[RequestOptions]
279
+ Request-specific configuration.
280
+
281
+ Returns
282
+ -------
283
+ typing.Dict[str, typing.Any]
284
+ Successful Response
285
+
286
+ Examples
287
+ --------
288
+ import asyncio
289
+
290
+ from camb import AsyncCambApi
291
+
292
+ client = AsyncCambApi(
293
+ api_key="YOUR_API_KEY",
294
+ )
295
+
296
+
297
+ async def main() -> None:
298
+ await client.translated_story.get_translated_story_run_info(
299
+ run_id=1,
300
+ target_language=1,
301
+ )
302
+
303
+
304
+ asyncio.run(main())
305
+ """
306
+ _response = await self._raw_client.get_translated_story_run_info(
307
+ run_id, target_language, include_transcript=include_transcript, request_options=request_options
308
+ )
309
+ return _response.data
@@ -0,0 +1,381 @@
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 ..core.api_error import ApiError
7
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
9
+ from ..core.jsonable_encoder import jsonable_encoder
10
+ from ..core.pydantic_utilities import parse_obj_as
11
+ from ..core.request_options import RequestOptions
12
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
13
+ from ..types.add_target_language_out import AddTargetLanguageOut
14
+ from ..types.http_validation_error import HttpValidationError
15
+ from ..types.languages import Languages
16
+ from ..types.orchestrator_pipeline_result import OrchestratorPipelineResult
17
+
18
+ # this is used as the default value for optional parameters
19
+ OMIT = typing.cast(typing.Any, ...)
20
+
21
+
22
+ class RawTranslatedStoryClient:
23
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
24
+ self._client_wrapper = client_wrapper
25
+
26
+ def create_translation_for_existing_story(
27
+ self,
28
+ run_id: typing.Optional[int],
29
+ *,
30
+ target_language: Languages,
31
+ request_options: typing.Optional[RequestOptions] = None,
32
+ ) -> HttpResponse[AddTargetLanguageOut]:
33
+ """
34
+ Parameters
35
+ ----------
36
+ run_id : typing.Optional[int]
37
+
38
+ target_language : Languages
39
+
40
+ request_options : typing.Optional[RequestOptions]
41
+ Request-specific configuration.
42
+
43
+ Returns
44
+ -------
45
+ HttpResponse[AddTargetLanguageOut]
46
+ Successful Response
47
+ """
48
+ _response = self._client_wrapper.httpx_client.request(
49
+ f"translated-story/{jsonable_encoder(run_id)}",
50
+ method="POST",
51
+ json={
52
+ "target_language": target_language,
53
+ },
54
+ headers={
55
+ "content-type": "application/json",
56
+ },
57
+ request_options=request_options,
58
+ omit=OMIT,
59
+ )
60
+ try:
61
+ if 200 <= _response.status_code < 300:
62
+ _data = typing.cast(
63
+ AddTargetLanguageOut,
64
+ parse_obj_as(
65
+ type_=AddTargetLanguageOut, # type: ignore
66
+ object_=_response.json(),
67
+ ),
68
+ )
69
+ return HttpResponse(response=_response, data=_data)
70
+ if _response.status_code == 422:
71
+ raise UnprocessableEntityError(
72
+ headers=dict(_response.headers),
73
+ body=typing.cast(
74
+ HttpValidationError,
75
+ parse_obj_as(
76
+ type_=HttpValidationError, # type: ignore
77
+ object_=_response.json(),
78
+ ),
79
+ ),
80
+ )
81
+ _response_json = _response.json()
82
+ except JSONDecodeError:
83
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
84
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
85
+
86
+ def get_translated_story_status(
87
+ self,
88
+ task_id: str,
89
+ *,
90
+ run_id: typing.Optional[int] = None,
91
+ request_options: typing.Optional[RequestOptions] = None,
92
+ ) -> HttpResponse[OrchestratorPipelineResult]:
93
+ """
94
+ Parameters
95
+ ----------
96
+ task_id : str
97
+
98
+ run_id : typing.Optional[int]
99
+
100
+ request_options : typing.Optional[RequestOptions]
101
+ Request-specific configuration.
102
+
103
+ Returns
104
+ -------
105
+ HttpResponse[OrchestratorPipelineResult]
106
+ Successful Response
107
+ """
108
+ _response = self._client_wrapper.httpx_client.request(
109
+ f"translated-story/{jsonable_encoder(task_id)}",
110
+ method="GET",
111
+ params={
112
+ "run_id": run_id,
113
+ },
114
+ request_options=request_options,
115
+ )
116
+ try:
117
+ if 200 <= _response.status_code < 300:
118
+ _data = typing.cast(
119
+ OrchestratorPipelineResult,
120
+ parse_obj_as(
121
+ type_=OrchestratorPipelineResult, # type: ignore
122
+ object_=_response.json(),
123
+ ),
124
+ )
125
+ return HttpResponse(response=_response, data=_data)
126
+ if _response.status_code == 422:
127
+ raise UnprocessableEntityError(
128
+ headers=dict(_response.headers),
129
+ body=typing.cast(
130
+ HttpValidationError,
131
+ parse_obj_as(
132
+ type_=HttpValidationError, # type: ignore
133
+ object_=_response.json(),
134
+ ),
135
+ ),
136
+ )
137
+ _response_json = _response.json()
138
+ except JSONDecodeError:
139
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
140
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
141
+
142
+ def get_translated_story_run_info(
143
+ self,
144
+ run_id: typing.Optional[int],
145
+ target_language: Languages,
146
+ *,
147
+ include_transcript: typing.Optional[bool] = None,
148
+ request_options: typing.Optional[RequestOptions] = None,
149
+ ) -> HttpResponse[typing.Dict[str, typing.Any]]:
150
+ """
151
+ Parameters
152
+ ----------
153
+ run_id : typing.Optional[int]
154
+
155
+ target_language : Languages
156
+
157
+ include_transcript : typing.Optional[bool]
158
+ Whether to include the transcription in the response for fetching the result of a Stories Translation run.
159
+
160
+ request_options : typing.Optional[RequestOptions]
161
+ Request-specific configuration.
162
+
163
+ Returns
164
+ -------
165
+ HttpResponse[typing.Dict[str, typing.Any]]
166
+ Successful Response
167
+ """
168
+ _response = self._client_wrapper.httpx_client.request(
169
+ f"translated-story-result/{jsonable_encoder(run_id)}/{jsonable_encoder(target_language)}",
170
+ method="GET",
171
+ params={
172
+ "include_transcript": include_transcript,
173
+ },
174
+ request_options=request_options,
175
+ )
176
+ try:
177
+ if 200 <= _response.status_code < 300:
178
+ _data = typing.cast(
179
+ typing.Dict[str, typing.Any],
180
+ parse_obj_as(
181
+ type_=typing.Dict[str, typing.Any], # type: ignore
182
+ object_=_response.json(),
183
+ ),
184
+ )
185
+ return HttpResponse(response=_response, data=_data)
186
+ if _response.status_code == 422:
187
+ raise UnprocessableEntityError(
188
+ headers=dict(_response.headers),
189
+ body=typing.cast(
190
+ HttpValidationError,
191
+ parse_obj_as(
192
+ type_=HttpValidationError, # type: ignore
193
+ object_=_response.json(),
194
+ ),
195
+ ),
196
+ )
197
+ _response_json = _response.json()
198
+ except JSONDecodeError:
199
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
200
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
201
+
202
+
203
+ class AsyncRawTranslatedStoryClient:
204
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
205
+ self._client_wrapper = client_wrapper
206
+
207
+ async def create_translation_for_existing_story(
208
+ self,
209
+ run_id: typing.Optional[int],
210
+ *,
211
+ target_language: Languages,
212
+ request_options: typing.Optional[RequestOptions] = None,
213
+ ) -> AsyncHttpResponse[AddTargetLanguageOut]:
214
+ """
215
+ Parameters
216
+ ----------
217
+ run_id : typing.Optional[int]
218
+
219
+ target_language : Languages
220
+
221
+ request_options : typing.Optional[RequestOptions]
222
+ Request-specific configuration.
223
+
224
+ Returns
225
+ -------
226
+ AsyncHttpResponse[AddTargetLanguageOut]
227
+ Successful Response
228
+ """
229
+ _response = await self._client_wrapper.httpx_client.request(
230
+ f"translated-story/{jsonable_encoder(run_id)}",
231
+ method="POST",
232
+ json={
233
+ "target_language": target_language,
234
+ },
235
+ headers={
236
+ "content-type": "application/json",
237
+ },
238
+ request_options=request_options,
239
+ omit=OMIT,
240
+ )
241
+ try:
242
+ if 200 <= _response.status_code < 300:
243
+ _data = typing.cast(
244
+ AddTargetLanguageOut,
245
+ parse_obj_as(
246
+ type_=AddTargetLanguageOut, # type: ignore
247
+ object_=_response.json(),
248
+ ),
249
+ )
250
+ return AsyncHttpResponse(response=_response, data=_data)
251
+ if _response.status_code == 422:
252
+ raise UnprocessableEntityError(
253
+ headers=dict(_response.headers),
254
+ body=typing.cast(
255
+ HttpValidationError,
256
+ parse_obj_as(
257
+ type_=HttpValidationError, # type: ignore
258
+ object_=_response.json(),
259
+ ),
260
+ ),
261
+ )
262
+ _response_json = _response.json()
263
+ except JSONDecodeError:
264
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
265
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
266
+
267
+ async def get_translated_story_status(
268
+ self,
269
+ task_id: str,
270
+ *,
271
+ run_id: typing.Optional[int] = None,
272
+ request_options: typing.Optional[RequestOptions] = None,
273
+ ) -> AsyncHttpResponse[OrchestratorPipelineResult]:
274
+ """
275
+ Parameters
276
+ ----------
277
+ task_id : str
278
+
279
+ run_id : typing.Optional[int]
280
+
281
+ request_options : typing.Optional[RequestOptions]
282
+ Request-specific configuration.
283
+
284
+ Returns
285
+ -------
286
+ AsyncHttpResponse[OrchestratorPipelineResult]
287
+ Successful Response
288
+ """
289
+ _response = await self._client_wrapper.httpx_client.request(
290
+ f"translated-story/{jsonable_encoder(task_id)}",
291
+ method="GET",
292
+ params={
293
+ "run_id": run_id,
294
+ },
295
+ request_options=request_options,
296
+ )
297
+ try:
298
+ if 200 <= _response.status_code < 300:
299
+ _data = typing.cast(
300
+ OrchestratorPipelineResult,
301
+ parse_obj_as(
302
+ type_=OrchestratorPipelineResult, # type: ignore
303
+ object_=_response.json(),
304
+ ),
305
+ )
306
+ return AsyncHttpResponse(response=_response, data=_data)
307
+ if _response.status_code == 422:
308
+ raise UnprocessableEntityError(
309
+ headers=dict(_response.headers),
310
+ body=typing.cast(
311
+ HttpValidationError,
312
+ parse_obj_as(
313
+ type_=HttpValidationError, # type: ignore
314
+ object_=_response.json(),
315
+ ),
316
+ ),
317
+ )
318
+ _response_json = _response.json()
319
+ except JSONDecodeError:
320
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
321
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
322
+
323
+ async def get_translated_story_run_info(
324
+ self,
325
+ run_id: typing.Optional[int],
326
+ target_language: Languages,
327
+ *,
328
+ include_transcript: typing.Optional[bool] = None,
329
+ request_options: typing.Optional[RequestOptions] = None,
330
+ ) -> AsyncHttpResponse[typing.Dict[str, typing.Any]]:
331
+ """
332
+ Parameters
333
+ ----------
334
+ run_id : typing.Optional[int]
335
+
336
+ target_language : Languages
337
+
338
+ include_transcript : typing.Optional[bool]
339
+ Whether to include the transcription in the response for fetching the result of a Stories Translation run.
340
+
341
+ request_options : typing.Optional[RequestOptions]
342
+ Request-specific configuration.
343
+
344
+ Returns
345
+ -------
346
+ AsyncHttpResponse[typing.Dict[str, typing.Any]]
347
+ Successful Response
348
+ """
349
+ _response = await self._client_wrapper.httpx_client.request(
350
+ f"translated-story-result/{jsonable_encoder(run_id)}/{jsonable_encoder(target_language)}",
351
+ method="GET",
352
+ params={
353
+ "include_transcript": include_transcript,
354
+ },
355
+ request_options=request_options,
356
+ )
357
+ try:
358
+ if 200 <= _response.status_code < 300:
359
+ _data = typing.cast(
360
+ typing.Dict[str, typing.Any],
361
+ parse_obj_as(
362
+ type_=typing.Dict[str, typing.Any], # type: ignore
363
+ object_=_response.json(),
364
+ ),
365
+ )
366
+ return AsyncHttpResponse(response=_response, data=_data)
367
+ if _response.status_code == 422:
368
+ raise UnprocessableEntityError(
369
+ headers=dict(_response.headers),
370
+ body=typing.cast(
371
+ HttpValidationError,
372
+ parse_obj_as(
373
+ type_=HttpValidationError, # type: ignore
374
+ object_=_response.json(),
375
+ ),
376
+ ),
377
+ )
378
+ _response_json = _response.json()
379
+ except JSONDecodeError:
380
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
381
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
@@ -0,0 +1,4 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+