AssemblyAIAudioTranscriptLoader
allows to transcribe audio files with the AssemblyAI API and loads the transcribed text into documents.
To use it, you should have the assemblyai
python package installed, and the
environment variable ASSEMBLYAI_API_KEY
set with your API key. Alternatively, the API key can also be passed as an argument.
More info about AssemblyAI:
assemblyai
python package.
You can find more info about it inside the assemblyai-python-sdk GitHub repo.
AssemblyAIAudioTranscriptLoader
needs at least the file_path
argument. Audio files can be specified as an URL or a local file path.
loader.load()
blocks until the transcription is finished.
The transcribed text is available in the page_content
:
metadata
contains the full JSON response with more meta information:
transcript_format
argument for different formats.
Depending on the format, one or more documents are returned. 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 formatconfig
argument to use different audio intelligence models.
Visit the AssemblyAI API Documentation to get an overview of all available models!
ASSEMBLYAI_API_KEY
, it is also possible to pass it as argument.