vllm_omni.entrypoints.duplex.realtime_input ¶
Thin OpenAI Realtime wire envelope for one websocket connection.
Everything that needed session state now lives engine-side (vllm_omni.engine.duplex.realtime_commands for the command mapping, vllm_omni.engine.duplex.realtime_events for the projection state), and the model-agnostic parsing both of those build on lives in vllm_omni.protocol.realtime. What is left here is the per-connection handshake policy (query-param defaults, autostart / resume-only rules, session.resume parsing), the wire defaults used to translate appends, and error rendering through the typed :class:~vllm_omni.engine.duplex.events.ErrorEvent.
ENVELOPE_EVENT_TYPES module-attribute ¶
ENVELOPE_EVENT_TYPES = frozenset(
{"session.resume", "session.event_ack"}
)
RealtimeEnvelope dataclass ¶
Per-connection Realtime wire policy (no session state).
autostarted_default_session class-attribute instance-attribute ¶
autostarted_default_session: bool = False
defaults class-attribute instance-attribute ¶
defaults: RealtimeInputDefaults = field(
default_factory=RealtimeInputDefaults
)
command_error_payload staticmethod ¶
command_error_payload(
exc: DuplexCommandError,
) -> dict[str, object]
error_payload staticmethod ¶
error_payload(
code: str,
message: str,
*,
event_id: object | None = None,
param: object | None = None,
) -> dict[str, object]
Wire JSON of a transport-level error (derived from the typed ErrorEvent).
first_message ¶
first_message(
payload: Mapping[str, object],
) -> RealtimeHandshake
Classify the first client message (call only while not opened).
session.update opens with its session object; session.resume resumes; any other event autostarts the default session and is then treated as a command (pending_command_payload).
from_query_params classmethod ¶
from_query_params(
query_params: Mapping[str, str] | WebSocket,
) -> RealtimeEnvelope
initial_open_payload ¶
Session object to open with before any client message (?model= autostart), else None.
note_session_payload ¶
Track wire defaults declared by a session object (open or session.update).
translate ¶
translate(payload: Mapping[str, object]) -> DuplexCommand
Wire event -> command (raises :class:DuplexCommandError).
RealtimeHandshake dataclass ¶
ResumeRequest dataclass ¶
parse_resume_request ¶
parse_resume_request(
event: Mapping[str, object],
) -> ResumeRequest | None
Validate the shape of session.resume; None when any field is missing or malformed.