Skip to content

Commit

Permalink
REVAI-3855: Update python sdk to support Super API (#105)
Browse files Browse the repository at this point in the history
* /REVAI-3855: Update python sdk to support Super API
https://revinc.atlassian.net/browse/REVAI-3855
  • Loading branch information
kirillatrev authored Dec 21, 2023
1 parent 985fdcf commit cfac469
Show file tree
Hide file tree
Showing 17 changed files with 1,011 additions and 14 deletions.
6 changes: 5 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,8 @@ History
2.18.0
------------------
* Add atmospherics and speaker_count support
* Deprecated support for Python versions up to 3.8
* Deprecated support for Python versions up to 3.8

2.19.0
------------------
* Add async translation and summarization
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,30 @@ and `custom_vocabulary_id` as optional parameters.

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

You can request transcript summary.

```python
# submitting a human transcription jobs
job = client.submit_job_url("https://example.com/file-to-transcribe.mp3",
language='en',
summarization_config=SummarizationOptions(
formatting_type=SummarizationFormattingOptions.BULLETS
))
```

You can request transcript translation into up to five languages.

```javascript
job = client.submit_job_url("https://example.com/file-to-transcribe.mp3",
language='en',
translation_config=TranslationOptions(
target_languages: [
TranslationLanguageOptions("es", NlpModel.PREMIUM),
TranslationLanguageOptions("de")
]
));
```

All options are described in the request body of the
[Submit Job](https://docs.rev.ai/api/asynchronous/reference/#operation/SubmitTranscriptionJob) endpoint.

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

# or as a python object
transcript_object = client.get_transcript_object(job.id)

# or if you requested transcript translation(s)
transcript_object = client.get_translated_transcript_object(job.id,'es')
```

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

### Getting transcript summary

If you requested transcript summary, you can retrieve it as plain text or structured object:

```python
# as text
summary = client.get_transcript_summary_text(job.id)

# as json
summary = client.get_transcript_summary_json(job.id)

# or as a python object
summary = client.get_transcript_summary_object(job.id)

```
### Getting captions output

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

```python
captions = client.get_captions(job.id, content_type=CaptionType.SRT, channel_id=None)

# or if you requested transcript translation(s)
captions = client.get_translated_captions(job.id, 'es')

```

### Streamed outputs
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 2.18.0
current_version = 2.19.0
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion src/rev_ai/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Top-level package for rev_ai"""

__version__ = '2.18.0'
__version__ = '2.19.0'

from .models import Job, JobStatus, Account, Transcript, Monologue, Element, MediaConfig, \
CaptionType, CustomVocabulary, TopicExtractionJob, TopicExtractionResult, Topic, Informant, \
Expand Down
Loading

0 comments on commit cfac469

Please sign in to comment.