Looking for the JavaScript integration? Check out the LlamaIndex.TS integration.
Quickstart
First, install theassemblyai python package.
ASSEMBLYAI_API_KEY. You can get a free AssemblyAI API key from the AssemblyAI dashboard.
- To load and transcribe audio data into documents, import the
AssemblyAIAudioTranscriptReader. TheAssemblyAIAudioTranscriptReaderneeds at least thefile_pathargument. - Configure the
file_pathargument with a URL or a local file path to an audio or video file.
reader.load_data() waits until the transcription is ready.reader.load_data() method returns an array of documents, but by default, there’s only one document in the array with the full transcript. The transcribed text is available in the text attribute:
metadata contains the full transcript object with more meta information:
Transcript formats
You can specify thetranscript_format argument to load the transcript in different formats.
Depending on the format, load_data() returns either one or more documents. These are the different TranscriptFormat options:
TEXT: One document with the transcription textSENTENCES: Multiple documents, splits the transcription by each sentencePARAGRAPHS: Multiple documents, splits the transcription by each paragraphSUBTITLES_SRT: One document with the transcript exported in SRT subtitles formatSUBTITLES_VTT: One document with the transcript exported in VTT subtitles format
Transcription config
You can also specify theconfig argument to use different audio intelligence models.