mirror of
https://github.com/langchain-ai/langchain.git
synced 2026-10-09 19:35:20 +03:00
Uses the shorter import path `from langchain.document_loaders import` instead of the full path `from langchain.document_loaders.assemblyai` Applies those changes to the docs and the unit test. See #9667 that adds this new loader.
5.8 KiB
5.8 KiB
In [ ]:
#!pip install assemblyaiIn [ ]:
from langchain.document_loaders import AssemblyAIAudioTranscriptLoader
audio_file = "https://storage.googleapis.com/aai-docs-samples/nbc.mp3"
# or a local file path: audio_file = "./nbc.mp3"
loader = AssemblyAIAudioTranscriptLoader(file_path=audio_file)
docs = loader.load()In [ ]:
docs[0].page_contentIn [ ]:
docs[0].metadataIn [ ]:
from langchain.document_loaders.assemblyai import TranscriptFormat
loader = AssemblyAIAudioTranscriptLoader(
file_path="./your_file.mp3",
transcript_format=TranscriptFormat.SENTENCES,
)
docs = loader.load()In [ ]:
import assemblyai as aai
config = aai.TranscriptionConfig(speaker_labels=True,
auto_chapters=True,
entity_detection=True
)
loader = AssemblyAIAudioTranscriptLoader(
file_path="./your_file.mp3",
config=config
)In [ ]:
loader = AssemblyAIAudioTranscriptLoader(
file_path="./your_file.mp3",
api_key="YOUR_KEY"
)