This feature is on Beta state.
We’re looking for feedbacks to improve this feature, share yours here .
The Summarization model generates a summary of your transcript.
You choose one of our summary type to customize the summarization based on your preference.
3 summarization types are available:
general
: A regular summary of the transcription
concise
: A shorter summary for quick overview
bullet_points
: Retrieve the key points in a list
If no summarization_config is provided, general
type will be used by default.
Find all this information in the API Reference (see summarization_config
).
Usage
To enable summarization simply set the "summarization"
parameter to true
{
"audio_url" : "<your audio url>"
"summarization" : true
}
In the following examples, we’re using concise
type.
async function makeFetchRequest ( url : string , options : any ) {
const response = await fetch ( url , options );
return response . json ();
}
async function pollForResult ( resultUrl : string , headers : any ) {
while ( true ) {
console . log ( "Polling for results..." );
const pollResponse = await makeFetchRequest ( resultUrl , { headers });
if ( pollResponse . status === "done" ) {
console . log ( "- Transcription done: \n " );
const summarization = pollResponse . result . summarization ;
console . log ( summarization );
break ;
} else {
console . log ( "Transcription status : " , pollResponse . status );
await new Promise (( resolve ) => setTimeout ( resolve , 1000 ));
}
}
}
async function startTranscription () {
const gladiaKey = "YOUR_GLADIA_API_KEY" ;
const requestData = {
audio_url:
"YOUR_AUDIO_URL" ,
summarization: true ,
summarization_config: {
type: "concise" // can be 'general', 'concise' or 'bullet_points'
// use 'general' if no summarization_config is provided
}
};
const gladiaUrl = "https://api.gladia.io/v2/pre-recorded/" ;
const headers = {
"x-gladia-key" : gladiaKey ,
"Content-Type" : "application/json" ,
};
console . log ( "- Sending initial request to Gladia API..." );
const initialResponse = await makeFetchRequest ( gladiaUrl , {
method: "POST" ,
headers ,
body: JSON . stringify ( requestData ),
});
console . log ( "Initial response with Transcription ID :" , initialResponse );
if ( initialResponse . result_url ) {
await pollForResult ( initialResponse . result_url , headers );
}
}
startTranscription ();
Result
The transcription result will contain a "summarization"
key with the output of the model:
{
"transcription" : { ... },
"summarization" : {
"success" : true ,
"is_empty" : false ,
"results" : "This transcription suggests that..." ,
"exec_time" : 1.5126123428344727 ,
"error" : null
}
}
You’ll find the summarization of your audio under the results
key.