From 565fc713b7bbbbe587808a25b4d1c22ae207e772 Mon Sep 17 00:00:00 2001 From: Amanda DiNoto Date: Tue, 16 Dec 2025 07:35:41 -0500 Subject: [PATCH 1/2] add ald parameter option to translation docs page --- .../08-speech-understanding/translation.mdx | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/fern/pages/08-speech-understanding/translation.mdx b/fern/pages/08-speech-understanding/translation.mdx index cf519d30..22ff68d5 100644 --- a/fern/pages/08-speech-understanding/translation.mdx +++ b/fern/pages/08-speech-understanding/translation.mdx @@ -172,6 +172,7 @@ audio_url = "https://assembly.ai/wildfires.mp3" data = { "audio_url": audio_url, "speaker_labels": True, # Enable speaker labels + # "language_detection": True, # Enable language detection if you are processing files in a variety of languages "speech_understanding": { "request": { "translation": { @@ -211,7 +212,7 @@ for language_code, translated_text in transcript['translated_texts'].items(): ``` -{/* + ```python import assemblyai as aai @@ -223,6 +224,7 @@ transcriber = aai.Transcriber() # Configure transcription with translation config = aai.TranscriptionConfig( speaker_labels=True, # Enable speaker labels + # language_detection=True, # Enable language detection if you are processing files in a variety of languages speech_understanding=aai.SpeechUnderstandingConfig( translation=aai.TranslationConfig( target_languages=['es', 'de'], # Translate to Spanish and German @@ -248,7 +250,7 @@ for language_code, translated_text in transcript['translated_texts'].items(): print(translated_text[:200] + "...\n") ``` - */} + ```javascript @@ -266,6 +268,7 @@ const audioUrl = 'https://assembly.ai/wildfires.mp3'; const data = { audio_url: audioUrl, speaker_labels: true, // Enable speaker labels + // language_detection: true, // Enable language detection if you are processing files in a variety of languages speech_understanding: { request: { translation: { @@ -319,7 +322,7 @@ transcribeAndTranslate(); ``` -{/* + ```typescript import { AssemblyAI } from 'assemblyai'; @@ -332,6 +335,7 @@ const client = new AssemblyAI({ const config = { audio_url: 'https://assembly.ai/wildfires.mp3', speaker_labels: true, // Enable speaker labels + // language_detection: true, // Enable language detection if you are processing files in a variety of languages speech_understanding: { request: { translation: { @@ -359,7 +363,7 @@ if (transcript.translated_texts) { } ``` - */} + ### Method 2: Transcribe and translate in separate requests @@ -385,7 +389,8 @@ audio_url = "https://assembly.ai/wildfires.mp3" # Submit transcription request (without translation) data = { "audio_url": audio_url, - "speaker_labels": True + "speaker_labels": True, + # "language_detection": True, # Enable language detection if you are processing files in a variety of languages } # Transcribe file @@ -439,7 +444,7 @@ for language_code, translated_text in result['translated_texts'].items(): -{/* + ```python import assemblyai as aai @@ -452,6 +457,7 @@ audio_url = "https://assembly.ai/wildfires.mp3" config = aai.TranscriptionConfig( speaker_labels=True, + # language_detection=True, # Enable language detection if you are processing files in a variety of languages ) transcript = aai.Transcriber().transcribe(audio_file, config) @@ -482,7 +488,7 @@ for language_code, translated_text in transcript['translated_texts'].items(): print(translated_text[:200] + "...\n") ``` - */} + @@ -504,7 +510,8 @@ async function main() { // Submit transcription request (without translation) const data = { audio_url: audioUrl, - speaker_labels: true + speaker_labels: true, + // language_detection: true, // Enable language detection if you are processing files in a variety of languages }; // Transcribe file @@ -582,7 +589,7 @@ main().catch(error => { -{/* + ```javascript import { AssemblyAI } from 'assemblyai'; @@ -601,6 +608,7 @@ async function translateTranscript() { const transcript = await client.transcripts.transcribe({ audio: audioUrl, speaker_labels: true // Optional: enable speaker diarization + // language_detection: true, // Enable language detection if you are processing files in a variety of languages }); if (transcript.status === "error") { @@ -634,7 +642,7 @@ async function translateTranscript() { translateTranscript().catch(console.error); ``` - */} + **Expected output:** @@ -733,6 +741,7 @@ audio_url = "https://assembly.ai/wildfires.mp3" data = { "audio_url": audio_url, "speaker_labels": True, # Enable speaker labels + # "language_detection": True, # Enable language detection if you are processing files in a variety of languages "speech_understanding": { "request": { "translation": { @@ -787,6 +796,7 @@ const audioUrl = 'https://assembly.ai/wildfires.mp3'; const data = { audio_url: audioUrl, speaker_labels: true, // Enable speaker labels + // language_detection: true, // Enable language detection if you are processing files in a variety of languages speech_understanding: { request: { translation: { @@ -889,6 +899,7 @@ curl -X POST \ -d '{ "audio_url": "https://assembly.ai/wildfires.mp3", "speaker_labels": true, + "language_detection": true, "speech_understanding": { "request": { "translation": { From c4dda68e7117738b481462bd396dcf143addf97e Mon Sep 17 00:00:00 2001 From: Amanda DiNoto Date: Tue, 16 Dec 2025 12:27:09 -0500 Subject: [PATCH 2/2] re-hide sdk code --- .../08-speech-understanding/translation.mdx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fern/pages/08-speech-understanding/translation.mdx b/fern/pages/08-speech-understanding/translation.mdx index 22ff68d5..935d92db 100644 --- a/fern/pages/08-speech-understanding/translation.mdx +++ b/fern/pages/08-speech-understanding/translation.mdx @@ -212,7 +212,7 @@ for language_code, translated_text in transcript['translated_texts'].items(): ``` - +{/* ```python import assemblyai as aai @@ -250,7 +250,7 @@ for language_code, translated_text in transcript['translated_texts'].items(): print(translated_text[:200] + "...\n") ``` - + */} ```javascript @@ -322,7 +322,7 @@ transcribeAndTranslate(); ``` - +{/* ```typescript import { AssemblyAI } from 'assemblyai'; @@ -363,7 +363,7 @@ if (transcript.translated_texts) { } ``` - + */} ### Method 2: Transcribe and translate in separate requests @@ -444,7 +444,7 @@ for language_code, translated_text in result['translated_texts'].items(): - +{/* ```python import assemblyai as aai @@ -488,7 +488,7 @@ for language_code, translated_text in transcript['translated_texts'].items(): print(translated_text[:200] + "...\n") ``` - + */} @@ -589,7 +589,7 @@ main().catch(error => { - +{/* ```javascript import { AssemblyAI } from 'assemblyai'; @@ -642,7 +642,7 @@ async function translateTranscript() { translateTranscript().catch(console.error); ``` - + */} **Expected output:**