From d87cceb44eb1e00344e7f70b2be562c4eaeb496d Mon Sep 17 00:00:00 2001 From: Niels Swimberghe <3382717+Swimburger@users.noreply.github.com> Date: Fri, 1 Mar 2024 17:24:35 -0500 Subject: [PATCH] Update docs with more samples --- README.md | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index d6afa1f..4c3722a 100644 --- a/README.md +++ b/README.md @@ -48,16 +48,13 @@ You can now use the `client` object to interact with the AssemblyAI API. # Usage ## Speech-To-Text -
- Transcribe a local audio file +
+ Transcribe an audio file with a public URL ```ruby -data = File.open('/path/to/your/file').read -encoded = Base64.encode64(data) -uploaded_file = client.files.upload(request: encoded) - -transcript = client.transcripts.transcribe(audio_url: uploaded_file.upload_url) -puts transcript.text +transcript = client.transcripts.transcribe( + audio_url: 'https://storage.googleapis.com/aai-web-samples/espn-bears.m4a', +) ``` `transcribe` queues a transcription job and polls it until the `status` is `completed` or `error`. @@ -71,14 +68,16 @@ transcript = client.transcripts.submit( ```
-
- Transcribe an audio file with a public URL + Transcribe a local audio file ```ruby -transcript = client.transcripts.transcribe( - audio_url: 'https://storage.googleapis.com/aai-web-samples/espn-bears.m4a', -) +data = File.open('/path/to/your/file').read +encoded = Base64.encode64(data) +uploaded_file = client.files.upload(request: encoded) + +transcript = client.transcripts.transcribe(audio_url: uploaded_file.upload_url) +puts transcript.text ``` `transcribe` queues a transcription job and polls it until the `status` is `completed` or `error`. @@ -86,12 +85,11 @@ transcript = client.transcripts.transcribe( If you don't want to wait until the transcript is ready, you can use `submit`: ```ruby -transcript = client.transcripts.submit( - audio_url: 'https://storage.googleapis.com/aai-web-samples/espn-bears.m4a' -) +transcript = client.transcripts.submit(audio_url: uploaded_file.upload_url) ```
+
Enable additional AI models @@ -199,6 +197,9 @@ response = client.transcripts.delete(transcript_id: transcript.id) Call [LeMUR endpoints](https://www.assemblyai.com/docs/api-reference/lemur) to apply LLMs to your transcript. +
+Prompt your audio with LeMUR + ```ruby response = client.lemur.task( transcript_ids: ['0d295578-8c75-421a-885a-2c487f188927'], @@ -206,6 +207,8 @@ response = client.lemur.task( ) ``` +
+
Summarize with LeMUR