Skip to content

Commit cfac469

Browse files
authored
REVAI-3855: Update python sdk to support Super API (#105)
* /REVAI-3855: Update python sdk to support Super API https://revinc.atlassian.net/browse/REVAI-3855
1 parent 985fdcf commit cfac469

17 files changed

+1011
-14
lines changed

HISTORY.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,8 @@ History
109109
2.18.0
110110
------------------
111111
* Add atmospherics and speaker_count support
112-
* Deprecated support for Python versions up to 3.8
112+
* Deprecated support for Python versions up to 3.8
113+
114+
2.19.0
115+
------------------
116+
* Add async translation and summarization

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,30 @@ and `custom_vocabulary_id` as optional parameters.
5757

5858
The url submission option also supports authentication headers by using the `source_config` option.
5959

60+
You can request transcript summary.
61+
62+
```python
63+
# submitting a human transcription jobs
64+
job = client.submit_job_url("https://example.com/file-to-transcribe.mp3",
65+
language='en',
66+
summarization_config=SummarizationOptions(
67+
formatting_type=SummarizationFormattingOptions.BULLETS
68+
))
69+
```
70+
71+
You can request transcript translation into up to five languages.
72+
73+
```javascript
74+
job = client.submit_job_url("https://example.com/file-to-transcribe.mp3",
75+
language='en',
76+
translation_config=TranslationOptions(
77+
target_languages: [
78+
TranslationLanguageOptions("es", NlpModel.PREMIUM),
79+
TranslationLanguageOptions("de")
80+
]
81+
));
82+
```
83+
6084
All options are described in the request body of the
6185
[Submit Job](https://docs.rev.ai/api/asynchronous/reference/#operation/SubmitTranscriptionJob) endpoint.
6286

@@ -131,20 +155,42 @@ transcript_json = client.get_transcript_json(job.id)
131155

132156
# or as a python object
133157
transcript_object = client.get_transcript_object(job.id)
158+
159+
# or if you requested transcript translation(s)
160+
transcript_object = client.get_translated_transcript_object(job.id,'es')
134161
```
135162

136163
Both the json and object forms contain all the formation outlined in the response
137164
of the [Get Transcript](https://docs.rev.ai/api/asynchronous/reference/#operation/GetTranscriptById) endpoint
138165
when using the json response schema. While the text output is a string containing
139166
just the text of your transcript
140167

168+
### Getting transcript summary
169+
170+
If you requested transcript summary, you can retrieve it as plain text or structured object:
171+
172+
```python
173+
# as text
174+
summary = client.get_transcript_summary_text(job.id)
175+
176+
# as json
177+
summary = client.get_transcript_summary_json(job.id)
178+
179+
# or as a python object
180+
summary = client.get_transcript_summary_object(job.id)
181+
182+
```
141183
### Getting captions output
142184

143185
You can also get captions output from the SDK. We offer both SRT and VTT caption formats.
144186
If you submitted your job as speaker channel audio then you must also provide a `channel_id` to be captioned:
145187

146188
```python
147189
captions = client.get_captions(job.id, content_type=CaptionType.SRT, channel_id=None)
190+
191+
# or if you requested transcript translation(s)
192+
captions = client.get_translated_captions(job.id, 'es')
193+
148194
```
149195

150196
### Streamed outputs

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 2.18.0
2+
current_version = 2.19.0
33
commit = True
44
tag = True
55

src/rev_ai/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
"""Top-level package for rev_ai"""
33

4-
__version__ = '2.18.0'
4+
__version__ = '2.19.0'
55

66
from .models import Job, JobStatus, Account, Transcript, Monologue, Element, MediaConfig, \
77
CaptionType, CustomVocabulary, TopicExtractionJob, TopicExtractionResult, Topic, Informant, \

0 commit comments

Comments
 (0)