@@ -41,8 +41,8 @@ aai.settings.api_key = "your-key"
4141- ` aai.TranscriptionConfig ` — All transcription options: ` speech_models ` , ` speaker_labels ` , ` sentiment_analysis ` , ` entity_detection ` , ` auto_chapters ` , ` content_safety ` , ` language_detection ` , ` summarization ` , ` word_boost ` , ` disfluencies `
4242- ` aai.Transcript ` — Result object with ` .text ` , ` .status ` , ` .utterances ` , ` .words ` , ` .chapters ` , ` .entities ` , ` .sentiment_analysis ` . Methods: ` get_sentences() ` , ` get_paragraphs() ` , ` export_subtitles_srt() ` , ` export_subtitles_vtt() `
4343- ` aai.SyncTranscriber ` — Synchronous pre-recorded transcription: audio in, transcript out, one request (no polling). Methods: ` transcribe() ` , ` transcribe_async() `
44- - ` aai.SyncTranscriptionConfig ` — Sync options: ` model ` (default ` u3-sync-pro ` ), ` prompt ` , ` word_boost ` , ` conversation_context ` , ` language_code ` , ` sample_rate ` , ` channels `
45- - ` aai.SyncTranscriptResponse ` — Sync result: ` .text ` , ` .words ` (` Word ` type with ` start ` /` end ` / ` confidence ` ), ` .confidence ` , ` .audio_duration_ms ` , ` .session_id ` , ` .request_time_ms `
44+ - ` aai.SyncTranscriptionConfig ` — Sync options: ` model ` (default ` u3-sync-pro ` ), ` prompt ` , ` keyterms_prompt ` , ` conversation_context ` , ` language_codes ` , ` timestamps ` , ` sample_rate ` , ` channels `
45+ - ` aai.SyncTranscriptResponse ` — Sync result: ` .text ` , ` .words ` (` SyncWord ` with ` confidence ` always, ` start ` /` end ` only when ` timestamps=True ` ), ` .confidence ` , ` .audio_duration_ms ` , ` .session_id ` , ` .request_time_ms `
4646- ` assemblyai.streaming.v3.StreamingClient ` — Real-time streaming with event-based API (threaded)
4747- ` assemblyai.streaming.v3.AsyncStreamingClient ` — Asyncio-native counterpart; same options/events
4848
@@ -97,7 +97,7 @@ aai.settings.api_key = os.environ["ASSEMBLYAI_API_KEY"]
9797result = aai.SyncTranscriber().transcribe(" ./call.wav" )
9898print (result.text, result.session_id)
9999for w in result.words:
100- print (w.text, w.start, w.end, w.confidence )
100+ print (w.text, w.confidence) # w.start/w.end need timestamps=True (see below )
101101```
102102
103103** Input** : a local file path, raw ` bytes ` , or a binary file object. ** Not** a URL —
@@ -107,8 +107,8 @@ pass a path/bytes or use `Transcriber` for URL ingestion.
107107``` python
108108config = aai.SyncTranscriptionConfig(
109109 prompt = " Transcribe verbatim. Preserve disfluencies." , # max 4096 chars
110- word_boost = [" AssemblyAI" , " Lemur" , " U3-Pro" ], # max 2048 chars total
111- language_code = " es" , # or ["en", "es"]; defaults to English
110+ keyterms_prompt = [" AssemblyAI" , " Lemur" , " U3-Pro" ], # max 2048 chars total
111+ language_codes = [ " es" ] , # or e.g. ["en", "es"] for multilingual ; defaults to English
112112)
113113result = aai.SyncTranscriber().transcribe(" ./call.wav" , config = config)
114114```
@@ -129,9 +129,20 @@ config = aai.SyncTranscriptionConfig(
129129result = aai.SyncTranscriber().transcribe(" ./reply.wav" , config = config)
130130```
131131
132- ** Language** : ` language_code ` takes an ISO 639-1 code (or list of codes for multilingual
133- audio) and steers the default prompt toward that language — ignored when you pass a custom
134- ` prompt ` . Supported: en, es, de, fr, it, pt, tr, nl, sv, no, da, fi, hi, vi, ar, he, ja, ur, zh.
132+ ** Language** : ` language_codes ` takes a list of ISO 639-1 codes — a single-element list
133+ for monolingual audio or several codes for multilingual audio — and steers the default
134+ prompt toward those languages; ignored when you pass a custom ` prompt ` .
135+ Supported: en, es, de, fr, it, pt, tr, nl, sv, no, da, fi, hi, vi, ar, he, ja, ur, zh.
136+
137+ ** Word timestamps** are opt-in. By default words carry ` text ` and ` confidence ` only —
138+ ` start ` /` end ` are ` None ` . ` timestamps=True ` computes accurate per-word timings for a
139+ small latency cost:
140+ ``` python
141+ config = aai.SyncTranscriptionConfig(timestamps = True )
142+ result = aai.SyncTranscriber().transcribe(" ./call.wav" , config = config)
143+ for w in result.words:
144+ print (w.text, w.start, w.end) # milliseconds
145+ ```
135146
136147** Raw PCM** (S16LE) needs ` sample_rate ` + ` channels ` ; WAV reads them from its header.
137148Setting either field routes the audio as ` audio/pcm ` , and both must be present:
0 commit comments