Skip to content

Commit

Permalink
docs: add code samples for multi language transcriptions (#813)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbarbugli authored Oct 29, 2024
2 parents f1975c0 + c8c637e commit 2f92310
Showing 1 changed file with 134 additions and 1 deletion.
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

0 comments on commit 2f92310

Please sign in to comment.