From c8c637e9390fb5a12195c3146a24c956ae61ac3b Mon Sep 17 00:00:00 2001 From: Oliver Lazoroski Date: Mon, 28 Oct 2024 12:38:35 +0100 Subject: [PATCH] docs: add code samples for multi language transcriptions --- .../api/transcription/transcribing_calls.mdx | 135 +++++++++++++++++- 1 file changed, 134 insertions(+), 1 deletion(-) diff --git a/docusaurus/video/docusaurus/docs/api/transcription/transcribing_calls.mdx b/docusaurus/video/docusaurus/docs/api/transcription/transcribing_calls.mdx index 55704b6f..ea1d6b3c 100644 --- a/docusaurus/video/docusaurus/docs/api/transcription/transcribing_calls.mdx +++ b/docusaurus/video/docusaurus/docs/api/transcription/transcribing_calls.mdx @@ -5,6 +5,7 @@ slug: /transcribing/calls title: Call Transcriptions --- + import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; @@ -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. + + + +```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(); +``` + + + + +```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() +``` + + + +```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) +``` + + + +```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" +``` + + + ## Supported languages - English (en) - default