langchain_community.document_loaders.parsers.audio.OpenAIWhisperParser¶

class langchain_community.document_loaders.parsers.audio.OpenAIWhisperParser(api_key: Optional[str] = None, *, chunk_duration_threshold: float = 0.1)[source]¶

Transcribe and parse audio files.

Audio transcription is with OpenAI Whisper model.

Parameters
  • api_key (Optional[str]) – OpenAI API key

  • chunk_duration_threshold (float) – minimum duration of a chunk in seconds NOTE: According to the OpenAI API, the chunk duration should be at least 0.1 seconds. If the chunk duration is less or equal than the threshold, it will be skipped.

Methods

__init__([api_key, chunk_duration_threshold])

lazy_parse(blob)

Lazily parse the blob.

parse(blob)

Eagerly parse the blob into a document or documents.

__init__(api_key: Optional[str] = None, *, chunk_duration_threshold: float = 0.1)[source]¶
Parameters
  • api_key (Optional[str]) –

  • chunk_duration_threshold (float) –

lazy_parse(blob: Blob) Iterator[Document][source]¶

Lazily parse the blob.

Parameters

blob (Blob) –

Return type

Iterator[Document]

parse(blob: Blob) List[Document]¶

Eagerly parse the blob into a document or documents.

This is a convenience method for interactive development environment.

Production applications should favor the lazy_parse method instead.

Subclasses should generally not over-ride this parse method.

Parameters

blob (Blob) – Blob instance

Returns

List of documents

Return type

List[Document]

Examples using OpenAIWhisperParser¶