openai 0.128.1 → 0.130.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,6 +17,8 @@ module OpenAI
17
17
  T.any(
18
18
  OpenAI::Live::SessionStartedEvent,
19
19
  OpenAI::Live::SessionUpdatedEvent,
20
+ OpenAI::Live::ForkServerEvent::SessionResumed,
21
+ OpenAI::Live::ForkServerEvent::SessionPaused,
20
22
  OpenAI::Live::InputAudioMutedEvent,
21
23
  OpenAI::Live::InputAudioUnmutedEvent,
22
24
  OpenAI::Live::OutputAudioFixturePlayingEvent,
@@ -46,6 +48,126 @@ module OpenAI
46
48
  )
47
49
  end
48
50
 
51
+ class SessionResumed < OpenAI::Internal::Type::BaseModel
52
+ OrHash = T.type_alias do
53
+ T.any(
54
+ OpenAI::Live::ForkServerEvent::SessionResumed,
55
+ OpenAI::Internal::AnyHash
56
+ )
57
+ end
58
+
59
+ # The unique ID of the Live server event.
60
+ sig { returns(String) }
61
+ attr_accessor :event_id
62
+
63
+ sig { returns(Symbol) }
64
+ attr_accessor :type
65
+
66
+ # The event_id of the client command associated with this server event, when
67
+ # supplied.
68
+ sig { returns(T.nilable(String)) }
69
+ attr_reader :client_event_id
70
+
71
+ sig { params(client_event_id: String).void }
72
+ attr_writer :client_event_id
73
+
74
+ # Sent when speech resumes paused inference and it is ready for audio in a Live
75
+ # WebRTC session. Delivered to the sideband and, when permitted by its event
76
+ # settings, the data channel.
77
+ sig do
78
+ params(
79
+
80
+ event_id: String,
81
+
82
+ client_event_id: String,
83
+
84
+ type: Symbol
85
+ )
86
+ .returns(T.attached_class)
87
+ end
88
+ def self.new(
89
+
90
+ # The unique ID of the Live server event.
91
+ event_id:,
92
+
93
+ # The event_id of the client command associated with this server event, when
94
+ # supplied.
95
+ client_event_id: nil,
96
+
97
+ type: :"session.resumed"
98
+ )
99
+ end
100
+
101
+ sig do
102
+ override.returns(
103
+ {event_id: String, type: Symbol, client_event_id: T.nilable(String)}
104
+ )
105
+ end
106
+ def to_hash
107
+ end
108
+
109
+ end
110
+
111
+ class SessionPaused < OpenAI::Internal::Type::BaseModel
112
+ OrHash = T.type_alias do
113
+ T.any(
114
+ OpenAI::Live::ForkServerEvent::SessionPaused,
115
+ OpenAI::Internal::AnyHash
116
+ )
117
+ end
118
+
119
+ # The unique ID of the Live server event.
120
+ sig { returns(String) }
121
+ attr_accessor :event_id
122
+
123
+ sig { returns(Symbol) }
124
+ attr_accessor :type
125
+
126
+ # The event_id of the client command associated with this server event, when
127
+ # supplied.
128
+ sig { returns(T.nilable(String)) }
129
+ attr_reader :client_event_id
130
+
131
+ sig { params(client_event_id: String).void }
132
+ attr_writer :client_event_id
133
+
134
+ # Sent when the idle timeout pauses inference in a Live WebRTC session. The WebRTC
135
+ # connection, sideband, and session ID persist. Delivered to the sideband and,
136
+ # when permitted by its event settings, the data channel.
137
+ sig do
138
+ params(
139
+
140
+ event_id: String,
141
+
142
+ client_event_id: String,
143
+
144
+ type: Symbol
145
+ )
146
+ .returns(T.attached_class)
147
+ end
148
+ def self.new(
149
+
150
+ # The unique ID of the Live server event.
151
+ event_id:,
152
+
153
+ # The event_id of the client command associated with this server event, when
154
+ # supplied.
155
+ client_event_id: nil,
156
+
157
+ type: :"session.paused"
158
+ )
159
+ end
160
+
161
+ sig do
162
+ override.returns(
163
+ {event_id: String, type: Symbol, client_event_id: T.nilable(String)}
164
+ )
165
+ end
166
+ def to_hash
167
+ end
168
+
169
+ end
170
+
49
171
  class SessionInputAudioAppend < OpenAI::Internal::Type::BaseModel
50
172
  OrHash = T.type_alias do
51
173
  T.any(
@@ -51,6 +51,15 @@ module OpenAI
51
51
  }
52
52
  attr_accessor :delegation
53
53
 
54
+ # Whole seconds of inactivity after which a Live WebRTC session with a speech wake
55
+ # policy pauses inference. The connection and conversation history are retained.
56
+ # Omit to keep inference active until the session ends.
57
+ sig { returns(T.nilable(Integer)) }
58
+ attr_reader :idle_timeout_s
59
+
60
+ sig { params(idle_timeout_s: Integer).void }
61
+ attr_writer :idle_timeout_s
62
+
54
63
  # Ordered text-only history supplied before startup. Supports developer, user, and
55
64
  # assistant messages with one text part each; at most 128 messages and a
56
65
  # configured rendered-token limit (8,192 by default).
@@ -116,6 +125,14 @@ module OpenAI
116
125
  sig { params(triggers: T::Array[OpenAI::Live::DecisionTrigger::OrHash]).void }
117
126
  attr_writer :triggers
118
127
 
128
+ # Inference starts when the Live WebRTC session connects. After an idle pause,
129
+ # microphone speech resumes inference.
130
+ sig { returns(T.nilable(OpenAI::Live::MediaSessionConfig::WakePolicy)) }
131
+ attr_reader :wake_policy
132
+
133
+ sig { params(wake_policy: OpenAI::Live::MediaSessionConfig::WakePolicy::OrHash).void }
134
+ attr_writer :wake_policy
135
+
119
136
  # Startup configuration for a Live media session. Follow the
120
137
  # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting)
121
138
  # when writing frontend instructions and the backend prompt under
@@ -137,6 +154,8 @@ module OpenAI
137
154
  )
138
155
  ),
139
156
 
157
+ idle_timeout_s: Integer,
158
+
140
159
  input: T::Array[
141
160
  T.any(
142
161
  OpenAI::Live::InitialItem::Developer::OrHash,
@@ -151,7 +170,9 @@ module OpenAI
151
170
 
152
171
  store: T::Boolean,
153
172
 
154
- triggers: T::Array[OpenAI::Live::DecisionTrigger::OrHash]
173
+ triggers: T::Array[OpenAI::Live::DecisionTrigger::OrHash],
174
+
175
+ wake_policy: OpenAI::Live::MediaSessionConfig::WakePolicy::OrHash
155
176
  )
156
177
  .returns(T.attached_class)
157
178
  end
@@ -174,6 +195,11 @@ module OpenAI
174
195
  # API.
175
196
  delegation: nil,
176
197
 
198
+ # Whole seconds of inactivity after which a Live WebRTC session with a speech wake
199
+ # policy pauses inference. The connection and conversation history are retained.
200
+ # Omit to keep inference active until the session ends.
201
+ idle_timeout_s: nil,
202
+
177
203
  # Ordered text-only history supplied before startup. Supports developer, user, and
178
204
  # assistant messages with one text part each; at most 128 messages and a
179
205
  # configured rendered-token limit (8,192 by default).
@@ -200,8 +226,12 @@ module OpenAI
200
226
  # independently of delegation. On update, omit triggers to keep the current
201
227
  # configuration, send a list to replace it, or send an empty list to disable
202
228
  # triggers.
229
+ triggers: nil,
230
+
231
+ # Inference starts when the Live WebRTC session connects. After an idle pause,
232
+ # microphone speech resumes inference.
203
233
 
204
- triggers: nil
234
+ wake_policy: nil
205
235
  )
206
236
  end
207
237
 
@@ -218,6 +248,7 @@ module OpenAI
218
248
  OpenAI::Live::MediaSessionConfig::Delegation::Decisions
