Enable Auto Chapters by setting auto_chapters to true in the transcription config. punctuate must be enabled to use Auto Chapters (punctuate is enabled by default).
import { AssemblyAI } from 'assemblyai'const client = new AssemblyAI({ apiKey: 'YOUR_API_KEY'})// const audioFile = './local_file.mp3'const audioFile = 'https://assembly.ai/wildfires.mp3'const params = { audio: audioFile, auto_chapters: true}const run = async () => { const transcript = await client.transcripts.transcribe(params) for (const chapter of transcript.chapters!) { console.log(`${chapter.start}-${chapter.end}: ${chapter.headline}`) }}run()
package mainimport ( "context" "fmt" aai "github.com/AssemblyAI/assemblyai-go-sdk")func main() { client := aai.NewClient("YOUR_API_KEY") // For local files see our Getting Started guides. audioURL := "https://assembly.ai/wildfires.mp3" ctx := context.Background() transcript, _ := client.Transcripts.TranscribeFromURL(ctx, audioURL, &aai.TranscriptOptionalParams{ AutoChapters: aai.Bool(true), }) for _, chapter := range transcript.Chapters { fmt.Printf("%d-%d: %s", aai.ToInt64(chapter.Start), aai.ToInt64(chapter.End), aai.ToString(chapter.Headline), ) }}
import com.assemblyai.api.AssemblyAI;import com.assemblyai.api.resources.transcripts.types.*;public final class App { public static void main(String[] args) { AssemblyAI client = AssemblyAI.builder() .apiKey("YOUR_API_KEY") .build(); // For local files see our Getting Started guides. String audioUrl = "https://assembly.ai/wildfires.mp3"; var params = TranscriptOptionalParams.builder() .autoChapters(true) .build(); Transcript transcript = client.transcripts().transcribe(audioUrl, params); var chapters = transcript.getChapters().get(); chapters.forEach(chapter -> { System.out.println(chapter.getStart() + " - " + chapter.getEnd() + ": " +chapter.getHeadline()); }); }}
using AssemblyAI;using AssemblyAI.Transcript;var client = new AssemblyAIClient("YOUR_API_KEY");var transcript = await client.Transcripts.TranscribeAsync(new TranscriptParams{ // For local files see our Getting Started guides. AudioUrl = "https://assembly.ai/wildfires.mp3", AutoChapters = true});foreach (var chapter in transcript.Chapters!){ Console.WriteLine($"{chapter.Start}-{chapter.End}: {chapter.Headline}");}
require 'assemblyai'client = AssemblyAI::Client.new(api_key: 'YOUR_API_KEY')# For local files see our Getting Started guides.audio_url = 'https://assembly.ai/wildfires.mp3'transcript = client.transcripts.transcribe( audio_url: audio_url, auto_chapters: true)transcript.chapters.each do |chapter| printf( '%<start>d-%<end>d: %<headline>s', start: chapter.start, end: chapter.end_, headline: chapter.headline )end
250-28840: Smoke from hundreds of wildfires in Canada is triggering air quality alerts across US29610-280340: High particulate matter in wildfire smoke can lead to serious health problems
Can I specify the number of chapters to be generated by the Auto Chapters model?
No, the number of chapters generated by the Auto Chapters model isn’t configurable by the user. The model automatically segments the audio file into logical chapters as the topic of conversation changes.
Why am I not getting any chapter predictions for my audio file?
One possible reason is that the audio file doesn’t contain enough variety in topic or tone for the model to identify separate chapters. Another reason could be due to background noise or low-quality audio interfering with the model’s analysis.