Skip to main content

AssemblyAI Audio Transcript Loader

pip install llama-index-readers-assemblyai

The AssemblyAI Audio Transcript Loader 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:

Usage

The AssemblyAIAudioTranscriptReader needs at least the file_path argument. Audio files can be specified as an URL or a local file path.

from llama_index.readers.assemblyai import AssemblyAIAudioTranscriptReader

audio_file = "https://storage.googleapis.com/aai-docs-samples/nbc.mp3"
# or a local file path: audio_file = "./nbc.mp3"

reader = AssemblyAIAudioTranscriptReader(file_path=audio_file)

docs = reader.load_data()

Note: Calling reader.load_data() blocks until the transcription is finished.

The transcribed text is available in the text:

docs[0].text
# "Load time, a new president and new congressional makeup. Same old ..."

The metadata contains the full JSON response with more meta information:

docs[0].metadata
# {'language_code': <LanguageCode.en_us: 'en_us'>,
#  'audio_url': 'https://storage.googleapis.com/aai-docs-samples/nbc.mp3',
#  'punctuate': True,
#  'format_text': True,
#   ...
# }

Transcript Formats

You can specify the 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 text
  • SENTENCES: Multiple documents, splits the transcription by each sentence
  • PARAGRAPHS: Multiple documents, splits the transcription by each paragraph
  • SUBTITLES_SRT: One document with the transcript exported in SRT subtitles format
  • SUBTITLES_VTT: One document with the transcript exported in VTT subtitles format
from llama_index.readers.assemblyai import TranscriptFormat

reader = AssemblyAIAudioTranscripReader(
    file_path="./your_file.mp3",
    transcript_format=TranscriptFormat.SENTENCES,
)

docs = reader.load_data()

Transcription Config

You can also specify the config argument to use different audio intelligence models.

Visit the AssemblyAI API Documentation to get an overview of all available models!

import assemblyai as aai

config = aai.TranscriptionConfig(
    speaker_labels=True, auto_chapters=True, entity_detection=True
)

reader = AssemblyAIAudioTranscriptReader(
    file_path="./your_file.mp3", config=config
)

Pass the API Key as argument

Next to setting the API key as environment variable ASSEMBLYAI_API_KEY, it is also possible to pass it as argument.

reader = AssemblyAIAudioTranscriptReader(
    file_path="./your_file.mp3", api_key="YOUR_KEY"
)

Metadata

Release files for llama-index-readers-assemblyai 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llama-index-readers-assemblyai 0.6.0
File Size Uploaded Provenance Actions
llama_index_readers_assemblyai-0.6.0.tar.gz 5.0 kB Without provenance Details for llama_index_readers_assemblyai-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-readers-assemblyai 0.6.0
File Interpreter ABI Platform Actions
llama_index_readers_assemblyai-0.6.0-py3-none-any.whl Python 3 none any Details for llama_index_readers_assemblyai-0.6.0-py3-none-any.whl

Total release size: 9.9 kB

Release files / llama_index_readers_assemblyai-0.6.0.tar.gz

Download URL llama_index_readers_assemblyai-0.6.0.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b34c32e4ed64b3f43c6bbada8b0d17032fe2d0191b552afc67a9460c1b106870
BLAKE2b-256 checksum
How to use checksums
7abb362b2a4384dda07b15c5ee5a35c7d172b638a656094d12cfc0631511a008
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / llama_index_readers_assemblyai-0.6.0-py3-none-any.whl

Download URL llama_index_readers_assemblyai-0.6.0-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
48acb80b12cea9376327a560d443c1c625b37d5577d3a1111cc8d7583daae638
BLAKE2b-256 checksum
How to use checksums
77689e734882a43f33384f5ea20184b62a096b11813d0a1572978e0d602b280d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for llama-index-readers-assemblyai 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page