219
249
  )
220
250
  ),
251
+ idle_timeout_s: Integer,
221
252
  input: T::Array[
222
253
  T.any(
223
254
  OpenAI::Live::InitialItem::Developer,
@@ -228,7 +259,8 @@ module OpenAI
228
259
  instructions: T.nilable(String),
229
260
  safety_identifier: T.nilable(String),
230
261
  store: T::Boolean,
231
- triggers: T::Array[OpenAI::Live::DecisionTrigger]
262
+ triggers: T::Array[OpenAI::Live::DecisionTrigger],
263
+ wake_policy: OpenAI::Live::MediaSessionConfig::WakePolicy
232
264
  }
233
265
  )
234
266
  end
@@ -253,6 +285,7 @@ module OpenAI
253
285
  OrSymbol = T.type_alias { T.any(Symbol, String) }
254
286
 
255
287
  GPT_LIVE_1 = T.let(:"gpt-live-1", OpenAI::Live::MediaSessionConfig::Model::TaggedSymbol)
288
+ GPT_LIVE_1_1 = T.let(:"gpt-live-1.1", OpenAI::Live::MediaSessionConfig::Model::TaggedSymbol)
256
289
 
257
290
  end
258
291
 
@@ -517,6 +550,61 @@ module OpenAI
517
550
 
518
551
  end
519
552
 
553
+ class WakePolicy < OpenAI::Internal::Type::BaseModel
554
+ OrHash = T.type_alias do
555
+ T.any(
556
+ OpenAI::Live::MediaSessionConfig::WakePolicy,
557
+ OpenAI::Internal::AnyHash
558
+ )
559
+ end
560
+
561
+ # The wake policy type, always `speech`.
562
+ sig { returns(Symbol) }
563
+ attr_accessor :type
564
+
565
+ # The speech detection threshold for resuming paused inference, from 0 to 1
566
+ # inclusive. Defaults to 0.5. Higher values require stronger evidence of speech.
567
+ # This setting is independent of active turn detection.
568
+ sig { returns(T.nilable(Float)) }
569
+ attr_reader :vad_threshold
570
+
571
+ sig { params(vad_threshold: Float).void }
572
+ attr_writer :vad_threshold
573
+
574
+ # Inference starts when the Live WebRTC session connects. After an idle pause,
575
+ # microphone speech resumes inference.
576
+ sig do
577
+ params(
578
+
579
+ vad_threshold: Float,
580
+
581
+ type: Symbol
582
+ )
583
+ .returns(T.attached_class)
584
+ end
585
+ def self.new(
586
+
587
+ # The speech detection threshold for resuming paused inference, from 0 to 1
588
+ # inclusive. Defaults to 0.5. Higher values require stronger evidence of speech.
589
+ # This setting is independent of active turn detection.
590
+ vad_threshold: nil,
591
+
592
+ # The wake policy type, always `speech`.
593
+
594
+ type: :speech
595
+ )
596
+ end
597
+
598
+ sig do
599
+ override.returns(
600
+ {type: Symbol, vad_threshold: Float}
601
+ )
602
+ end
603
+ def to_hash
604
+ end
605
+
606
+ end
607
+
520
608
  end
521
609
 
522
610
  end
@@ -17,6 +17,8 @@ module OpenAI
17
17
  T.any(
18
18
  OpenAI::Live::SessionStartedEvent,
19
19
  OpenAI::Live::SessionUpdatedEvent,
20
+ OpenAI::Live::ServerEvent::SessionResumed,
21
+ OpenAI::Live::ServerEvent::SessionPaused,
20
22
  OpenAI::Live::InputAudioMutedEvent,
21
23
  OpenAI::Live::InputAudioUnmutedEvent,
22
24
  OpenAI::Live::OutputAudioFixturePlayingEvent,
@@ -46,6 +48,126 @@ module OpenAI
46
48
  )
47
49
  end
48
50
 
