Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add code samples for multi language transcriptions #813

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ slug: /transcribing/calls
title: Call Transcriptions
---


import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

Expand Down Expand Up @@ -437,11 +438,143 @@ call.update({

When using out of the box, transcriptions are optimized for calls with english speakers. You can configure call transcription to optimize for a different language than english. You can also specify as secondary language as well if you expect to have two languages used simultaneously in the same call.

Please note: the call transcription feature does not perform any language translation. When you select a different language, the trascription process will simply improve the speech-to-text detection for that language.
Please note: the call transcription feature does not perform any language translation. When you select a different language, the transcription process will simply improve the speech-to-text detection for that language.

You can set the transcription languages in two ways: either as a call setting or you can provide them to the `StartTranscription` API call. Languages are specified using their international language code (ISO639)
Please note: we currently don’t support changing language settings during the call.

<Tabs groupId="examples">
<TabItem value="js" label="JavaScript">

```js
call.getOrCreate({
data: {
settings_override: {
transcription: {
mode: 'available',
languages: ['en', 'it']
},
},
},
});

// or
call.update({
settings_override: {
transcription: {
mode: 'available',
languages: ['en', 'it']
},
},
});

// then
call.startTranscription();
```

</TabItem>
<TabItem value="py" label="Python">

```py
from getstream.models import CallSettingsRequest, TranscriptionSettingsRequest

call.get_or_create(
data=CallRequest(
settings_override=CallSettingsRequest(
transcription=TranscriptionSettingsRequest(
mode='available',
languages=['en', 'it'],
),
),
),
)

# or
call.update(
settings_override=CallSettingsRequest(
transcription=TranscriptionSettingsRequest(
mode='available',
languages=['en', 'it'],
),
),
)

# then
call.start_transcription()
```
</TabItem>
<TabItem value="go" label="Golang">

```go
import (
"github.com/GetStream/getstream-go"
)

call.GetOrCreate(ctx, &getstream.GetOrCreateCallRequest{
Data: &getstream.CallRequest{
SettingsOverride: &getstream.CallSettings{
Transcriptions: &getstream.TranscriptionSettings{
Mode: "available",
Languages: []string{"en", "it"},
},
},
},
})

// or
call.Update(ctx, &getstream.UpdateCallRequest{
SettingsOverride: &getstream.CallSettings{
Transcriptions: &getstream.TranscriptionSettings{
Mode: "available",
Languages: []string{"en", "it"},
},
},
})

// then
call.StartTranscription(ctx, nil)
```
</TabItem>
<TabItem value="curl" label="cURL">

```bash
curl -X POST "https://video.stream-io-api.com/api/v2/video/call/${CALL_TYPE_NAME}/${CALL_ID}?api_key=${API_KEY}" \
-H "Authorization: ${TOKEN}" \
-H "stream-auth-type: jwt" \
-H "Content-Type: application/json" \
-d '{
"data": {
"settings_override": {
"transcription": {
"mode": "available",
"languages": ["en", "it"]
}
}
}
}'

# or
curl -X PATCH "https://video.stream-io-api.com/api/v2/video/call/${CALL_TYPE_NAME}/${CALL_ID}?api_key=${API_KEY}" \
-H "Authorization: ${TOKEN}" \
-H "stream-auth-type: jwt" \
-H "Content-Type: application/json" \
-d '{
"settings_override": {
"transcription": {
"mode": "available",
"languages": ["en", "it"]
}
}
}'

# then
curl -X POST "https://video.stream-io-api.com/api/v2/video/call/default/${CALL_ID}/start_transcription?api_key=${API_KEY}"\
-H "Authorization: ${TOKEN}" \
-H "stream-auth-type: jwt"
```
</TabItem>
</Tabs>

## Supported languages

- English (en) - default
Expand Down
Loading