@@ -70,7 +70,7 @@ aai.settings.api_key = f"{ASSEMBLYAI_API_KEY}"
7070### ** Core Examples**
7171
7272<details >
73- <summary >Transcribe a Local Audio File </summary >
73+ <summary >Transcribe a local audio file </summary >
7474
7575``` python
7676import assemblyai as aai
@@ -116,7 +116,7 @@ transcript = transcriber.transcribe(upload_url)
116116</details >
117117
118118<details >
119- <summary >Export Subtitles of an Audio File </summary >
119+ <summary >Export subtitles of an audio file </summary >
120120
121121``` python
122122import assemblyai as aai
@@ -134,7 +134,7 @@ print(transcript.export_subtitles_vtt())
134134</details >
135135
136136<details >
137- <summary >List all Sentences and Paragraphs </summary >
137+ <summary >List all sentences and paragraphs </summary >
138138
139139``` python
140140import assemblyai as aai
@@ -154,7 +154,7 @@ for paragraph in paragraphs:
154154</details >
155155
156156<details >
157- <summary >Search for Words in a Transcript </summary >
157+ <summary >Search for words in a transcript </summary >
158158
159159``` python
160160import assemblyai as aai
@@ -171,7 +171,7 @@ for match in matches:
171171</details >
172172
173173<details >
174- <summary >Add Custom Spellings on a Transcript </summary >
174+ <summary >Add custom spellings on a transcript </summary >
175175
176176``` python
177177import assemblyai as aai
@@ -265,96 +265,91 @@ while page.page_details.before_id_of_prev_url is not None:
265265### ** LeMUR Examples**
266266
267267<details >
268- <summary >Use LeMUR to Summarize Multiple Transcripts </summary >
268+ <summary >Use LeMUR to summarize an audio file </summary >
269269
270270``` python
271271import assemblyai as aai
272272
273+ audio_file = " https://assembly.ai/sports_injuries.mp3"
274+
273275transcriber = aai.Transcriber()
274- transcript_group = transcriber.transcribe_group(
275- [
276- " https://example.org/customer1.mp3" ,
277- " https://example.org/customer2.mp3" ,
278- ],
279- )
276+ transcript = transcriber.transcribe(audio_file)
280277
281- result = transcript_group.lemur.summarize(
282- context = " Customers asking for cars" ,
283- answer_format = " TLDR"
278+ prompt = " Provide a brief summary of the transcript."
279+
280+ result = transcript.lemur.task(
281+ prompt, final_model = aai.LemurModel.claude3_5_sonnet
284282)
285283
286284print (result.response)
287285```
288286
289- </details >
290-
291- <details >
292- <summary >Use LeMUR to Ask Questions on a Single Transcript</summary >
287+ Or use the specialized Summarization endpoint that requires no prompt engineering and facilitates more deterministic and structured outputs:
293288
294289``` python
295290import assemblyai as aai
296291
297- transcriber = aai.Transcriber()
298- transcript = transcriber.transcribe(" https://example.org/customer.mp3" )
299-
300- # ask some questions
301- questions = [
302- aai.LemurQuestion(question = " What car was the customer interested in?" ),
303- aai.LemurQuestion(question = " What price range is the customer looking for?" ),
304- ]
292+ audio_url = " https://assembly.ai/meeting.mp4"
293+ transcript = aai.Transcriber().transcribe(audio_url)
305294
306- result = transcript.lemur.question(questions)
295+ result = transcript.lemur.summarize(
296+ final_model = aai.LemurModel.claude3_5_sonnet,
297+ context = " A GitLab meeting to discuss logistics" ,
298+ answer_format = " TLDR"
299+ )
307300
308- for q in result.response:
309- print (f " Question: { q.question} " )
310- print (f " Answer: { q.answer} " )
301+ print (result.response)
311302```
312303
313304</details >
314305
315306<details >
316- <summary >Use LeMUR to Ask for Action Items from a Single Transcript </summary >
307+ <summary >Use LeMUR to ask questions about your audio data </summary >
317308
318309``` python
319310import assemblyai as aai
320311
312+ audio_file = " https://assembly.ai/sports_injuries.mp3"
313+
321314transcriber = aai.Transcriber()
322- transcript = transcriber.transcribe(" https://example.org/customer.mp3" )
315+ transcript = transcriber.transcribe(audio_file)
316+
317+ prompt = " What is a runner's knee?"
323318
324- result = transcript.lemur.action_items(
325- context = " Customers asking for help with resolving their problem" ,
326- answer_format = " Three bullet points" ,
319+ result = transcript.lemur.task(
320+ prompt, final_model = aai.LemurModel.claude3_5_sonnet
327321)
328322
329323print (result.response)
330324```
331325
332-
333- </details >
334-
335- <details >
336- <summary >Use LeMUR to Ask Anything with a Custom Prompt</summary >
326+ Or use the specialized Q&A endpoint that requires no prompt engineering and facilitates more deterministic and structured outputs:
337327
338328``` python
339329import assemblyai as aai
340330
341331transcriber = aai.Transcriber()
342332transcript = transcriber.transcribe(" https://example.org/customer.mp3" )
343333
344- result = transcript.lemur.task(
345- " You are a helpful coach. Provide an analysis of the transcript "
346- " and offer areas to improve with exact quotes. Include no preamble. "
347- " Start with an overall summary then get into the examples with feedback. " ,
348- )
334+ # ask some questions
335+ questions = [
336+ aai.LemurQuestion( question = " What car was the customer interested in? " ),
337+ aai.LemurQuestion( question = " What price range is the customer looking for? " ) ,
338+ ]
349339
350- print (result.response)
340+ result = transcript.lemur.question(
341+ final_model = aai.LemurModel.claude3_5_sonnet,
342+ questions = questions)
343+
344+ for q in result.response:
345+ print (f " Question: { q.question} " )
346+ print (f " Answer: { q.answer} " )
351347```
352348
353349</details >
354350
355-
356351<details >
357- <summary >Use LeMUR to with Input Text </summary >
352+ <summary >Use LeMUR with customized input text </summary >
358353
359354``` python
360355import assemblyai as aai
@@ -375,7 +370,32 @@ result = aai.Lemur().task(
375370 " You are a helpful coach. Provide an analysis of the transcript "
376371 " and offer areas to improve with exact quotes. Include no preamble. "
377372 " Start with an overall summary then get into the examples with feedback." ,
378- input_text = text
373+ input_text = text,
374+ final_model = aai.LemurModel.claude3_5_sonnet
375+ )
376+
377+ print (result.response)
378+ ```
379+
380+ </details >
381+
382+ <details >
383+ <summary >Apply LeMUR to multiple transcripts</summary >
384+
385+ ``` python
386+ import assemblyai as aai
387+
388+ transcriber = aai.Transcriber()
389+ transcript_group = transcriber.transcribe_group(
390+ [
391+ " https://example.org/customer1.mp3" ,
392+ " https://example.org/customer2.mp3" ,
393+ ],
394+ )
395+
396+ result = transcript_group.lemur.task(
397+ context = " These are calls of customers asking for cars. Summarize all calls and create a TLDR." ,
398+ final_model = aai.LemurModel.claude3_5_sonnet
379399)
380400
381401print (result.response)
@@ -417,7 +437,7 @@ print(deletion_result)
417437### ** Audio Intelligence Examples**
418438
419439<details >
420- <summary >PII Redact a Transcript </summary >
440+ <summary >PII Redact a transcript </summary >
421441
422442``` python
423443import assemblyai as aai
@@ -514,7 +534,7 @@ config=aai.TranscriptionConfig(
514534
515535</details >
516536<details >
517- <summary >Detect Sensitive Content in a Transcript </summary >
537+ <summary >Detect sensitive content in a transcript </summary >
518538
519539``` python
520540import assemblyai as aai
@@ -562,7 +582,7 @@ config=aai.TranscriptionConfig(
562582
563583</details >
564584<details >
565- <summary >Analyze the Sentiment of Sentences in a Transcript </summary >
585+ <summary >Analyze the sentiment of sentences in a transcript </summary >
566586
567587``` python
568588import assemblyai as aai
@@ -597,7 +617,7 @@ for sentiment_result in transcript.sentiment_analysis:
597617
598618</details >
599619<details >
600- <summary >Identify Entities in a Transcript </summary >
620+ <summary >Identify entities in a transcript </summary >
601621
602622``` python
603623import assemblyai as aai
@@ -618,7 +638,7 @@ for entity in transcript.entities:
618638
619639</details >
620640<details >
621- <summary >Detect Topics in a Transcript (IAB Classification)</summary >
641+ <summary >Detect topics in a transcript (IAB Classification)</summary >
622642
623643``` python
624644import assemblyai as aai
@@ -646,7 +666,7 @@ for label, relevance in transcript.iab_categories.summary.items():
646666
647667</details >
648668<details >
649- <summary >Identify Important Words and Phrases in a Transcript </summary >
669+ <summary >Identify important words and phrases in a transcript </summary >
650670
651671``` python
652672import assemblyai as aai
@@ -677,7 +697,7 @@ for result in transcript.auto_highlights.results:
677697[ Read more about our Real-Time service.] ( https://www.assemblyai.com/docs/Guides/real-time_streaming_transcription )
678698
679699<details >
680- <summary >Stream your Microphone in Real-Time </summary >
700+ <summary >Stream your microphone in real-time </summary >
681701
682702``` python
683703import assemblyai as aai
@@ -733,7 +753,7 @@ transcriber.close()
733753</details >
734754
735755<details >
736- <summary >Transcribe a Local Audio File in Real-Time </summary >
756+ <summary >Transcribe a local audio file in real-time </summary >
737757
738758``` python
739759import assemblyai as aai
@@ -835,12 +855,32 @@ transcriber = aai.RealtimeTranscriber(
835855
836856---
837857
838- ## Playgrounds
858+ ### ** Change the default settings**
859+
860+ You'll find the ` Settings ` class with all default values in [ types.py] ( ./assemblyai/types.py ) .
861+
862+ <details >
863+ <summary >Change the default timeout and polling interval</summary >
864+
865+ ``` python
866+ import assemblyai as aai
867+
868+ # The HTTP timeout in seconds for general requests, default is 30.0
869+ aai.settings.http_timeout = 60.0
870+
871+ # The polling interval in seconds for long-running requests, default is 3.0
872+ aai.settings.polling_interval = 10.0
873+ ```
874+
875+ </details >
876+
877+ ---
878+
879+ ## Playground
839880
840- Visit one of our Playgrounds :
881+ Visit our Playground to try our all of our Speech AI models and LeMUR for free :
841882
842- - [ LeMUR Playground] ( https://www.assemblyai.com/playground/v2/source )
843- - [ Transcription Playground] ( https://www.assemblyai.com/playground )
883+ - [ Playground] ( https://www.assemblyai.com/playground )
844884
845885# Advanced
846886
0 commit comments