Class: OpenAI::Models::Live::SessionResource

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/openai/models/live/session_resource.rb,
sig/openai/models/live/session_resource.rbs

Defined Under Namespace

Modules: Delegation, Model Classes: Audio

Instance Attribute Summary collapse

Attributes inherited from Internal::Type::BaseModel

#last_response

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], #_request_id, #_set_last_response, coerce, #deconstruct_keys, #deep_to_h, dump, #encode_with, fields, hash, #hash, inherited, #inspect, inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, coerce_with_error, dump, #dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(id:, expires_at:, model:, audio: nil, client: nil, delegation: nil, input: nil, instructions: nil, store: nil, status: :active) ⇒ Object

The resolved Live session configuration and server-assigned session metadata.

Parameters:

  • id (String)

    The unique ID of the Live session. Use this ID for sideband connections, forking, and recording download.

  • expires_at (Integer)

    The Unix timestamp, in seconds, at which the Live session expires.

  • model (String, Symbol, OpenAI::Models::Live::SessionResource::Model)

    The Live model. Required in the session configuration for every transport; do not pass it as a URL query parameter.

  • audio (OpenAI::Models::Live::SessionResource::Audio) (defaults to: nil)

    Startup audio configuration. Only primary WebSockets accept audio.format; WebRTC and SIP negotiate their media format. Voice and format are immutable after startup.

  • client (OpenAI::Models::Live::ClientConfig) (defaults to: nil)

    Startup-only capabilities for an untrusted frontend attached to a unified WebRTC session. Trusted sideband connections are unaffected.

  • delegation (OpenAI::Models::Live::ClientDelegation, OpenAI::Models::Live::SessionResource::Delegation::Responses, nil) (defaults to: nil)

    Who handles tasks delegated by the Live model. Omitted or null selects your application; use responses to let the API manage a Responses backend.

  • input (Array<OpenAI::Models::Live::InitialItem::Developer, OpenAI::Models::Live::InitialItem::User, OpenAI::Models::Live::InitialItem::Assistant>) (defaults to: nil)

    Ordered text-only history supplied before startup. Supports developer, user, and assistant messages with one text part each; at most 128 messages and 8,192 rendered tokens in total.

  • instructions (String, nil) (defaults to: nil)

    Frontend instructions for voice, conversation, interruptions, and when to delegate. Start with the Live prompting guide; put business rules and tool workflows in a separate backend prompt. Limited to 16,384 client-supplied tokens. Omitted or blank instructions use server defaults. Immutable after startup.

  • store (Boolean) (defaults to: nil)

    Whether to store the session for later forking and recording download. Defaults to false for new sessions.

  • status (Symbol, :active) (defaults to: :active)

    The status of the session snapshot. Always active, including the final snapshot in session.closed; use the event type to determine that the session has closed.



# File 'lib/openai/models/live/session_resource.rb', line 84

Instance Attribute Details

#audioOpenAI::Models::Live::SessionResource::Audio?

Startup audio configuration. Only primary WebSockets accept audio.format; WebRTC and SIP negotiate their media format. Voice and format are immutable after startup.



41
# File 'lib/openai/models/live/session_resource.rb', line 41

optional :audio, -> { OpenAI::Live::SessionResource::Audio }

#clientOpenAI::Models::Live::ClientConfig?

Startup-only capabilities for an untrusted frontend attached to a unified WebRTC session. Trusted sideband connections are unaffected.

Parameters:

  • (OpenAI::Live::ClientConfig)

Returns:



48
# File 'lib/openai/models/live/session_resource.rb', line 48

optional :client, -> { OpenAI::Live::ClientConfig }

#delegationOpenAI::Models::Live::ClientDelegation, ...

Who handles tasks delegated by the Live model. Omitted or null selects your application; use responses to let the API manage a Responses backend.

Parameters:

  • value (OpenAI::Models::Live::SessionResource::delegation, nil)

Returns:



55
# File 'lib/openai/models/live/session_resource.rb', line 55

optional :delegation, union: -> { OpenAI::Live::SessionResource::Delegation }, nil?: true

#expires_atInteger

The Unix timestamp, in seconds, at which the Live session expires.

Parameters:

  • value (Integer)

Returns:

  • (Integer)


18
# File 'lib/openai/models/live/session_resource.rb', line 18

required :expires_at, Integer

#idString

The unique ID of the Live session. Use this ID for sideband connections, forking, and recording download.

Parameters:

  • value (String)

Returns:

  • (String)


12
# File 'lib/openai/models/live/session_resource.rb', line 12

required :id, String

#inputArray<OpenAI::Models::Live::InitialItem::Developer, OpenAI::Models::Live::InitialItem::User, OpenAI::Models::Live::InitialItem::Assistant>?

Ordered text-only history supplied before startup. Supports developer, user, and assistant messages with one text part each; at most 128 messages and 8,192 rendered tokens in total.



63
# File 'lib/openai/models/live/session_resource.rb', line 63

optional :input, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Live::InitialItem] }

#instructionsString?

Frontend instructions for voice, conversation, interruptions, and when to delegate. Start with the Live prompting guide; put business rules and tool workflows in a separate backend prompt. Limited to 16,384 client-supplied tokens. Omitted or blank instructions use server defaults. Immutable after startup.

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


75
# File 'lib/openai/models/live/session_resource.rb', line 75

optional :instructions, String, nil?: true

#modelString, ...

The Live model. Required in the session configuration for every transport; do not pass it as a URL query parameter.

Parameters:

  • value (OpenAI::Models::Live::SessionResource::model)

Returns:



25
# File 'lib/openai/models/live/session_resource.rb', line 25

required :model, union: -> { OpenAI::Live::SessionResource::Model }

#statusSymbol, :active

The status of the session snapshot. Always active, including the final snapshot in session.closed; use the event type to determine that the session has closed.

Parameters:

  • value (:active)

Returns:

  • (Symbol, :active)


33
# File 'lib/openai/models/live/session_resource.rb', line 33

required :status, const: :active

#storeBoolean?

Whether to store the session for later forking and recording download. Defaults to false for new sessions.

Parameters:

Returns:



82
# File 'lib/openai/models/live/session_resource.rb', line 82

optional :store, OpenAI::Internal::Type::Boolean

Class Method Details

.variantsArray(String, Symbol, OpenAI::Models::Live::BuiltInVoice, OpenAI::Models::Live::CustomVoice)



# File 'lib/openai/models/live/session_resource.rb', line 216

Instance Method Details

#to_hash{

Returns:

  • ({)


64
# File 'sig/openai/models/live/session_resource.rbs', line 64

def to_hash: -> {