Skip to content

API Reference parrot.voice.transcriber.transcriber

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.voice.transcriber.transcriber

View source

Voice Transcriber Service.

Main service that orchestrates voice transcription. Selects the appropriate backend based on configuration, handles audio downloads from URLs, manages temp files, and provides the unified interface used by integration wrappers (MS Teams, Telegram, etc.).

Originally part of FEAT-008 (MS Teams Voice Note Support), refactored to shared location for FEAT-039.

Alias AbstractTranscriberBackend

Re-exported from parrot.voice.transcriber.backend.AbstractTranscriberBackend.

Alias FasterWhisperBackend

Re-exported from parrot.voice.transcriber.faster_whisper_backend.FasterWhisperBackend.

Alias OpenAIWhisperBackend

Re-exported from parrot.voice.transcriber.openai_backend.OpenAIWhisperBackend.

Alias TranscriberBackend

Re-exported from parrot.voice.transcriber.models.TranscriberBackend.

Alias TranscriptionResult

Re-exported from parrot.voice.transcriber.models.TranscriptionResult.

Class VoiceTranscriber

Voice transcription service.

Manages transcription backend lifecycle and provides a unified interface for transcribing audio files and URLs.

The backend is lazily created on first use. Use close() to release backend resources when done.

Example::

config = VoiceTranscriberConfig(
    backend=TranscriberBackend.FASTER_WHISPER,
    model_size="small",
    max_audio_duration_seconds=60,
)
transcriber = VoiceTranscriber(config)
try:
    result = await transcriber.transcribe_url(
        url="https://teams.microsoft.com/files/voice.ogg",
        auth_token="Bearer xyz"
    )
    print(f"Transcription: {result.text}")
finally:
    await transcriber.close()
Parameter Type Default Description
config VoiceTranscriberConfig Configuration for the transcriber, including backend selection, model size, language, and duration limits.

Method VoiceTranscriber.transcribe_file

Transcribe a local audio file.

transcribe_file(file_path: Path, language: Optional[str] = None) -> TranscriptionResult

Parameter Type Default Description
file_path Path Path to the audio file to transcribe.
language Optional[str] None Optional language hint (ISO 639-1 code). If None, uses config language or auto-detection.

Returns: TranscriptionResult — TranscriptionResult containing transcribed text and metadata.

Raises:

  • FileNotFoundError — If the audio file doesn't exist.
  • ValueError — If audio duration exceeds the configured limit.

Method VoiceTranscriber.transcribe_url

Download and transcribe audio from URL.

Downloads the audio to a temporary file, transcribes it, and cleans up the temp file afterwards.

transcribe_url(url: str, auth_token: Optional[str] = None, language: Optional[str] = None) -> TranscriptionResult

Parameter Type Default Description
url str URL to download the audio from.
auth_token Optional[str] None Optional authorization token for the download request. Passed as Bearer token in Authorization header.
language Optional[str] None Optional language hint for transcription.

Returns: TranscriptionResult — TranscriptionResult containing transcribed text and metadata.

Raises:

  • RuntimeError — If the download fails.
  • ValueError — If the audio duration exceeds the configured limit.

Method VoiceTranscriber.close

Release backend resources.

Should be called when the transcriber is no longer needed to free up GPU memory (for local backend) or HTTP sessions (for cloud backend).

close() -> None

Alias VoiceTranscriberConfig

Re-exported from parrot.voice.transcriber.models.VoiceTranscriberConfig.

Alias lazy_import

Re-exported from parrot._imports.lazy_import.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally