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,465 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from .. import core
6
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
7
+ from ..core.request_options import RequestOptions
8
+ from ..types.languages import Languages
9
+ from ..types.orchestrator_pipeline_call_result import OrchestratorPipelineCallResult
10
+ from ..types.orchestrator_pipeline_result import OrchestratorPipelineResult
11
+ from ..types.transcription_result import TranscriptionResult
12
+ from .raw_client import AsyncRawTranscriptionClient, RawTranscriptionClient
13
+
14
+ # this is used as the default value for optional parameters
15
+ OMIT = typing.cast(typing.Any, ...)
16
+
17
+
18
+ class TranscriptionClient:
19
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
20
+ self._raw_client = RawTranscriptionClient(client_wrapper=client_wrapper)
21
+
22
+ @property
23
+ def with_raw_response(self) -> RawTranscriptionClient:
24
+ """
25
+ Retrieves a raw implementation of this client that returns raw responses.
26
+
27
+ Returns
28
+ -------
29
+ RawTranscriptionClient
30
+ """
31
+ return self._raw_client
32
+
33
+ def create_transcription(
34
+ self,
35
+ *,
36
+ language: Languages,
37
+ run_id: typing.Optional[int] = None,
38
+ media_file: typing.Optional[core.File] = OMIT,
39
+ media_url: typing.Optional[str] = OMIT,
40
+ file: typing.Optional[core.File] = OMIT,
41
+ audio_url: typing.Optional[str] = OMIT,
42
+ project_name: typing.Optional[str] = OMIT,
43
+ project_description: typing.Optional[str] = OMIT,
44
+ folder_id: typing.Optional[int] = OMIT,
45
+ request_options: typing.Optional[RequestOptions] = None,
46
+ ) -> OrchestratorPipelineCallResult:
47
+ """
48
+ Parameters
49
+ ----------
50
+ language : Languages
51
+ Signed URL to audio file for transcription
52
+
53
+ run_id : typing.Optional[int]
54
+
55
+ media_file : typing.Optional[core.File]
56
+ See core.File for more documentation
57
+
58
+ media_url : typing.Optional[str]
59
+ Signed URL to media file for transcription
60
+
61
+ file : typing.Optional[core.File]
62
+ See core.File for more documentation
63
+
64
+ audio_url : typing.Optional[str]
65
+ [DEPRECATED] Use 'audio_url' instead
66
+
67
+ project_name : typing.Optional[str]
68
+
69
+ project_description : typing.Optional[str]
70
+
71
+ folder_id : typing.Optional[int]
72
+
73
+ request_options : typing.Optional[RequestOptions]
74
+ Request-specific configuration.
75
+
76
+ Returns
77
+ -------
78
+ OrchestratorPipelineCallResult
79
+ Successful Response
80
+
81
+ Examples
82
+ --------
83
+ from camb import CambApi
84
+
85
+ client = CambApi(
86
+ api_key="YOUR_API_KEY",
87
+ )
88
+ client.transcription.create_transcription(
89
+ language=1,
90
+ )
91
+ """
92
+ _response = self._raw_client.create_transcription(
93
+ language=language,
94
+ run_id=run_id,
95
+ media_file=media_file,
96
+ media_url=media_url,
97
+ file=file,
98
+ audio_url=audio_url,
99
+ project_name=project_name,
100
+ project_description=project_description,
101
+ folder_id=folder_id,
102
+ request_options=request_options,
103
+ )
104
+ return _response.data
105
+
106
+ def get_transcription_task_status(
107
+ self,
108
+ task_id: str,
109
+ *,
110
+ run_id: typing.Optional[int] = None,
111
+ request_options: typing.Optional[RequestOptions] = None,
112
+ ) -> OrchestratorPipelineResult:
113
+ """
114
+ Parameters
115
+ ----------
116
+ task_id : str
117
+
118
+ run_id : typing.Optional[int]
119
+
120
+ request_options : typing.Optional[RequestOptions]
121
+ Request-specific configuration.
122
+
123
+ Returns
124
+ -------
125
+ OrchestratorPipelineResult
126
+ Successful Response
127
+
128
+ Examples
129
+ --------
130
+ from camb import CambApi
131
+
132
+ client = CambApi(
133
+ api_key="YOUR_API_KEY",
134
+ )
135
+ client.transcription.get_transcription_task_status(
136
+ task_id="task_id",
137
+ )
138
+ """
139
+ _response = self._raw_client.get_transcription_task_status(
140
+ task_id, run_id=run_id, request_options=request_options
141
+ )
142
+ return _response.data
143
+
144
+ def get_transcription_result(
145
+ self,
146
+ run_id: typing.Optional[int],
147
+ *,
148
+ word_level_timestamps: typing.Optional[bool] = None,
149
+ request_options: typing.Optional[RequestOptions] = None,
150
+ ) -> TranscriptionResult:
151
+ """
152
+ NOTE: This endpoint should be called only by the users to get values for their runs via API.
153
+ Further we need to validate if the user has access to the run_id, otherwise we should not return the output urls.
154
+
155
+ Parameters
156
+ ----------
157
+ run_id : typing.Optional[int]
158
+
159
+ word_level_timestamps : typing.Optional[bool]
160
+
161
+ request_options : typing.Optional[RequestOptions]
162
+ Request-specific configuration.
163
+
164
+ Returns
165
+ -------
166
+ TranscriptionResult
167
+ Successful Response
168
+
169
+ Examples
170
+ --------
171
+ from camb import CambApi
172
+
173
+ client = CambApi(
174
+ api_key="YOUR_API_KEY",
175
+ )
176
+ client.transcription.get_transcription_result(
177
+ run_id=1,
178
+ )
179
+ """
180
+ _response = self._raw_client.get_transcription_result(
181
+ run_id, word_level_timestamps=word_level_timestamps, request_options=request_options
182
+ )
183
+ return _response.data
184
+
185
+ def get_transcription_results(
186
+ self,
187
+ *,
188
+ run_ids: typing.Sequence[int],
189
+ run_id: typing.Optional[int] = None,
190
+ traceparent: typing.Optional[str] = None,
191
+ request_options: typing.Optional[RequestOptions] = None,
192
+ ) -> typing.Dict[str, TranscriptionResult]:
193
+ """
194
+ Parameters
195
+ ----------
196
+ run_ids : typing.Sequence[int]
197
+
198
+ run_id : typing.Optional[int]
199
+
200
+ traceparent : typing.Optional[str]
201
+
202
+ request_options : typing.Optional[RequestOptions]
203
+ Request-specific configuration.
204
+
205
+ Returns
206
+ -------
207
+ typing.Dict[str, TranscriptionResult]
208
+ Successful Response
209
+
210
+ Examples
211
+ --------
212
+ from camb import CambApi
213
+
214
+ client = CambApi(
215
+ api_key="YOUR_API_KEY",
216
+ )
217
+ client.transcription.get_transcription_results(
218
+ run_ids=[1],
219
+ )
220
+ """
221
+ _response = self._raw_client.get_transcription_results(
222
+ run_ids=run_ids, run_id=run_id, traceparent=traceparent, request_options=request_options
223
+ )
224
+ return _response.data
225
+
226
+
227
+ class AsyncTranscriptionClient:
228
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
229
+ self._raw_client = AsyncRawTranscriptionClient(client_wrapper=client_wrapper)
230
+
231
+ @property
232
+ def with_raw_response(self) -> AsyncRawTranscriptionClient:
233
+ """
234
+ Retrieves a raw implementation of this client that returns raw responses.
235
+
236
+ Returns
237
+ -------
238
+ AsyncRawTranscriptionClient
239
+ """
240
+ return self._raw_client
241
+
242
+ async def create_transcription(
243
+ self,
244
+ *,
245
+ language: Languages,
246
+ run_id: typing.Optional[int] = None,
247
+ media_file: typing.Optional[core.File] = OMIT,
248
+ media_url: typing.Optional[str] = OMIT,
249
+ file: typing.Optional[core.File] = OMIT,
250
+ audio_url: typing.Optional[str] = OMIT,
251
+ project_name: typing.Optional[str] = OMIT,
252
+ project_description: typing.Optional[str] = OMIT,
253
+ folder_id: typing.Optional[int] = OMIT,
254
+ request_options: typing.Optional[RequestOptions] = None,
255
+ ) -> OrchestratorPipelineCallResult:
256
+ """
257
+ Parameters
258
+ ----------
259
+ language : Languages
260
+ Signed URL to audio file for transcription
261
+
262
+ run_id : typing.Optional[int]
263
+
264
+ media_file : typing.Optional[core.File]
265
+ See core.File for more documentation
266
+
267
+ media_url : typing.Optional[str]
268
+ Signed URL to media file for transcription
269
+
270
+ file : typing.Optional[core.File]
271
+ See core.File for more documentation
272
+
273
+ audio_url : typing.Optional[str]
274
+ [DEPRECATED] Use 'audio_url' instead
275
+
276
+ project_name : typing.Optional[str]
277
+
278
+ project_description : typing.Optional[str]
279
+
280
+ folder_id : typing.Optional[int]
281
+
282
+ request_options : typing.Optional[RequestOptions]
283
+ Request-specific configuration.
284
+
285
+ Returns
286
+ -------
287
+ OrchestratorPipelineCallResult
288
+ Successful Response
289
+
290
+ Examples
291
+ --------
292
+ import asyncio
293
+
294
+ from camb import AsyncCambApi
295
+
296
+ client = AsyncCambApi(
297
+ api_key="YOUR_API_KEY",
298
+ )
299
+
300
+
301
+ async def main() -> None:
302
+ await client.transcription.create_transcription(
303
+ language=1,
304
+ )
305
+
306
+
307
+ asyncio.run(main())
308
+ """
309
+ _response = await self._raw_client.create_transcription(
310
+ language=language,
311
+ run_id=run_id,
312
+ media_file=media_file,
313
+ media_url=media_url,
314
+ file=file,
315
+ audio_url=audio_url,
316
+ project_name=project_name,
317
+ project_description=project_description,
318
+ folder_id=folder_id,
319
+ request_options=request_options,
320
+ )
321
+ return _response.data
322
+
323
+ async def get_transcription_task_status(
324
+ self,
325
+ task_id: str,
326
+ *,
327
+ run_id: typing.Optional[int] = None,
328
+ request_options: typing.Optional[RequestOptions] = None,
329
+ ) -> OrchestratorPipelineResult:
330
+ """
331
+ Parameters
332
+ ----------
333
+ task_id : str
334
+
335
+ run_id : typing.Optional[int]
336
+
337
+ request_options : typing.Optional[RequestOptions]
338
+ Request-specific configuration.
339
+
340
+ Returns
341
+ -------
342
+ OrchestratorPipelineResult
343
+ Successful Response
344
+
345
+ Examples
346
+ --------
347
+ import asyncio
348
+
349
+ from camb import AsyncCambApi
350
+
351
+ client = AsyncCambApi(
352
+ api_key="YOUR_API_KEY",
353
+ )
354
+
355
+
356
+ async def main() -> None:
357
+ await client.transcription.get_transcription_task_status(
358
+ task_id="task_id",
359
+ )
360
+
361
+
362
+ asyncio.run(main())
363
+ """
364
+ _response = await self._raw_client.get_transcription_task_status(
365
+ task_id, run_id=run_id, request_options=request_options
366
+ )
367
+ return _response.data
368
+
369
+ async def get_transcription_result(
370
+ self,
371
+ run_id: typing.Optional[int],
372
+ *,
373
+ word_level_timestamps: typing.Optional[bool] = None,
374
+ request_options: typing.Optional[RequestOptions] = None,
375
+ ) -> TranscriptionResult:
376
+ """
377
+ NOTE: This endpoint should be called only by the users to get values for their runs via API.
378
+ Further we need to validate if the user has access to the run_id, otherwise we should not return the output urls.
379
+
380
+ Parameters
381
+ ----------
382
+ run_id : typing.Optional[int]
383
+
384
+ word_level_timestamps : typing.Optional[bool]
385
+
386
+ request_options : typing.Optional[RequestOptions]
387
+ Request-specific configuration.
388
+
389
+ Returns
390
+ -------
391
+ TranscriptionResult
392
+ Successful Response
393
+
394
+ Examples
395
+ --------
396
+ import asyncio
397
+
398
+ from camb import AsyncCambApi
399
+
400
+ client = AsyncCambApi(
401
+ api_key="YOUR_API_KEY",
402
+ )
403
+
404
+
405
+ async def main() -> None:
406
+ await client.transcription.get_transcription_result(
407
+ run_id=1,
408
+ )
409
+
410
+
411
+ asyncio.run(main())
412
+ """
413
+ _response = await self._raw_client.get_transcription_result(
414
+ run_id, word_level_timestamps=word_level_timestamps, request_options=request_options
415
+ )
416
+ return _response.data
417
+
418
+ async def get_transcription_results(
419
+ self,
420
+ *,
421
+ run_ids: typing.Sequence[int],
422
+ run_id: typing.Optional[int] = None,
423
+ traceparent: typing.Optional[str] = None,
424
+ request_options: typing.Optional[RequestOptions] = None,
425
+ ) -> typing.Dict[str, TranscriptionResult]:
426
+ """
427
+ Parameters
428
+ ----------
429
+ run_ids : typing.Sequence[int]
430
+
431
+ run_id : typing.Optional[int]
432
+
433
+ traceparent : typing.Optional[str]
434
+
435
+ request_options : typing.Optional[RequestOptions]
436
+ Request-specific configuration.
437
+
438
+ Returns
439
+ -------
440
+ typing.Dict[str, TranscriptionResult]
441
+ Successful Response
442
+
443
+ Examples
444
+ --------
445
+ import asyncio
446
+
447
+ from camb import AsyncCambApi
448
+
449
+ client = AsyncCambApi(
450
+ api_key="YOUR_API_KEY",
451
+ )
452
+
453
+
454
+ async def main() -> None:
455
+ await client.transcription.get_transcription_results(
456
+ run_ids=[1],
457
+ )
458
+
459
+
460
+ asyncio.run(main())
461
+ """
462
+ _response = await self._raw_client.get_transcription_results(
463
+ run_ids=run_ids, run_id=run_id, traceparent=traceparent, request_options=request_options
464
+ )
465
+ return _response.data