OpenAILiveAdapter
Defined in: packages/realtime-openai-live/src/live-adapter.ts:152
Connects managed Live Responses to RealtimeSession’s existing UI tools. Completed function items are collected before the terminal batch is dispatched. Every result is submitted before one explicit continuation. Local submission does not prove provider acceptance or speech. Closing voice never cancels submitted application work; late results cannot enter a new connection. Deduplication lasts for the connection, with hard capacity bounds instead of eviction that could repeat effects. Generated opening is opt-in; reconnect is explicit.
Implements
Section titled “Implements”RealtimeProviderAdapter
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new OpenAILiveAdapter(
options):OpenAILiveAdapter
Defined in: packages/realtime-openai-live/src/live-adapter.ts:183
Creates an inert adapter. Invalid bounds throw before any media acquisition.
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”OpenAILiveAdapter
Properties
Section titled “Properties”generatedOpening
Section titled “generatedOpening”
readonlygeneratedOpening:object
Defined in: packages/realtime-openai-live/src/live-adapter.ts:156
Native instruction append; acceptance is not speech completion. The complete instruction, including its fixed prefix, must fit 500 UTF-8 bytes. Rejection consumes the attempt.
readiness
Section titled “readiness”readiness:
object
Playback acceptance gates the introduction claim without delaying microphone or transport startup.
readiness.getSnapshot
Section titled “readiness.getSnapshot”getSnapshot: () =>
boolean
Reports playback acceptance for the current transport generation, not audibility.
Returns
Section titled “Returns”boolean
readiness.subscribe
Section titled “readiness.subscribe”subscribe: (
handler) => () =>void
Observes output-readiness changes until the returned disposer is called.
Parameters
Section titled “Parameters”handler
Section titled “handler”() => void
Returns
Section titled “Returns”() => void
request
Section titled “request”request: (
instructions) =>Promise<void>
Parameters
Section titled “Parameters”instructions
Section titled “instructions”string
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”RealtimeProviderAdapter.generatedOpening
observations
Section titled “observations”
readonlyobservations:AdapterVoiceObservations
Defined in: packages/realtime-openai-live/src/live-adapter.ts:154
Continuous media and captions from the transport, without fabricated final turns.
Implementation of
Section titled “Implementation of”RealtimeProviderAdapter.observations
recovery
Section titled “recovery”
readonlyrecovery:object
Defined in: packages/realtime-openai-live/src/live-adapter.ts:170
Quiet updates for outcomes from earlier connections. Current calls use function results; retained functions are never replayed.
update
Section titled “update”update: (
snapshot) =>void
Parameters
Section titled “Parameters”snapshot
Section titled “snapshot”VoiceRecoverySnapshot
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”RealtimeProviderAdapter.recovery
Methods
Section titled “Methods”activateAudio()
Section titled “activateAudio()”activateAudio():
Promise<void>
Defined in: packages/realtime-openai-live/src/live-adapter.ts:442
Retries blocked playback within a user action; resolution is not audibility evidence.
Returns
Section titled “Returns”Promise<void>
connect()
Section titled “connect()”connect(
options):Promise<void>
Defined in: packages/realtime-openai-live/src/live-adapter.ts:230
Starts managed delegation. Conversation instructions and backend tool instructions use separate configuration fields.
Parameters
Section titled “Parameters”options
Section titled “options”AdapterConnectOptions
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”RealtimeProviderAdapter.connect
disconnect()
Section titled “disconnect()”disconnect():
Promise<void>
Defined in: packages/realtime-openai-live/src/live-adapter.ts:433
Stops voice immediately and bounds provider finalization without awaiting application work.
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”RealtimeProviderAdapter.disconnect
getAudioStreams()
Section titled “getAudioStreams()”getAudioStreams():
AdapterAudioStreams
Defined in: packages/realtime-openai-live/src/live-adapter.ts:438
Returns the transport’s current streams for metering.
Returns
Section titled “Returns”AdapterAudioStreams
Implementation of
Section titled “Implementation of”RealtimeProviderAdapter.getAudioStreams
getTransportSnapshot()
Section titled “getTransportSnapshot()”getTransportSnapshot():
LiveTransportSnapshot
Defined in: packages/realtime-openai-live/src/live-adapter.ts:446
Returns detached transport evidence, including final usage and playback acceptance.
Returns
Section titled “Returns”injectGrounding()
Section titled “injectGrounding()”injectGrounding(
text):void
Defined in: packages/realtime-openai-live/src/live-adapter.ts:486
Appends at most 400 UTF-8 bytes of observed structural context as quiet data. One pending acknowledgment and one latest update bound context state. Acknowledgment and timeout never imply spoken delivery; unchanged context is skipped.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”RealtimeProviderAdapter.injectGrounding
on(
handler): () =>void
Defined in: packages/realtime-openai-live/src/live-adapter.ts:450
Subscribes to tool calls and lifecycle events. Observer exceptions cannot interrupt another observer.
Parameters
Section titled “Parameters”handler
Section titled “handler”(event) => void
Returns
Section titled “Returns”() => void
Implementation of
Section titled “Implementation of”RealtimeProviderAdapter.on
sendToolResult()
Section titled “sendToolResult()”sendToolResult(
callId,output):Promise<void>
Defined in: packages/realtime-openai-live/src/live-adapter.ts:466
Records a settled application result. Resolution means local handling only. Duplicate results keep the first value. Results after close are discarded from provider delivery while the owning RealtimeSession retains its outcome. The complete result must support JSON serialization and fit within 262,144 UTF-16 code units after serialization. Invalid or oversized results terminate voice and emit DATA_CHANNEL_ERROR while this promise resolves. Observe error events rather than relying on promise rejection. Submitted application work is not undone.
Parameters
Section titled “Parameters”callId
Section titled “callId”ToolCallId
output
Section titled “output”ToolResult
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”RealtimeProviderAdapter.sendToolResult