Skip to content

Commit

Permalink
Cookbook: How to Extract Transcript Quotes with LeMURs Custom Text In…
Browse files Browse the repository at this point in the history
…put Parameter
  • Loading branch information
dan-ince-aai committed Feb 24, 2025
1 parent 6981abd commit 7f82106
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
2 changes: 1 addition & 1 deletion fern/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ navigation:
path: pages/05-guides/cookbooks/lemur/transcript-citations.mdx
slug: transcript-citations
hidden: true
- page: Extracting Transcript Quotes with LeMUR
- page: How to Extract Transcript Quotes with LeMURs Custom Text Input Parameter
path: pages/05-guides/cookbooks/lemur/timestamped-transcripts.mdx
slug: timestamped-transcripts
hidden: true
Expand Down
36 changes: 34 additions & 2 deletions fern/pages/05-guides/cookbooks/lemur/timestamped-transcripts.mdx
Original file line number Diff line number Diff line change
@@ -1,14 +1,38 @@
---
title: 'Extracting Transcript Quotes with LeMURs Custom Text Input Parameter'
title: 'How to Extract Transcript Quotes with LeMURs Custom Text Input Parameter'
---




# Extracting Transcript Quotes with LeMUR's Custom Text Input Parameter

This Colab will demonstrate how to use AssemblyAI's [LeMUR](https://www.assemblyai.com/blog/lemur/) (Leveraging Large Language Models to Understand Recognized Speech) framework to process an audio file and find the best quotes included in it by sending in the timestamped transcript via LeMUR's `input_text` parameter.

Here’s the full sample code for what you’ll build in this tutorial:

```python
import assemblyai

assemblyai.settings.api_key = "YOUR_API_KEY"
transcriber = assemblyai.Transcriber()

transcript = transcriber.transcribe("https://github.com/AssemblyAI-Examples/audio-examples/raw/main/20230607_me_canadian_wildfires.mp3")

result = assemblyai.Lemur().question(
input_text=f"{[(sentence.text, sentence.start, sentence.end) for sentence in transcript.get_sentences()]}",
final_model=assemblyai.LemurModel.claude3_5_sonnet,
questions=[
{
"question": "What are the most engaging quotes from this transcript?",
"context": "This is a list of sentences from the transcript, with each sentence having a start and end timestamp in milliseconds.",
"answer_format": "Exact quotes with the start and end timestamp of each sentence."
}
]
)

print(result.response[0].answer)
```

## Getting Started

Before we begin, make sure you have an AssemblyAI account and an API key. You can [sign up](https://www.assemblyai.com/dashboard/signup/) for an AssemblyAI account and get your API key from your [dashboard](https://www.assemblyai.com/app/account).
Expand Down Expand Up @@ -56,3 +80,11 @@ result = assemblyai.Lemur().question(

print(result.response[0].answer)
```
Example response:

```
("So the concentrations of these particles in the air are just much, much higher than we typically see.", 113338, 119698)
("And exposure to those high levels can lead to a host of health problems.", 119784, 123314)
("I think New York has some of the higher concentrations right now, but that's going to change as that air moves away from the New York area.", 170950, 176930)
("Looking into the future, the fire season is starting earlier and lasting longer and we're seeing more frequent fires.", 245216, 251254)
```
2 changes: 1 addition & 1 deletion fern/pages/05-guides/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ _LeMUR_
|[Estimating Input Token Costs for LeMUR](guides/counting-tokens)|
|[Extract Dialogue Data with LeMUR and JSON](guides/dialogue-data)|
|[Extracting Quotes with Timestamps Using LeMUR + Semantic Search](guides/transcript-citations)|
|[Extracting Transcript Quotes with LeMUR](guides/timestamped-transcripts)|
|[How to Extract Transcript Quotes with LeMURs Custom Text Input Parameter](guides/timestamped-transcripts)|
|[How to Pass Context from Previous LeMUR Requests](guides/past-response-prompts)|
|[How To Implement a Sales Playbook Using LeMUR](guides/sales-playbook)|
|[How to Setup an AI Coach with LeMUR](guides/task-endpoint-ai-coach)|
Expand Down

0 comments on commit 7f82106

Please sign in to comment.