51
+ class SessionResumed < OpenAI::Internal::Type::BaseModel
52
+ OrHash = T.type_alias do
53
+ T.any(
54
+ OpenAI::Live::ServerEvent::SessionResumed,
55
+ OpenAI::Internal::AnyHash
56
+ )
57
+ end
58
+
59
+ # The unique ID of the Live server event.
60
+ sig { returns(String) }
61
+ attr_accessor :event_id
62
+
63
+ sig { returns(Symbol) }
64
+ attr_accessor :type
65
+
66
+ # The event_id of the client command associated with this server event, when
67
+ # supplied.
68
+ sig { returns(T.nilable(String)) }
69
+ attr_reader :client_event_id
70
+
71
+ sig { params(client_event_id: String).void }
72
+ attr_writer :client_event_id
73
+
74
+ # Sent when speech resumes paused inference and it is ready for audio in a Live
75
+ # WebRTC session. Delivered to the sideband and, when permitted by its event
76
+ # settings, the data channel.
77
+ sig do
78
+ params(
79
+
80
+ event_id: String,
81
+
82
+ client_event_id: String,
83
+
84
+ type: Symbol
85
+ )
86
+ .returns(T.attached_class)
87
+ end
88
+ def self.new(
89
+
90
+ # The unique ID of the Live server event.
91
+ event_id:,
92
+
93
+ # The event_id of the client command associated with this server event, when
94
+ # supplied.
95
+ client_event_id: nil,
96
+
97
+ type: :"session.resumed"
98
+ )
99
+ end
100
+
101
+ sig do
102
+ override.returns(
103
+ {event_id: String, type: Symbol, client_event_id: T.nilable(String)}
104
+ )
105
+ end
106
+ def to_hash
107
+ end
108
+
109
+ end
110
+
111
+ class SessionPaused < OpenAI::Internal::Type::BaseModel
112
+ OrHash = T.type_alias do
113
+ T.any(
114
+ OpenAI::Live::ServerEvent::SessionPaused,
115
+ OpenAI::Internal::AnyHash
116
+ )
117
+ end
118
+
119
+ # The unique ID of the Live server event.
120
+ sig { returns(String) }
121
+ attr_accessor :event_id
122
+
123
+ sig { returns(Symbol) }
124
+ attr_accessor :type
125
+
126
+ # The event_id of the client command associated with this server event, when
127
+ # supplied.
128
+ sig { returns(T.nilable(String)) }
129
+ attr_reader :client_event_id
130
+
131
+ sig { params(client_event_id: String).void }
132
+ attr_writer :client_event_id
133
+
134
+ # Sent when the idle timeout pauses inference in a Live WebRTC session. The WebRTC
135
+ # connection, sideband, and session ID persist. Delivered to the sideband and,
136
+ # when permitted by its event settings, the data channel.
137
+ sig do
138
+ params(
139
+
140
+ event_id: String,
141
+
142
+ client_event_id: String,
143
+
144
+ type: Symbol
145
+ )
146
+ .returns(T.attached_class)
147
+ end
148
+ def self.new(
149
+
150
+ # The unique ID of the Live server event.
151
+ event_id:,
152
+
153
+ # The event_id of the client command associated with this server event, when
154
+ # supplied.
155
+ client_event_id: nil,
156
+
157
+ type: :"session.paused"
158
+ )
159
+ end
160
+
161
+ sig do
162
+ override.returns(
163
+ {event_id: String, type: Symbol, client_event_id: T.nilable(String)}
164
+ )
165
+ end
166
+ def to_hash
167
+ end
168
+
169
+ end
170
+
49
171
  class SessionInputAudioAppend < OpenAI::Internal::Type::BaseModel
50
172
  OrHash = T.type_alias do
