Class: OpenAI::Models::Live::SessionAcceptParams::Session

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/openai/models/live/session_accept_params.rb,
sig/openai/models/live/session_accept_params.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(model:, audio: nil, delegation: nil, input: nil, instructions: nil, safety_identifier: nil, store: nil, triggers: nil, type: :live) ⇒ Session

Returns a new instance of Session.

Parameters:

  • model —

    The Live model to use for the accepted call.

  • audio (defaults to: nil) —

    Startup audio output configuration. SIP negotiates the media format; audio.format is only accepted for primary WebSockets. Voice cannot change after startup.

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

  • type (defaults to: :live) —

    The session type. Always live.

  • model: (OpenAI::Models::Live::SessionAcceptParams::Session::model)
  • audio: (OpenAI::Live::SessionAcceptParams::Session::Audio) (defaults to: nil)
  • delegation: (OpenAI::Models::Live::SessionAcceptParams::Session::delegation, { responses: OpenAI::Live::ResponsesDelegationConfig, type: :responses, ?acknowledgement_delay_ms: Integer }, { decisions: OpenAI::Live::DecisionsDelegationConfig, type: :decisions, ?acknowledgement_delay_ms: Integer }, 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)
  • type: (:live) (defaults to: :live)


32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
# File 'lib/openai/models/live/session_accept_params.rb', line 32

