Ask questions using LeMUR
curl --request POST \
--url https://api.assemblyai.com/lemur/v3/generate/question-answer \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"transcript_ids": [
"64nygnr62k-405c-4ae8-8a6b-d90b40ff3cce"
],
"context": "This is an interview about wildfires.",
"final_model": "anthropic/claude-3-5-sonnet",
"temperature": 0,
"max_output_size": 3000,
"questions": [
{
"question": "Where are there wildfires?",
"answer_format": "List of countries in ISO 3166-1 alpha-2 format",
"answer_options": [
"US",
"CA"
]
},
{
"question": "Is global warming affecting wildfires?",
"answer_options": [
"yes",
"no"
]
}
]
}
'import requests
url = "https://api.assemblyai.com/lemur/v3/generate/question-answer"
payload = {
"transcript_ids": ["64nygnr62k-405c-4ae8-8a6b-d90b40ff3cce"],
"context": "This is an interview about wildfires.",
"final_model": "anthropic/claude-3-5-sonnet",
"temperature": 0,
"max_output_size": 3000,
"questions": [
{
"question": "Where are there wildfires?",
"answer_format": "List of countries in ISO 3166-1 alpha-2 format",
"answer_options": ["US", "CA"]
},
{
"question": "Is global warming affecting wildfires?",
"answer_options": ["yes", "no"]
}
]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
transcript_ids: ['64nygnr62k-405c-4ae8-8a6b-d90b40ff3cce'],
context: 'This is an interview about wildfires.',
final_model: 'anthropic/claude-3-5-sonnet',
temperature: 0,
max_output_size: 3000,
questions: [
{
question: 'Where are there wildfires?',
answer_format: 'List of countries in ISO 3166-1 alpha-2 format',
answer_options: ['US', 'CA']
},
{
question: 'Is global warming affecting wildfires?',
answer_options: ['yes', 'no']
}
]
})
};
fetch('https://api.assemblyai.com/lemur/v3/generate/question-answer', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.assemblyai.com/lemur/v3/generate/question-answer",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'transcript_ids' => [
'64nygnr62k-405c-4ae8-8a6b-d90b40ff3cce'
],
'context' => 'This is an interview about wildfires.',
'final_model' => 'anthropic/claude-3-5-sonnet',
'temperature' => 0,
'max_output_size' => 3000,
'questions' => [
[
'question' => 'Where are there wildfires?',
'answer_format' => 'List of countries in ISO 3166-1 alpha-2 format',
'answer_options' => [
'US',
'CA'
]
],
[
'question' => 'Is global warming affecting wildfires?',
'answer_options' => [
'yes',
'no'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.assemblyai.com/lemur/v3/generate/question-answer"
payload := strings.NewReader("{\n \"transcript_ids\": [\n \"64nygnr62k-405c-4ae8-8a6b-d90b40ff3cce\"\n ],\n \"context\": \"This is an interview about wildfires.\",\n \"final_model\": \"anthropic/claude-3-5-sonnet\",\n \"temperature\": 0,\n \"max_output_size\": 3000,\n \"questions\": [\n {\n \"question\": \"Where are there wildfires?\",\n \"answer_format\": \"List of countries in ISO 3166-1 alpha-2 format\",\n \"answer_options\": [\n \"US\",\n \"CA\"\n ]\n },\n {\n \"question\": \"Is global warming affecting wildfires?\",\n \"answer_options\": [\n \"yes\",\n \"no\"\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.assemblyai.com/lemur/v3/generate/question-answer")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"transcript_ids\": [\n \"64nygnr62k-405c-4ae8-8a6b-d90b40ff3cce\"\n ],\n \"context\": \"This is an interview about wildfires.\",\n \"final_model\": \"anthropic/claude-3-5-sonnet\",\n \"temperature\": 0,\n \"max_output_size\": 3000,\n \"questions\": [\n {\n \"question\": \"Where are there wildfires?\",\n \"answer_format\": \"List of countries in ISO 3166-1 alpha-2 format\",\n \"answer_options\": [\n \"US\",\n \"CA\"\n ]\n },\n {\n \"question\": \"Is global warming affecting wildfires?\",\n \"answer_options\": [\n \"yes\",\n \"no\"\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.assemblyai.com/lemur/v3/generate/question-answer")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"transcript_ids\": [\n \"64nygnr62k-405c-4ae8-8a6b-d90b40ff3cce\"\n ],\n \"context\": \"This is an interview about wildfires.\",\n \"final_model\": \"anthropic/claude-3-5-sonnet\",\n \"temperature\": 0,\n \"max_output_size\": 3000,\n \"questions\": [\n {\n \"question\": \"Where are there wildfires?\",\n \"answer_format\": \"List of countries in ISO 3166-1 alpha-2 format\",\n \"answer_options\": [\n \"US\",\n \"CA\"\n ]\n },\n {\n \"question\": \"Is global warming affecting wildfires?\",\n \"answer_options\": [\n \"yes\",\n \"no\"\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"request_id": "5e1b27c2-691f-4414-8bc5-f14678442f9e",
"usage": {
"input_tokens": 27,
"output_tokens": 3
},
"response": [
{
"answer": "CA, US",
"question": "Where are there wildfires?"
},
{
"answer": "yes",
"question": "Is global warming affecting wildfires?"
}
]
}{
"error": "This is a sample error message"
}{
"error": "Authentication error, API token missing/invalid"
}{
"error": "Not found"
}{
"error": "Too Many Requests"
}{
"error": "Internal Server Error"
}LeMUR
Ask questions using LeMUR
Question & Answer allows you to ask free-form questions about a single transcript or a group of transcripts. The questions can be any whose answers you find useful, such as judging whether a caller is likely to become a customer or whether all items on a meeting’s agenda were covered.
POST
/
lemur
/
v3
/
generate
/
question-answer
Ask questions using LeMUR
curl --request POST \
--url https://api.assemblyai.com/lemur/v3/generate/question-answer \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"transcript_ids": [
"64nygnr62k-405c-4ae8-8a6b-d90b40ff3cce"
],
"context": "This is an interview about wildfires.",
"final_model": "anthropic/claude-3-5-sonnet",
"temperature": 0,
"max_output_size": 3000,
"questions": [
{
"question": "Where are there wildfires?",
"answer_format": "List of countries in ISO 3166-1 alpha-2 format",
"answer_options": [
"US",
"CA"
]
},
{
"question": "Is global warming affecting wildfires?",
"answer_options": [
"yes",
"no"
]
}
]
}
'import requests
url = "https://api.assemblyai.com/lemur/v3/generate/question-answer"
payload = {
"transcript_ids": ["64nygnr62k-405c-4ae8-8a6b-d90b40ff3cce"],
"context": "This is an interview about wildfires.",
"final_model": "anthropic/claude-3-5-sonnet",
"temperature": 0,
"max_output_size": 3000,
"questions": [
{
"question": "Where are there wildfires?",
"answer_format": "List of countries in ISO 3166-1 alpha-2 format",
"answer_options": ["US", "CA"]
},
{
"question": "Is global warming affecting wildfires?",
"answer_options": ["yes", "no"]
}
]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
transcript_ids: ['64nygnr62k-405c-4ae8-8a6b-d90b40ff3cce'],
context: 'This is an interview about wildfires.',
final_model: 'anthropic/claude-3-5-sonnet',
temperature: 0,
max_output_size: 3000,
questions: [
{
question: 'Where are there wildfires?',
answer_format: 'List of countries in ISO 3166-1 alpha-2 format',
answer_options: ['US', 'CA']
},
{
question: 'Is global warming affecting wildfires?',
answer_options: ['yes', 'no']
}
]
})
};
fetch('https://api.assemblyai.com/lemur/v3/generate/question-answer', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.assemblyai.com/lemur/v3/generate/question-answer",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'transcript_ids' => [
'64nygnr62k-405c-4ae8-8a6b-d90b40ff3cce'
],
'context' => 'This is an interview about wildfires.',
'final_model' => 'anthropic/claude-3-5-sonnet',
'temperature' => 0,
'max_output_size' => 3000,
'questions' => [
[
'question' => 'Where are there wildfires?',
'answer_format' => 'List of countries in ISO 3166-1 alpha-2 format',
'answer_options' => [
'US',
'CA'
]
],
[
'question' => 'Is global warming affecting wildfires?',
'answer_options' => [
'yes',
'no'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.assemblyai.com/lemur/v3/generate/question-answer"
payload := strings.NewReader("{\n \"transcript_ids\": [\n \"64nygnr62k-405c-4ae8-8a6b-d90b40ff3cce\"\n ],\n \"context\": \"This is an interview about wildfires.\",\n \"final_model\": \"anthropic/claude-3-5-sonnet\",\n \"temperature\": 0,\n \"max_output_size\": 3000,\n \"questions\": [\n {\n \"question\": \"Where are there wildfires?\",\n \"answer_format\": \"List of countries in ISO 3166-1 alpha-2 format\",\n \"answer_options\": [\n \"US\",\n \"CA\"\n ]\n },\n {\n \"question\": \"Is global warming affecting wildfires?\",\n \"answer_options\": [\n \"yes\",\n \"no\"\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.assemblyai.com/lemur/v3/generate/question-answer")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"transcript_ids\": [\n \"64nygnr62k-405c-4ae8-8a6b-d90b40ff3cce\"\n ],\n \"context\": \"This is an interview about wildfires.\",\n \"final_model\": \"anthropic/claude-3-5-sonnet\",\n \"temperature\": 0,\n \"max_output_size\": 3000,\n \"questions\": [\n {\n \"question\": \"Where are there wildfires?\",\n \"answer_format\": \"List of countries in ISO 3166-1 alpha-2 format\",\n \"answer_options\": [\n \"US\",\n \"CA\"\n ]\n },\n {\n \"question\": \"Is global warming affecting wildfires?\",\n \"answer_options\": [\n \"yes\",\n \"no\"\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.assemblyai.com/lemur/v3/generate/question-answer")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"transcript_ids\": [\n \"64nygnr62k-405c-4ae8-8a6b-d90b40ff3cce\"\n ],\n \"context\": \"This is an interview about wildfires.\",\n \"final_model\": \"anthropic/claude-3-5-sonnet\",\n \"temperature\": 0,\n \"max_output_size\": 3000,\n \"questions\": [\n {\n \"question\": \"Where are there wildfires?\",\n \"answer_format\": \"List of countries in ISO 3166-1 alpha-2 format\",\n \"answer_options\": [\n \"US\",\n \"CA\"\n ]\n },\n {\n \"question\": \"Is global warming affecting wildfires?\",\n \"answer_options\": [\n \"yes\",\n \"no\"\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"request_id": "5e1b27c2-691f-4414-8bc5-f14678442f9e",
"usage": {
"input_tokens": 27,
"output_tokens": 3
},
"response": [
{
"answer": "CA, US",
"question": "Where are there wildfires?"
},
{
"answer": "yes",
"question": "Is global warming affecting wildfires?"
}
]
}{
"error": "This is a sample error message"
}{
"error": "Authentication error, API token missing/invalid"
}{
"error": "Not found"
}{
"error": "Too Many Requests"
}{
"error": "Internal Server Error"
}Body
application/json
Params to ask questions about the transcripts
The model that is used for the final prompt after compression is performed.
Available options:
anthropic/claude-3-5-sonnet, anthropic/claude-3-opus, anthropic/claude-3-haiku, anthropic/claude-3-sonnet, anthropic/claude-2-1, anthropic/claude-2, default, anthropic/claude-instant-1-2, basic, assemblyai/mistral-7b