51
173
  T.any(
@@ -302,6 +302,7 @@ module OpenAI
302
302
  OrSymbol = T.type_alias { T.any(Symbol, String) }
303
303
 
304
304
  GPT_LIVE_1 = T.let(:"gpt-live-1", OpenAI::Live::SessionAcceptParams::Session::Model::TaggedSymbol)
305
+ GPT_LIVE_1_1 = T.let(:"gpt-live-1.1", OpenAI::Live::SessionAcceptParams::Session::Model::TaggedSymbol)
305
306
 
306
307
  end
307
308
 
@@ -253,6 +253,7 @@ module OpenAI
253
253
  OrSymbol = T.type_alias { T.any(Symbol, String) }
254
254
 
255
255
  GPT_LIVE_1 = T.let(:"gpt-live-1", OpenAI::Live::SessionConfig::Model::TaggedSymbol)
256
+ GPT_LIVE_1_1 = T.let(:"gpt-live-1.1", OpenAI::Live::SessionConfig::Model::TaggedSymbol)
256
257
 
257
258
  end
258
259
 
@@ -272,6 +272,7 @@ module OpenAI
272
272
  OrSymbol = T.type_alias { T.any(Symbol, String) }
273
273
 
274
274
  GPT_LIVE_1 = T.let(:"gpt-live-1", OpenAI::Live::SessionResource::Model::TaggedSymbol)
275
+ GPT_LIVE_1_1 = T.let(:"gpt-live-1.1", OpenAI::Live::SessionResource::Model::TaggedSymbol)
275
276
 
276
277
  end
277
278
 
@@ -14,32 +14,60 @@ module OpenAI
14
14
  )
15
15
  end
16
16
 
17
- # The cumulative Live audio duration in seconds. Do not sum this value across
18
- # usage events.
17
+ # The cumulative billable duration in whole seconds. When present, the active and
18
+ # paused breakdown adds up to this total.
19
19
  sig { returns(Float) }
20
20
  attr_accessor :seconds
21
21
 
22
- # Cumulative audio duration for a Live session. Values are totals for the session,
23
- # not increments to sum across usage events.
22
+ # The remaining billable seconds attributed to active audio and any unused prepaid
23
+ # duration.
24
+ sig { returns(T.nilable(Integer)) }
25
+ attr_reader :active_seconds
26
+
27
+ sig { params(active_seconds: Integer).void }
28
+ attr_writer :active_seconds
29
+
30
+ # Billable time attributed to paused inference at the configured rate, rounded
31
+ # down to whole seconds.
32
+ sig { returns(T.nilable(Integer)) }
33
+ attr_reader :paused_seconds
34
+
35
+ sig { params(paused_seconds: Integer).void }
36
+ attr_writer :paused_seconds
37
+
38
+ # Cumulative billable duration for a Live session. Eligible WebRTC sessions also
39
+ # report the active and paused breakdown. Do not sum values across usage events.
24
40
  sig do
25
41
  params(
26
42
 
27
- seconds: Float
43
+ seconds: Float,
44
+
45
+ active_seconds: Integer,
46
+
47
+ paused_seconds: Integer
28
48
  )
29
49
  .returns(T.attached_class)
30
50
  end
31
51
  def self.new(
32
52
 
33
- # The cumulative Live audio duration in seconds. Do not sum this value across
34
- # usage events.
53
+ # The cumulative billable duration in whole seconds. When present, the active and
54
+ # paused breakdown adds up to this total.
55
+ seconds:,
56
+
57
+ # The remaining billable seconds attributed to active audio and any unused prepaid
58
+ # duration.
59
+ active_seconds: nil,
60
+
61
+ # Billable time attributed to paused inference at the configured rate, rounded
62
+ # down to whole seconds.
35
63
 
36
- seconds:
64
+ paused_seconds: nil
37
65
  )
38
66
  end
39
67
 
40
68
  sig do
41
69
  override.returns(
42
- {seconds: Float}
70
+ {seconds: Float, active_seconds: Integer, paused_seconds: Integer}
43
71
  )
44
72
  end
45
73
  def to_hash
@@ -14,6 +14,8 @@ module OpenAI
14
14
  T.any(
15
15
  OpenAI::Live::SessionStartedEvent,
16
16
  OpenAI::Live::SessionUpdatedEvent,
17
+ OpenAI::Live::SidebandServerEvent::SessionResumed,
18
+ OpenAI::Live::SidebandServerEvent::SessionPaused,
17
19
  OpenAI::Live::InputAudioMutedEvent,
18
20
  OpenAI::Live::InputAudioUnmutedEvent,
19
21
  OpenAI::Live::OutputAudioFixturePlayingEvent,
@@ -43,6 +45,126 @@ module OpenAI
43
45
  )