class Session < OpenAI::Internal::Type::BaseModel
  # @!attribute model
  #   The Live model to use for the accepted call.
  #
  #   @return [String, Symbol, OpenAI::Models::Live::SessionAcceptParams::Session::Model]
  required :model, union: -> { OpenAI::Live::SessionAcceptParams::Session::Model }

  # @!attribute type
  #   The session type. Always `live`.
  #
  #   @return [Symbol, :live]
  required :type, const: :live

  # @!attribute audio
  #   Startup audio output configuration. SIP negotiates the media format;
  #   audio.format is only accepted for primary WebSockets. Voice cannot change after
  #   startup.
  #
  #   @return [OpenAI::Models::Live::SessionAcceptParams::Session::Audio, nil]
  optional :audio, -> { OpenAI::Live::SessionAcceptParams::Session::Audio }

  # @!attribute 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.
  #
  #   @return [OpenAI::Models::Live::ClientDelegation, OpenAI::Models::Live::SessionAcceptParams::Session::Delegation::Responses, OpenAI::Models::Live::SessionAcceptParams::Session::Delegation::Decisions, nil]
  optional(
    :delegation,
    union: -> {
      OpenAI::Live::SessionAcceptParams::Session::Delegation
    },
    nil?: true
  )

  # @!attribute input
  #   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).
  #
  #   @return [Array<OpenAI::Models::Live::InitialItem::Developer, OpenAI::Models::Live::InitialItem::User, OpenAI::Models::Live::InitialItem::Assistant>, nil]
  optional :input, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Live::InitialItem] }

  # @!attribute instructions
  #   Frontend instructions for voice, conversation, interruptions, and when to
  #   delegate. Start with the
  #   [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting);
  #   put business rules and tool workflows in a separate
  #   [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt).
  #   Limited to 16,384 client-supplied tokens. Omitted or blank instructions use
  #   server defaults. Immutable after startup.
  #
  #   @return [String, nil]
  optional :instructions, String, nil?: true

  # @!attribute safety_identifier
  #   A stable identifier for your end user, used for safety monitoring and abuse
  #   detection.
  #
  #   @return [String, nil]
  optional :safety_identifier, String, nil?: true

  # @!attribute store
  #   Whether to store the session for later forking and recording download. Defaults
  #   to false for new sessions.
  #
  #   @return [Boolean, nil]
  optional :store, OpenAI::Internal::Type::Boolean

  # @!attribute triggers
  #   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.
  #
  #   @return [Array<OpenAI::Models::Live::DecisionTrigger>, nil]
  optional :triggers, -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Live::DecisionTrigger] }

  # @!method initialize(model:, audio: nil, delegation: nil, input: nil, instructions: nil, safety_identifier: nil, store: nil, triggers: nil, type: :live)
  #   Model and startup configuration for the Live session that answers the incoming
  #   SIP call.
  #
  #   @param model [String, Symbol, OpenAI::Models::Live::SessionAcceptParams::Session::Model]
  #     The Live model to use for the accepted call.
  #
  #   @param audio [OpenAI::Models::Live::SessionAcceptParams::Session::Audio]
  #     Startup audio output configuration. SIP negotiates the media format;
  #     audio.format is only accepted for primary WebSockets. Voice cannot change after
  #     startup.
  #
  #   @param delegation [OpenAI::Models::Live::ClientDelegation, OpenAI::Models::Live::SessionAcceptParams::Session::Delegation::Responses, OpenAI::Models::Live::SessionAcceptParams::Session::Delegation::Decisions, 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.
  #
  #   @param input [Array<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 a
  #     configured rendered-token limit (8,192 by default).
  #
  #   @param instructions [String, nil]
  #     Frontend instructions for voice, conversation, interruptions, and when to
  #     delegate. Start with the
  #     [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting);
  #     put business rules and tool workflows in a separate
  #     [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt).
  #     Limited to 16,384 client-supplied tokens. Omitted or blank instructions use
  #     server defaults. Immutable after startup.
  #
  #   @param safety_identifier [String, nil]
  #     A stable identifier for your end user, used for safety monitoring and abuse
  #     detection.
  #
  #   @param store [Boolean]
  #     Whether to store the session for later forking and recording download. Defaults
  #     to false for new sessions.
  #
  #   @param triggers [Array<OpenAI::Models::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.
  #
  #   @param type [Symbol, :live]
  #     The session type. Always `live`.

  # The Live model to use for the accepted call.
  #
  # @see OpenAI::Models::Live::SessionAcceptParams::Session#model
  module Model
    extend OpenAI::Internal::Type::Union

    variant String

    variant const: -> { OpenAI::Models::Live::SessionAcceptParams::Session::Model::GPT_LIVE_1 }

    variant const: -> { OpenAI::Models::Live::SessionAcceptParams::Session::Model::GPT_LIVE_1_1 }

    # @!method self.variants
    #   @return [Array(String, Symbol)]

    define_sorbet_constant!(:Variants) do
      T.type_alias { T.any(String, OpenAI::Live::SessionAcceptParams::Session::Model::TaggedSymbol) }
    end

    # @!group

    GPT_LIVE_1 = :"gpt-live-1"
    GPT_LIVE_1_1 = :"gpt-live-1.1"

    # @!endgroup
  end

  # @see OpenAI::Models::Live::SessionAcceptParams::Session#audio
  class Audio < OpenAI::Internal::Type::BaseModel
    # @!attribute output
    #   Settings for speech generated by the Live model. Choose the voice before
    #   starting the session.
    #
    #   @return [OpenAI::Models::Live::SessionAcceptParams::Session::Audio::Output, nil]
    optional :output, -> { OpenAI::Live::SessionAcceptParams::Session::Audio::Output }

    # @!method initialize(output: nil)
    #   Startup audio output configuration. SIP negotiates the media format;
    #   audio.format is only accepted for primary WebSockets. Voice cannot change after
    #   startup.
    #
    #   @param output [OpenAI::Models::Live::SessionAcceptParams::Session::Audio::Output]
    #     Settings for speech generated by the Live model. Choose the voice before
    #     starting the session.

    # @see OpenAI::Models::Live::SessionAcceptParams::Session::Audio#output
    class Output < OpenAI::Internal::Type::BaseModel
      # @!attribute voice
      #   The voice used for Live speech, as a built-in voice name or a custom voice
      #   object containing its ID. Defaults to `marin` and cannot change after startup.
      #
      #   @return [String, Symbol, OpenAI::Models::Live::BuiltInVoice, OpenAI::Models::Live::CustomVoice, nil]
      optional :voice, union: -> { OpenAI::Live::SessionAcceptParams::Session::Audio::Output::Voice }

      # @!method initialize(voice: nil)
      #   Settings for speech generated by the Live model. Choose the voice before
      #   starting the session.
      #
      #   @param voice [String, Symbol, OpenAI::Models::Live::BuiltInVoice, OpenAI::Models::Live::CustomVoice]
      #     The voice used for Live speech, as a built-in voice name or a custom voice
      #     object containing its ID. Defaults to `marin` and cannot change after startup.

      # The voice used for Live speech, as a built-in voice name or a custom voice
      # object containing its ID. Defaults to `marin` and cannot change after startup.
      #
      # @see OpenAI::Models::Live::SessionAcceptParams::Session::Audio::Output#voice
      module Voice
        extend OpenAI::Internal::Type::Union

        variant String

        # A built-in voice available for Live speech.
        variant enum: -> { OpenAI::Live::BuiltInVoice }

        variant -> { OpenAI::Live::CustomVoice }

        # @!method self.variants
        #   @return [Array(String, Symbol, OpenAI::Models::Live::BuiltInVoice, OpenAI::Models::Live::CustomVoice)]
      end
    end
  end

  # Who handles tasks delegated by the Live model. Omitted or null selects your
  # application; use `responses` or `decisions` to delegate to the corresponding
  # API.
  #
  # @see OpenAI::Models::Live::SessionAcceptParams::Session#delegation
  module Delegation
    extend OpenAI::Internal::Type::Union

    discriminator :type

    # Delegate tasks to your application. The Live session emits delegation events that your backend handles.
    variant :client, -> { OpenAI::Live::ClientDelegation }

    # Delegate tasks to a Responses model managed by the Live session.
    variant :responses, -> { OpenAI::Live::SessionAcceptParams::Session::Delegation::Responses }

    variant :decisions, -> { OpenAI::Live::SessionAcceptParams::Session::Delegation::Decisions }

    class Responses < OpenAI::Internal::Type::BaseModel
      # @!attribute responses
      #   Backend model, prompt, and tools used when the Live session delegates a task to
      #   Responses.
      #
      #   @return [OpenAI::Models::Live::ResponsesDelegationConfig]
      required :responses, -> { OpenAI::Live::ResponsesDelegationConfig }

      # @!attribute type
      #   The delegation owner. Always `responses` for tasks handled by the Responses API.
      #
      #   @return [Symbol, :responses]
      required :type, const: :responses

      # @!attribute acknowledgement_delay_ms
      #   Milliseconds to wait before requesting an automatic spoken acknowledgement for a
      #   delegation. The model may still speak before this delay. Any commentary or
      #   thinking appended to the session cancels all pending acknowledgements, including
      #   those for other delegations. Defaults to 400 for Decisions sessions and 0
      #   (request immediately) for other sessions. Omission in a session update preserves
      #   the current value. Updates apply to subsequent delegations.
      #
      #   @return [Integer, nil]
      optional :acknowledgement_delay_ms, Integer

      # @!method initialize(responses:, acknowledgement_delay_ms: nil, type: :responses)
      #   Delegate tasks to a Responses model managed by the Live session.
      #
      #   @param responses [OpenAI::Models::Live::ResponsesDelegationConfig]
      #     Backend model, prompt, and tools used when the Live session delegates a task to
      #     Responses.
      #
      #   @param acknowledgement_delay_ms [Integer]
      #     Milliseconds to wait before requesting an automatic spoken acknowledgement for a
      #     delegation. The model may still speak before this delay. Any commentary or
      #     thinking appended to the session cancels all pending acknowledgements, including
      #     those for other delegations. Defaults to 400 for Decisions sessions and 0
      #     (request immediately) for other sessions. Omission in a session update preserves
      #     the current value. Updates apply to subsequent delegations.
      #
      #   @param type [Symbol, :responses]
      #     The delegation owner. Always `responses` for tasks handled by the Responses API.
    end

    class Decisions < OpenAI::Internal::Type::BaseModel
      # @!attribute decisions
      #
      #   @return [OpenAI::Models::Live::DecisionsDelegationConfig]
      required :decisions, -> { OpenAI::Live::DecisionsDelegationConfig }

      # @!attribute type
      #
      #   @return [Symbol, :decisions]
      required :type, const: :decisions

      # @!attribute acknowledgement_delay_ms
      #   Milliseconds to wait before requesting an automatic spoken acknowledgement for a
      #   delegation. The model may still speak before this delay. Any commentary or
      #   thinking appended to the session cancels all pending acknowledgements, including
      #   those for other delegations. Defaults to 400. Updates apply to subsequent
      #   delegations.
      #
      #   @return [Integer, nil]
      optional :acknowledgement_delay_ms, Integer

      # @!method initialize(decisions:, acknowledgement_delay_ms: nil, type: :decisions)
      #   @param decisions [OpenAI::Models::Live::DecisionsDelegationConfig]
      #
      #   @param acknowledgement_delay_ms [Integer]
      #     Milliseconds to wait before requesting an automatic spoken acknowledgement for a
      #     delegation. The model may still speak before this delay. Any commentary or
      #     thinking appended to the session cancels all pending acknowledgements, including
      #     those for other delegations. Defaults to 400. Updates apply to subsequent
      #     delegations.
      #
      #   @param type [Symbol, :decisions]
    end

    # @!method self.variants
    #   @return [Array(OpenAI::Models::Live::ClientDelegation, OpenAI::Models::Live::SessionAcceptParams::Session::Delegation::Responses, OpenAI::Models::Live::SessionAcceptParams::Session::Delegation::Decisions)]
  end
