Extract Dialogue Data with LeMUR and JSON
In this guide, we’ll show you how to use AssemblyAI’s LeMUR (Leveraging Large Language Models to Understand Recognized Speech) framework to process several audio files, and then format your results in JSON (JavaScript Object Notation) format.
JSON allows you to programmatically format, parse, and transfer resopnses from LeMUR, which is useful for implementing LeMUR with a wide range of other applications.
In this example, we will leverage the JSON formatting to create a .csv file from a directory of files that must be transcribed and submitted to LeMUR. However, you can use the same concepts in this guide to generate a JSON-formatted response, which you can then use to update a database table or interact with other APIs.
Quickstart
Get Started
Before we begin, make sure you have an AssemblyAI account and an API key. You can sign up for an AssemblyAI account and get your API key from your dashboard.
LeMUR features are currently only available to paid users to two pricing tiers: LeMUR and LeMUR Basic. See pricing for more detail.
Step-by-Step Instructions
In this guide, we will ask the same questions to LeMUR about multiple files. Then, we will collate the answers in a .csv file.
Import the necessary libraries for making an HTTP request and set your API key.
Transcribe your audio files.
Define your LeMUR request prompt for the Task feature.
Construct your .csv file and parse the JSON data.
For context, this is the response from LeMUR with our prompt.
You can now run your Python script and you should see that a profiles.csv
file is generated. Your result will look similar to the example below.