Skip to content

API Reference parrot.voice.transcriber.gemini_backend

github-actions[bot] edited this page Dec 2, 2026 · 1 revision

parrot.voice.transcriber.gemini_backend

View source

Gemini Backend for Voice Transcription.

Cloud-based speech to text with a Gemini model. The call goes through GoogleGenAIClient.transcribe_audio (never the SDK directly), so it uses the server's Google credentials the same way every other Gemini call does: GOOGLE_API_KEY, or Vertex AI when the client is configured for it.

Alias AbstractTranscriberBackend

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

Class GeminiTranscriberBackend

Transcription backend that wraps GoogleGenAIClient.transcribe_audio.

Example::

backend = GeminiTranscriberBackend()
try:
    result = await backend.transcribe(Path("/path/to/audio.wav"), language="es-ES")
    print(result.text)
finally:
    await backend.close()
Parameter Type Default Description
client Optional['GoogleGenAIClient'] None An already-instantiated GoogleGenAIClient. When None (default), one is created lazily on first use from **kwargs. Injecting a client is the recommended pattern for unit tests.
model Optional[str] None Gemini model id (e.g. "gemini-3.8-flash"). None uses the client method's default model.
**kwargs Any {} Forwarded verbatim to GoogleGenAIClient(**kwargs) during lazy creation (e.g. api_key=, vertexai=).

Method GeminiTranscriberBackend.transcribe

Transcribe an audio file with Gemini.

transcribe(audio_path: Path, language: Optional[str] = None) -> TranscriptionResult

Parameter Type Default Description
audio_path Path Path to the audio file (WAV, MP3, OGG, FLAC, AAC, M4A, WebM).
language Optional[str] None Optional language hint, as an ISO 639-1 code ("es") or a BCP-47 tag ("es-ES"). None lets Gemini detect it.

Returns: TranscriptionResult — TranscriptionResult with the transcript. language is the primary subtag of the hint, or "und" when no hint was given; duration_seconds is 0.0 because Gemini does not report it.

Raises:

  • FileNotFoundError — If the audio file does not exist.
  • ValueError — If the language hint is not a language tag or the audio is empty.
  • RuntimeError — If the Gemini call fails.

Method GeminiTranscriberBackend.close

Close the Google client when this backend created it.

close() -> None

Alias GoogleGenAIClient

Re-exported from parrot.clients.google.GoogleGenAIClient.

Alias TranscriptionResult

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

Alias primary_language_subtag

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

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