end

Instance Attribute Details

#audio ⇒ OpenAI::Live::SessionAcceptParams::Session::Audio?

Startup audio output configuration. SIP negotiates the media format; audio.format is only accepted for primary WebSockets. Voice cannot change after startup.

Returns:

  • (OpenAI::Live::SessionAcceptParams::Session::Audio, nil)


51
# File 'lib/openai/models/live/session_accept_params.rb', line 51

optional :audio, -> { OpenAI::Live::SessionAcceptParams::Session::Audio }

#delegation ⇒ OpenAI::Models::Live::SessionAcceptParams::Session::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::SessionAcceptParams::Session::delegation, nil)


59
60
61
62
63
64
65
# File 'lib/openai/models/live/session_accept_params.rb', line 59

optional(
  :delegation,
  union: -> {
    OpenAI::Live::SessionAcceptParams::Session::Delegation
  },
  nil?: true
)

#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)


73
# File 'lib/openai/models/live/session_accept_params.rb', line 73

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)


85
# File 'lib/openai/models/live/session_accept_params.rb', line 85

optional :instructions, String, nil?: true

#model ⇒ OpenAI::Models::Live::SessionAcceptParams::Session::model

The Live model to use for the accepted call.

Returns:

  • (OpenAI::Models::Live::SessionAcceptParams::Session::model)


