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_cached, coerce_with_error, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, resolve_type, 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, safety_identifier: nil, store: nil, triggers: nil, status: :active) ⇒ SessionResource

Returns a new instance of SessionResource.

Parameters:

  • id —

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

  • expires_at —

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

  • model —

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

  • 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 (defaults to: nil) —

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

  • delegation (defaults to: nil) —

    Who handles tasks delegated by the Live model. Omitted or null selects your application; use responses or decisions to delegate to the corresponding API.

  • input (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 a configured rendered-token limit (8,192 by default).

  • instructions (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.

  • safety_identifier (defaults to: nil) —

    A stable identifier for your end user, used for safety monitoring and abuse detection.

  • store (defaults to: nil) —

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

  • triggers (defaults to: nil) —

    At most one Decisions trigger per transcript event type. Triggers run independently of delegation. On update, omit triggers to keep the current configuration, send a list to replace it, or send an empty list to disable triggers.

  • status (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.

  • id: (String)
  • expires_at: (Integer)
  • model: (OpenAI::Models::Live::SessionResource::model)
  • audio: (OpenAI::Live::SessionResource::Audio) (defaults to: nil)
  • client: (OpenAI::Live::ClientConfig) (defaults to: nil)
  • delegation: (OpenAI::Models::Live::SessionResource::delegation, nil) (defaults to: nil)
  • input: (::Array[OpenAI::Models::Live::initial_item]) (defaults to: nil)
  • instructions: (String, nil) (defaults to: nil)
  • safety_identifier: (String, nil) (defaults to: nil)
  • store: (Boolean) (defaults to: nil)
  • triggers: (::Array[OpenAI::Live::DecisionTrigger]) (defaults to: nil)
  • status: (:active) (defaults to: :active)


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

Instance Attribute Details

#audio ⇒ OpenAI::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.

Returns:

  • (OpenAI::Live::SessionResource::Audio, nil)


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

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

#client ⇒ OpenAI::Live::ClientConfig?

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

Returns:

  • (OpenAI::Live::ClientConfig, nil)


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

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

#delegation ⇒ OpenAI::Models::Live::SessionResource::delegation?

Who handles tasks delegated by the Live model. Omitted or null selects your application; use responses or decisions to delegate to the corresponding API.

Returns:

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


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

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

#expires_at ⇒ Integer

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

Returns:

  • (Integer)


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

required :expires_at, Integer

#id ⇒ String

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

Returns:

  • (String)


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

required :id, String

#input ⇒ ::Array[OpenAI::Models::Live::initial_item]?

Ordered text-only history supplied before startup. Supports developer, user, and assistant messages with one text part each; at most 128 messages and a configured rendered-token limit (8,192 by default).

Returns:

  • (::Array[OpenAI::Models::Live::initial_item], nil)


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

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

#instructions ⇒ String?

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.

Returns:

  • (String, nil)


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

optional :instructions, String, nil?: true

#model ⇒ 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.

Returns:

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


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

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

#safety_identifier ⇒ String?

A stable identifier for your end user, used for safety monitoring and abuse detection.

Returns:

  • (String, nil)


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

optional :safety_identifier, String, nil?: true

#status ⇒ :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.

Returns:

  • (:active)


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

required :status, const: :active

#store ⇒ Boolean?

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

Returns:



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

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

#triggers ⇒ ::Array[OpenAI::Live::DecisionTrigger]?

At most one Decisions trigger per transcript event type. Triggers run independently of delegation. On update, omit triggers to keep the current configuration, send a list to replace it, or send an empty list to disable triggers.

Returns:

  • (::Array[OpenAI::Live::DecisionTrigger], nil)


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

optional :triggers, -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Live::DecisionTrigger] }

Class Method Details

.variants ⇒ Array(String, Symbol, OpenAI::Models::Live::BuiltInVoice, OpenAI::Models::Live::CustomVoice)



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

Instance Method Details

#to_hash ⇒ { id: String, expires_at: Integer, model: OpenAI::Models::Live::SessionResource::model, ?status: :active, ?audio: OpenAI::Live::SessionResource::Audio, ?client: OpenAI::Live::ClientConfig, ?delegation: OpenAI::Models::Live::SessionResource::delegation?, ?input: ::Array[OpenAI::Models::Live::initial_item], ?instructions: String?, ?safety_identifier: String?, ?store: bool, ?triggers: ::Array[OpenAI::Live::DecisionTrigger] }

Returns:

  • ({ id: String, expires_at: Integer, model: OpenAI::Models::Live::SessionResource::model, ?status: :active, ?audio: OpenAI::Live::SessionResource::Audio, ?client: OpenAI::Live::ClientConfig, ?delegation: OpenAI::Models::Live::SessionResource::delegation?, ?input: ::Array[OpenAI::Models::Live::initial_item], ?instructions: String?, ?safety_identifier: String?, ?store: bool, ?triggers: ::Array[OpenAI::Live::DecisionTrigger] })


170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'sig/openai/models/live/session_resource.rbs', line 170

def to_hash: -> {
  id: String,
  expires_at: Integer,
  model: OpenAI::Models::Live::SessionResource::model,
  ?status: :active,
  ?audio: OpenAI::Live::SessionResource::Audio,
  ?client: OpenAI::Live::ClientConfig,
  ?delegation: OpenAI::Models::Live::SessionResource::delegation?,
  ?input: ::Array[OpenAI::Models::Live::initial_item],
  ?instructions: String?,
  ?safety_identifier: String?,
  ?store: bool,
  ?triggers: ::Array[OpenAI::Live::DecisionTrigger]
}