GPT-Live WebSocket session, accessible through Agent.duplexSession. Also emits openai_server_event_received, openai_client_event_queued, delegation_created and decision_event. Append methods queue context without waiting for acknowledgment. The appended events arrive at the estimated context-injection end and do not indicate speech completion.

Hierarchy (view full)

  • llm.DuplexSession<{
        decision_event: ((event) => void);
        delegation_created: ((event) => void);
        openai_client_event_queued: ((event) => void);
        openai_server_event_received: ((event) => void);
    }>
    • GPTLiveSession

    Constructors

    Properties

    duplexModel: llm.DuplexModel

    Model that created this session.

    Accessors

    • get audioStream(): ReadableStream<DuplexAudioFrame>
    • Mono 24 kHz PCM output, retained across reconnects and closed on shutdown.

      Returns ReadableStream<DuplexAudioFrame>

    • get capabilities(): DuplexCapabilities
    • Provider features declared by the owning model.

      Returns DuplexCapabilities

    • get sessionId(): undefined | string
    • Provider session identifier. Changes when a replacement connection starts.

      Returns undefined | string

    • get tools(): ToolContext<unknown>
    • Copy of the tools available to the backend Responses model.

      Returns ToolContext<unknown>

    Methods

    • Retain framework chat items for reconnects and send their context or tool results.

      Parameters

      Returns Promise<void>

    • Prompt an immediate spoken reply to instructions or the newest typed user message.

      Parameters

      • Optional instructions: string

      Returns void

    • Set the initial voice instructions. Changes after session.start are rejected.

      Parameters

      • instructions: string

      Returns Promise<void>

    • Update backend tool selection for this session and future reconnects.

      Parameters

      Returns void

    • Apply the complete startup configuration before releasing a waiting provider connection.

      Parameters

      Returns Promise<void>

    • Update backend tools. Non-Responses delegation requires an empty tool context.

      Parameters

      Returns Promise<void>

    • Give the model text to paraphrase aloud, or answer a client delegation. Capped at 500 tokens by the service.

      Parameters

      • text: string
      • Optional options: {
            delegationId?: null | string;
        }
        • Optional delegationId?: null | string

      Returns void

    • Add a standing rule retained in reconnect history. The service caps each append at 500 tokens.

      Parameters

      • text: string
      • Optional options: {
            delegationId?: null | string;
        }
        • Optional delegationId?: null | string

      Returns void

    • Add silent context retained in reconnect history. The service caps each append at 500 tokens.

      Parameters

      • text: string
      • Optional options: {
            delegationId?: null | string;
        }
        • Optional delegationId?: null | string

      Returns void

    • Mark the session closing, release configuration waits, and close provider resources.

      Returns Promise<void>

    • Evaluate the Decisions delegation's questions on the current connection. Returns the command event id. Requests are not replayed after reconnecting. Throws if the connection is draining or the session is closing or closed.

      Returns string

    • Replace microphone input with silence while the model continues speaking. The state is remembered and re-applied to any session a reconnect opens.

      Returns void

    • Buffer microphone audio, mixing to mono and resampling to 24 kHz as needed.

      Parameters

      • frame: AudioFrame

      Returns void

    • Feed an input video frame. Providers without video input can ignore it.

      Parameters

      • _frame: VideoFrame

      Returns void

    • Queue a wire event. Commands wait for session.started before being sent.

      Parameters

      Returns void

    • Restore microphone input.

      Returns void