37
# File 'lib/openai/models/live/session_accept_params.rb', line 37

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

#safety_identifier ⇒ String?

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

Returns:

  • (String, nil)


92
# File 'lib/openai/models/live/session_accept_params.rb', line 92

optional :safety_identifier, String, nil?: true

#store ⇒ Boolean?

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

Returns:



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

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)


108
# File 'lib/openai/models/live/session_accept_params.rb', line 108

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

#type ⇒ :live

The session type. Always live.

Returns:

  • (:live)


43
# File 'lib/openai/models/live/session_accept_params.rb', line 43

required :type, const: :live

Class Method Details

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



# File 'lib/openai/models/live/session_accept_params.rb', line 234

Instance Method Details

#to_hash ⇒ { model: OpenAI::Models::Live::SessionAcceptParams::Session::model, ?type: :live, ?audio: OpenAI::Live::SessionAcceptParams::Session::Audio, ?delegation: OpenAI::Models::Live::SessionAcceptParams::Session::delegation?, ?input: ::Array[OpenAI::Models::Live::initial_item], ?instructions: String?, ?safety_identifier: String?, ?store: bool, ?triggers: ::Array[OpenAI::Live::DecisionTrigger] }

Returns:

  • ({ model: OpenAI::Models::Live::SessionAcceptParams::Session::model, ?type: :live, ?audio: OpenAI::Live::SessionAcceptParams::Session::Audio, ?delegation: OpenAI::Models::Live::SessionAcceptParams::Session::delegation?, ?input: ::Array[OpenAI::Models::Live::initial_item], ?instructions: String?, ?safety_identifier: String?, ?store: bool, ?triggers: ::Array[OpenAI::Live::DecisionTrigger] })


204
205
206
207
208
209
210
211
212
213
214
# File 'sig/openai/models/live/session_accept_params.rbs', line 204

def to_hash: -> {
  model: OpenAI::Models::Live::SessionAcceptParams::Session::model,
  ?type: :live,
  ?audio: OpenAI::Live::SessionAcceptParams::Session::Audio,
  ?delegation: OpenAI::Models::Live::SessionAcceptParams::Session::delegation?,
  ?input: ::Array[OpenAI::Models::Live::initial_item],
  ?instructions: String?,
  ?safety_identifier: String?,
  ?store: bool,
  ?triggers: ::Array[OpenAI::Live::DecisionTrigger]
}