vllm_omni.engine.duplex.config ¶
Session configuration, capabilities and value types of the duplex session model.
These classes are the typed half of the public contract: DuplexOmni accepts a DuplexSessionConfig (or the equivalent OpenAI Realtime session object via :meth:DuplexSessionConfig.from_realtime) and reports DuplexCapabilities. They used to live in entrypoints/duplex/protocol.py.
DuplexAssistantAudioTextMark dataclass ¶
DuplexAudioChunk dataclass ¶
DuplexCapabilities dataclass ¶
Runtime/model capabilities exposed by the duplex serving protocol.
These are intentionally explicit so the serving layer does not assume all duplex models support the same input append, rollback, or turn policy. supports_core_kv_lease is reserved for scheduler-owned KV lifecycle; model-owned decoder/TTS state must use supports_model_internal_state. supports_core_resumable_request means the scheduler can resume the same request id across streaming updates, but it is not a KV lease by itself. Realtime support means this endpoint can speak the native Realtime event schema for the supported audio duplex paths while keeping model- or scheduler-specific limits explicit in the capability payload.
adapter_patterns class-attribute instance-attribute ¶
optional_input_modalities class-attribute instance-attribute ¶
required_input_modalities class-attribute instance-attribute ¶
requires_model_runner_kv class-attribute instance-attribute ¶
requires_model_runner_kv: bool = False
requires_native_stage_role class-attribute instance-attribute ¶
requires_native_stage_role: bool = False
session_admission_mode class-attribute instance-attribute ¶
session_admission_mode: str = 'serving_managed'
signal_sources class-attribute instance-attribute ¶
signal_sources: list[str] = field(
default_factory=lambda: [
"client_event",
"server_policy",
"model_native",
]
)
stage_handoff_transport class-attribute instance-attribute ¶
stage_handoff_transport: str | None = None
supports_chat_completions class-attribute instance-attribute ¶
supports_chat_completions: bool = False
supports_concurrent_turn_requests class-attribute instance-attribute ¶
supports_concurrent_turn_requests: bool = False
supports_core_resumable_request class-attribute instance-attribute ¶
supports_core_resumable_request: bool = False
supports_external_turn_signal class-attribute instance-attribute ¶
supports_external_turn_signal: bool = True
supports_independent_io_streams class-attribute instance-attribute ¶
supports_independent_io_streams: bool = False
supports_model_internal_state class-attribute instance-attribute ¶
supports_model_internal_state: bool = False
supports_model_native_turn_policy class-attribute instance-attribute ¶
supports_model_native_turn_policy: bool = False
supports_multi_session_same_replica class-attribute instance-attribute ¶
supports_multi_session_same_replica: bool = False
supports_realtime_endpoint class-attribute instance-attribute ¶
supports_realtime_endpoint: bool = False
supports_reencode_context class-attribute instance-attribute ¶
supports_reencode_context: bool = True
supports_replace_latest_chunk class-attribute instance-attribute ¶
supports_replace_latest_chunk: bool = True
supports_rollback_to_checkpoint class-attribute instance-attribute ¶
supports_rollback_to_checkpoint: bool = False
supports_scheduler_native_append class-attribute instance-attribute ¶
supports_scheduler_native_append: bool = False
supports_stage_connector_handoff class-attribute instance-attribute ¶
supports_stage_connector_handoff: bool = False
supports_stage_resumption class-attribute instance-attribute ¶
supports_stage_resumption: bool = False
supports_turn_commit_only class-attribute instance-attribute ¶
supports_turn_commit_only: bool = True
target_barge_in_latency_ms class-attribute instance-attribute ¶
target_barge_in_latency_ms: int | None = 1000
DuplexCommittedInput dataclass ¶
DuplexConfigError ¶
Bases: ValueError
A Realtime session/response object was rejected while mapping it onto the duplex config.
DuplexOverlapPolicy ¶
DuplexPlaybackCommitPolicy ¶
DuplexPlaybackCursor dataclass ¶
DuplexPlaybackView dataclass ¶
DuplexSessionConfig dataclass ¶
extra_body class-attribute instance-attribute ¶
modalities class-attribute instance-attribute ¶
overlap_policy class-attribute instance-attribute ¶
overlap_policy: str = DuplexOverlapPolicy.LISTEN_ONLY.value
playback_commit_policy class-attribute instance-attribute ¶
playback_commit_policy: str = (
DuplexPlaybackCommitPolicy.COMMIT_ALL_ON_DONE.value
)
apply_realtime_update ¶
apply_realtime_update(
patch: Mapping[str, object],
*,
session_id: str | None = None,
audio_started: bool = False,
) -> None
Apply a Realtime session.update patch in place.
Raises :class:DuplexConfigError (code in model_update_unsupported, voice_update_after_audio_unsupported, ref_audio_update_unsupported) when the patch changes something a live session cannot change. audio_started is playback.generated_ms > 0 or playback.sent_ms > 0.
from_realtime classmethod ¶
from_realtime(
session_payload: Mapping[str, object],
*,
model: str | None = None,
) -> DuplexSessionConfig
Build a config from an OpenAI Realtime session object (session.update / open_session).
Applies the wire defaults, validates audio formats and turn detection (raising :class:DuplexConfigError with the same codes the Realtime translator used), fills turn_detection defaults / derives overlap_policy, and stores the Realtime-only fields under the realtime_* keys of extra_body exactly like the old _session_create_from_realtime.
normalized ¶
normalized() -> DuplexSessionConfig
Apply the clamps / defaults from_event applies to a wire object (typed configs skip them).
DuplexSessionState ¶
DuplexTurnEventType ¶
ResponseCreateOptions dataclass ¶
extra_body class-attribute instance-attribute ¶
from_realtime classmethod ¶
from_realtime(
response_payload: Mapping[str, object],
*,
private_runtime_config_keys: frozenset[
str
] = frozenset(),
) -> ResponseCreateOptions
Parse an OpenAI Realtime response object into response-scoped options.
Raises :class:DuplexConfigError (code="unsupported_native_response_options") for options a model-native duplex session cannot apply per response. Private runtime keys in extra_body are dropped.
input_audio_transcription_config ¶
input_audio_transcription_config(
session_payload: Mapping[str, object],
) -> dict[str, object] | None
Return the input_audio_transcription object of a Realtime session payload.
realtime_item_to_history_message ¶
Convert a Realtime conversation item into a chat history message (None when empty).