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_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(model:, audio: nil, delegation: nil, input: nil, instructions: nil, store: nil, type: :live) ⇒ Object

Model and startup configuration for the Live session that answers the incoming SIP call.

Parameters:



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
# 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` to let the API manage a Responses backend.
  #
  #   @return [OpenAI::Models::Live::ClientDelegation, OpenAI::Models::Live::SessionAcceptParams::Session::Delegation::Responses, 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 8,192
  #   rendered tokens in total.
  #
  #   @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 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

  # @!method initialize(model:, audio: nil, delegation: nil, input: nil, instructions: nil, store: 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, 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.
  #
  #   @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 8,192
  #     rendered tokens in total.
  #
  #   @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 store [Boolean]
  #     Whether to store the session for later forking and recording download. Defaults
  #     to false for new sessions.
  #
  #   @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

    # The Live model. Required in the session configuration for every transport; do not pass it as a URL query parameter.
    variant const: -> { OpenAI::Models::Live::SessionAcceptParams::Session::Model::GPT_LIVE_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"

    # @!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` to let the API manage a Responses backend.
  #
  # @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 }

    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

      # @!method initialize(responses:, 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 type [Symbol, :responses]
      #     The delegation owner. Always `responses` for tasks handled by the Responses API.
    end

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

Instance Attribute Details

#audioOpenAI::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.



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

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

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

Returns:



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

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

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



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

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)


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

optional :instructions, String, nil?: true

#modelString, ...

The Live model to use for the accepted call.

Parameters:

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

Returns:



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

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

#storeBoolean?

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

Parameters:

Returns:



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

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

#typeSymbol, :live

The session type. Always live.

Parameters:

  • value (:live)

Returns:

  • (Symbol, :live)


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

required :type, const: :live

Class Method Details

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



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

Instance Method Details

#to_hash{

Returns:

  • ({)


77
# File 'sig/openai/models/live/session_accept_params.rbs', line 77

def to_hash: -> {