44
46
  end
45
47
 
48
+ class SessionResumed < OpenAI::Internal::Type::BaseModel
49
+ OrHash = T.type_alias do
50
+ T.any(
51
+ OpenAI::Live::SidebandServerEvent::SessionResumed,
52
+ OpenAI::Internal::AnyHash
53
+ )
54
+ end
55
+
56
+ # The unique ID of the Live server event.
57
+ sig { returns(String) }
58
+ attr_accessor :event_id
59
+
60
+ sig { returns(Symbol) }
61
+ attr_accessor :type
62
+
63
+ # The event_id of the client command associated with this server event, when
64
+ # supplied.
65
+ sig { returns(T.nilable(String)) }
66
+ attr_reader :client_event_id
67
+
68
+ sig { params(client_event_id: String).void }
69
+ attr_writer :client_event_id
70
+
71
+ # Sent when speech resumes paused inference and it is ready for audio in a Live
72
+ # WebRTC session. Delivered to the sideband and, when permitted by its event
73
+ # settings, the data channel.
74
+ sig do
75
+ params(
76
+
77
+ event_id: String,
78
+
79
+ client_event_id: String,
80
+
81
+ type: Symbol
82
+ )
83
+ .returns(T.attached_class)
84
+ end
85
+ def self.new(
86
+
87
+ # The unique ID of the Live server event.
88
+ event_id:,
89
+
90
+ # The event_id of the client command associated with this server event, when
91
+ # supplied.
92
+ client_event_id: nil,
93
+
94
+ type: :"session.resumed"
95
+ )
96
+ end
97
+
98
+ sig do
99
+ override.returns(
100
+ {event_id: String, type: Symbol, client_event_id: T.nilable(String)}
101
+ )
102
+ end
103
+ def to_hash
104
+ end
105
+
106
+ end
107
+
108
+ class SessionPaused < OpenAI::Internal::Type::BaseModel
109
+ OrHash = T.type_alias do
110
+ T.any(
111
+ OpenAI::Live::SidebandServerEvent::SessionPaused,
112
+ OpenAI::Internal::AnyHash
113
+ )
114
+ end
115
+
116
+ # The unique ID of the Live server event.
117
+ sig { returns(String) }
118
+ attr_accessor :event_id
119
+
120
+ sig { returns(Symbol) }
121
+ attr_accessor :type
122
+
123
+ # The event_id of the client command associated with this server event, when
124
+ # supplied.
125
+ sig { returns(T.nilable(String)) }
126
+ attr_reader :client_event_id
127
+
128
+ sig { params(client_event_id: String).void }
129
+ attr_writer :client_event_id
130
+
131
+ # Sent when the idle timeout pauses inference in a Live WebRTC session. The WebRTC
132
+ # connection, sideband, and session ID persist. Delivered to the sideband and,
133
+ # when permitted by its event settings, the data channel.
134
+ sig do
135
+ params(
136
+
137
+ event_id: String,
138
+
139
+ client_event_id: String,
140
+
141
+ type: Symbol
142
+ )
143
+ .returns(T.attached_class)
144
+ end
145
+ def self.new(
146
+
147
+ # The unique ID of the Live server event.
148
+ event_id:,
149
+
150
+ # The event_id of the client command associated with this server event, when
151
+ # supplied.
152
+ client_event_id: nil,
153
+
154
+ type: :"session.paused"
155
+ )
156
+ end
157
+
158
+ sig do
159
+ override.returns(
160
+ {event_id: String, type: Symbol, client_event_id: T.nilable(String)}
161
+ )
162
+ end
163
+ def to_hash
164
+ end
165
+
166
+ end
167
+
46
168
  class SessionInputAudioAppend < OpenAI::Internal::Type::BaseModel
47
169
  OrHash = T.type_alias do
48
170
  T.any(