Skip to content

Index

diapason.speech.realtime

Realtime duplex voice sessions (Gemini Live / OpenAI Realtime).

RealtimeVoiceSession

Bases: ABC

Provider-agnostic duplex voice session.

close() abstractmethod async

Tear down the provider connection.

connect() abstractmethod async

Open the provider connection and finish setup.

events() abstractmethod

Async iterator of normalized session events.

interrupt() abstractmethod async

Cancel current model speech (barge-in).

send_audio(pcm16) abstractmethod async

Send a chunk of mono PCM16 at input_sample_rate.

send_text(text) abstractmethod async

Optional text turn (debug / typed barge).

SessionEvent dataclass

Normalized event emitted by a provider session toward the UI.

create_realtime_session(provider, *, model='', voice='', instructions='', language='', api_key=None, enable_tools=True, max_tool_steps=12, allowed_tools=None, sur_echange=None)

Create a provider session. Raises ValueError for unknown providers.

Raises :class:LocalOnlyError under [privacy] local_only: every realtime provider is remote, so there is no honest degradation here.