@@ -141,23 +141,26 @@ Identify the dominant language spoken in an audio file and use it during the tra
141141
142142<CodeBlocks >
143143
144- ``` python title="Python SDK" for="python-sdk" highlight={8 } maxLines=15
144+ ``` python title="Python SDK" for="python-sdk" highlight={16 } maxLines=15
145145import assemblyai as aai
146146
147147aai.settings.api_key = " <YOUR_API_KEY>"
148148
149149# audio_file = "./local_file.mp3"
150150audio_file = " https://assembly.ai/wildfires.mp3"
151151
152- config = aai.TranscriptionConfig(language_detection = True )
152+ config = aai.TranscriptionConfig(
153+ speech_models = [" universal-3-pro" , " universal-2" ],
154+ language_detection = True
155+ )
153156
154157transcript = aai.Transcriber(config = config).transcribe(audio_file)
155158
156159print (transcript.text)
157160print (transcript.json_response[" language_code" ])
158161```
159162
160- ``` python title="Python" for="python" highlight={19 } maxLines=15
163+ ``` python title="Python" for="python" highlight={21 } maxLines=15
161164import requests
162165import time
163166
@@ -176,6 +179,7 @@ upload_url = response.json()["upload_url"]
176179
177180data = {
178181 " audio_url" : upload_url, # You can also use a URL to an audio or video file on the web
182+ " speech_models" : [" universal-3-pro" , " universal-2" ],
179183 " language_detection" : True ,
180184}
181185
@@ -202,7 +206,7 @@ while True:
202206
203207```
204208
205- ``` javascript title="JavaScript SDK" for="javascript-sdk" highlight={12 } maxLines=15
209+ ``` javascript title="JavaScript SDK" for="javascript-sdk" highlight={14 } maxLines=15
206210import { AssemblyAI } from " assemblyai" ;
207211
208212const client = new AssemblyAI ({
@@ -214,6 +218,7 @@ const audioFile = "https://assembly.ai/wildfires.mp3";
214218
215219const params = {
216220 audio: audioFile,
221+ speech_models: [" universal-3-pro" , " universal-2" ],
217222 language_detection: true ,
218223};
219224
@@ -227,7 +232,7 @@ const run = async () => {
227232run ();
228233```
229234
230- ``` javascript title="JavaScript" for="javascript" highlight={19 } maxLines=15
235+ ``` javascript title="JavaScript" for="javascript" highlight={21 } maxLines=15
231236import axios from " axios" ;
232237import fs from " fs-extra" ;
233238
@@ -246,6 +251,7 @@ const uploadUrl = uploadResponse.data.upload_url;
246251
247252const data = {
248253 audio_url: uploadUrl, // You can also use a URL to an audio or video file on the web
254+ speech_models: [" universal-3-pro" , " universal-2" ],
249255 language_detection: true ,
250256};
251257
@@ -284,7 +290,7 @@ If you're confident the audio is in one of a few languages, provide that list vi
284290
285291<CodeBlocks >
286292
287- ``` python title="Python SDK" for="python-sdk" highlight={9 } maxLines=15
293+ ``` python title="Python SDK" for="python-sdk" highlight={15 } maxLines=15
288294import assemblyai as aai
289295
290296aai.settings.api_key = " <YOUR_API_KEY>"
@@ -297,15 +303,19 @@ options = aai.LanguageDetectionOptions(
297303 fallback_language = " auto"
298304)
299305
300- config = aai.TranscriptionConfig(language_detection = True , language_detection_options = options)
306+ config = aai.TranscriptionConfig(
307+ speech_models = [" universal-3-pro" , " universal-2" ],
308+ language_detection = True ,
309+ language_detection_options = options
310+ )
301311
302312transcript = aai.Transcriber(config = config).transcribe(audio_file)
303313
304314print (transcript.text)
305315print (transcript.json_response[" language_code" ])
306316```
307317
308- ``` python title="Python" for="python" highlight={21 } maxLines=15
318+ ``` python title="Python" for="python" highlight={23 } maxLines=15
309319import requests
310320import time
311321
@@ -324,6 +334,7 @@ upload_url = response.json()["upload_url"]
324334
325335data = {
326336 " audio_url" : upload_url, # You can also use a URL to an audio or video file on the web
337+ " speech_models" : [" universal-3-pro" , " universal-2" ],
327338 " language_detection" : True ,
328339 " language_detection_options" : {
329340 " expected_languages" : [" en" , " es" , " fr" , " de" ],
@@ -354,7 +365,7 @@ while True:
354365
355366```
356367
357- ``` javascript title="JavaScript SDK" for="javascript-sdk" highlight={14 } maxLines=15
368+ ``` javascript title="JavaScript SDK" for="javascript-sdk" highlight={16 } maxLines=15
358369import { AssemblyAI } from " assemblyai" ;
359370
360371const client = new AssemblyAI ({
@@ -366,6 +377,7 @@ const audioFile = "https://assembly.ai/wildfires.mp3";
366377
367378const params = {
368379 audio: audioFile,
380+ speech_models: [" universal-3-pro" , " universal-2" ],
369381 language_detection: true ,
370382 language_detection_options: {
371383 expected_languages: [" en" , " es" , " fr" , " de" ],
@@ -383,7 +395,7 @@ const run = async () => {
383395run ();
384396```
385397
386- ``` javascript title="JavaScript" for="javascript" highlight={21 } maxLines=15
398+ ``` javascript title="JavaScript" for="javascript" highlight={23 } maxLines=15
387399import axios from " axios" ;
388400import fs from " fs-extra" ;
389401
@@ -402,6 +414,7 @@ const uploadUrl = uploadResponse.data.upload_url;
402414
403415const data = {
404416 audio_url: uploadUrl, // You can also use a URL to an audio or video file on the web
417+ speech_models: [" universal-3-pro" , " universal-2" ],
405418 language_detection: true ,
406419 language_detection_options: {
407420 expected_languages: [" en" , " es" , " fr" , " de" ],
@@ -445,7 +458,7 @@ Control what language transcription should fall back to when detection cannot co
445458
446459<CodeBlocks >
447460
448- ``` python title="Python SDK" for="python-sdk" highlight={10 } maxLines=15
461+ ``` python title="Python SDK" for="python-sdk" highlight={16 } maxLines=15
449462import assemblyai as aai
450463
451464aai.settings.api_key = " <YOUR_API_KEY>"
@@ -458,15 +471,19 @@ options = aai.LanguageDetectionOptions(
458471 fallback_language = " auto"
459472)
460473
461- config = aai.TranscriptionConfig(language_detection = True , language_detection_options = options)
474+ config = aai.TranscriptionConfig(
475+ speech_models = [" universal-3-pro" , " universal-2" ],
476+ language_detection = True ,
477+ language_detection_options = options
478+ )
462479
463480transcript = aai.Transcriber(config = config).transcribe(audio_file)
464481
465482print (transcript.text)
466483print (transcript.json_response[" language_code" ])
467484```
468485
469- ``` python title="Python" for="python" highlight={22 } maxLines=15
486+ ``` python title="Python" for="python" highlight={23 } maxLines=15
470487import requests
471488import time
472489
@@ -485,6 +502,7 @@ upload_url = response.json()["upload_url"]
485502
486503data = {
487504 " audio_url" : upload_url, # You can also use a URL to an audio or video file on the web
505+ " speech_models" : [" universal-3-pro" , " universal-2" ],
488506 " language_detection" : True ,
489507 " language_detection_options" : {
490508 " expected_languages" : [" en" , " es" , " fr" , " de" ],
@@ -515,7 +533,7 @@ while True:
515533
516534```
517535
518- ``` javascript title="JavaScript SDK" for="javascript-sdk" highlight={15 } maxLines=15
536+ ``` javascript title="JavaScript SDK" for="javascript-sdk" highlight={16 } maxLines=15
519537import { AssemblyAI } from " assemblyai" ;
520538
521539const client = new AssemblyAI ({
@@ -527,6 +545,7 @@ const audioFile = "https://assembly.ai/wildfires.mp3";
527545
528546const params = {
529547 audio: audioFile,
548+ speech_models: [" universal-3-pro" , " universal-2" ],
530549 language_detection: true ,
531550 language_detection_options: {
532551 expected_languages: [" en" , " es" , " fr" , " de" ],
@@ -544,7 +563,7 @@ const run = async () => {
544563run ();
545564```
546565
547- ``` javascript title="JavaScript" for="javascript" highlight={22 } maxLines=15
566+ ``` javascript title="JavaScript" for="javascript" highlight={23 } maxLines=15
548567import axios from " axios" ;
549568import fs from " fs-extra" ;
550569
@@ -563,6 +582,7 @@ const uploadUrl = uploadResponse.data.upload_url;
563582
564583const data = {
565584 audio_url: uploadUrl, // You can also use a URL to an audio or video file on the web
585+ speech_models: [" universal-3-pro" , " universal-2" ],
566586 language_detection: true ,
567587 language_detection_options: {
568588 expected_languages: [" en" , " es" , " fr" , " de" ],
@@ -602,23 +622,26 @@ If language detection is enabled, the API returns a confidence score for the det
602622
603623<CodeBlocks >
604624
605- ``` python title="Python SDK" for="python-sdk" highlight={8,13 } maxLines=15
625+ ``` python title="Python SDK" for="python-sdk" highlight={10,16 } maxLines=15
606626import assemblyai as aai
607627
608628aai.settings.api_key = " <YOUR_API_KEY>"
609629
610630# audio_file = "./local_file.mp3"
611631audio_file = " https://assembly.ai/wildfires.mp3"
612632
613- config = aai.TranscriptionConfig(language_detection = True )
633+ config = aai.TranscriptionConfig(
634+ speech_models = [" universal-3-pro" , " universal-2" ],
635+ language_detection = True
636+ )
614637
615638transcript = aai.Transcriber(config = config).transcribe(audio_file)
616639
617640print (transcript.text)
618641print (transcript.json_response[" language_confidence" ])
619642```
620643
621- ``` python title="Python" for="python" highlight={33 } maxLines=15
644+ ``` python title="Python" for="python" highlight={34 } maxLines=15
622645import requests
623646import time
624647
@@ -637,6 +660,7 @@ upload_url = response.json()["upload_url"]
637660
638661data = {
639662 " audio_url" : upload_url, # You can also use a URL to an audio or video file on the web
663+ " speech_models" : [" universal-3-pro" , " universal-2" ],
640664 " language_detection" : True
641665}
642666
@@ -663,7 +687,7 @@ while True:
663687
664688```
665689
666- ``` javascript title="JavaScript SDK" for="javascript-sdk" highlight={19 } maxLines=15
690+ ``` javascript title="JavaScript SDK" for="javascript-sdk" highlight={20 } maxLines=15
667691import { AssemblyAI } from " assemblyai" ;
668692
669693const client = new AssemblyAI ({
@@ -675,6 +699,7 @@ const audioFile = "https://assembly.ai/wildfires.mp3";
675699
676700const params = {
677701 audio: audioFile,
702+ speech_models: [" universal-3-pro" , " universal-2" ],
678703 language_detection: true ,
679704};
680705
@@ -688,7 +713,7 @@ const run = async () => {
688713run ();
689714```
690715
691- ``` javascript title="JavaScript" for="javascript" highlight={36 } maxLines=15
716+ ``` javascript title="JavaScript" for="javascript" highlight={37 } maxLines=15
692717import axios from " axios" ;
693718import fs from " fs-extra" ;
694719
@@ -707,6 +732,7 @@ const uploadUrl = uploadResponse.data.upload_url;
707732
708733const data = {
709734 audio_url: uploadUrl, // You can also use a URL to an audio or video file on the web
735+ speech_models: [" universal-3-pro" , " universal-2" ],
710736 language_detection: true ,
711737};
712738
@@ -743,15 +769,19 @@ if the language confidence is below this threshold. Valid values are in the rang
743769
744770<CodeBlocks >
745771
746- ``` python title="Python SDK" for="python-sdk" highlight={8,13 } maxLines=15
772+ ``` python title="Python SDK" for="python-sdk" highlight={10,16 } maxLines=15
747773import assemblyai as aai
748774
749775aai.settings.api_key = " <YOUR_API_KEY>"
750776
751777# audio_file = "./local_file.mp3"
752778audio_file = " https://assembly.ai/wildfires.mp3"
753779
754- config = aai.TranscriptionConfig(language_detection = True , language_confidence_threshold = 0.8 )
780+ config = aai.TranscriptionConfig(
781+ speech_models = [" universal-3-pro" , " universal-2" ],
782+ language_detection = True ,
783+ language_confidence_threshold = 0.8
784+ )
755785
756786transcript = aai.Transcriber(config = config).transcribe(audio_file)
757787
@@ -762,7 +792,7 @@ else:
762792 print (transcript.text)
763793```
764794
765- ``` python title="Python" for="python" highlight={20 } maxLines=15
795+ ``` python title="Python" for="python" highlight={21 } maxLines=15
766796import requests
767797import time
768798
@@ -781,6 +811,7 @@ upload_url = response.json()["upload_url"]
781811
782812data = {
783813 " audio_url" : upload_url, # You can also use a URL to an audio or video file on the web
814+ " speech_models" : [" universal-3-pro" , " universal-2" ],
784815 " language_detection" : True ,
785816 " language_confidence_threshold" : 0.8
786817}
@@ -807,7 +838,7 @@ while True:
807838
808839```
809840
810- ``` javascript title="JavaScript SDK" for="javascript-sdk" highlight={13 } maxLines=15
841+ ``` javascript title="JavaScript SDK" for="javascript-sdk" highlight={14 } maxLines=15
811842import { AssemblyAI } from " assemblyai" ;
812843
813844const client = new AssemblyAI ({
@@ -819,6 +850,7 @@ const audioFile = "https://assembly.ai/wildfires.mp3";
819850
820851const params = {
821852 audio: audioFile,
853+ speech_models: [" universal-3-pro" , " universal-2" ],
822854 language_detection: true ,
823855 language_confidence_threshold: 0.8 ,
824856};
@@ -837,7 +869,7 @@ const run = async () => {
837869run ();
838870```
839871
840- ``` javascript title="JavaScript" for="javascript" highlight={20 } maxLines=15
872+ ``` javascript title="JavaScript" for="javascript" highlight={21 } maxLines=15
841873import axios from " axios" ;
842874import fs from " fs-extra" ;
843875
@@ -856,6 +888,7 @@ const uploadUrl = uploadResponse.data.upload_url;
856888
857889const data = {
858890 audio_url: uploadUrl, // You can also use a URL to an audio or video file on the web
891+ speech_models: [" universal-3-pro" , " universal-2" ],
859892 language_detection: true ,
860893 language_confidence_threshold: 0.8 ,
861894};
0 commit comments