openai 0.129.0 → 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.
@@ -7,11 +7,13 @@ module OpenAI
7
7
  ?audio: OpenAI::Live::MediaSessionConfig::Audio,
8
8
  ?client: OpenAI::Live::ClientConfig,
9
9
  ?delegation: OpenAI::Models::Live::MediaSessionConfig::delegation?,
10
+ ?idle_timeout_s: Integer,
10
11
  ?input: ::Array[OpenAI::Models::Live::initial_item],
11
12
  ?instructions: String?,
12
13
  ?safety_identifier: String?,
13
14
  ?store: bool,
14
- ?triggers: ::Array[OpenAI::Live::DecisionTrigger]
15
+ ?triggers: ::Array[OpenAI::Live::DecisionTrigger],
16
+ ?wake_policy: OpenAI::Live::MediaSessionConfig::WakePolicy
15
17
  }
16
18
 
17
19
  class MediaSessionConfig < OpenAI::Internal::Type::BaseModel
@@ -42,6 +44,16 @@ module OpenAI
42
44
  # API.
43
45
  attr_accessor delegation: OpenAI::Models::Live::MediaSessionConfig::delegation?
44
46
 
47
+ # Whole seconds of inactivity after which a Live WebRTC session with a speech wake
48
+ # policy pauses inference. The connection and conversation history are retained.
49
+ # Omit to keep inference active until the session ends.
50
+ attr_reader idle_timeout_s: Integer?
51
+
52
+ # Whole seconds of inactivity after which a Live WebRTC session with a speech wake
53
+ # policy pauses inference. The connection and conversation history are retained.
54
+ # Omit to keep inference active until the session ends.
55
+ def idle_timeout_s=: (Integer) -> Integer
56
+
45
57
  # Ordered text-only history supplied before startup. Supports developer, user, and
46
58
  # assistant messages with one text part each; at most 128 messages and a
47
59
  # configured rendered-token limit (8,192 by default).
@@ -89,6 +101,16 @@ module OpenAI
89
101
  ::Array[OpenAI::Live::DecisionTrigger]
90
102
  ) -> ::Array[OpenAI::Live::DecisionTrigger]
91
103
 
104
+ # Inference starts when the Live WebRTC session connects. After an idle pause,
105
+ # microphone speech resumes inference.
106
+ attr_reader wake_policy: OpenAI::Live::MediaSessionConfig::WakePolicy?
107
+
108
+ # Inference starts when the Live WebRTC session connects. After an idle pause,
109
+ # microphone speech resumes inference.
110
+ def wake_policy=: (
111
+ OpenAI::Live::MediaSessionConfig::WakePolicy
112
+ ) -> OpenAI::Live::MediaSessionConfig::WakePolicy
113
+
92
114
  # @param model
93
115
  # The Live model. Required in the session configuration for every transport; do
94
116
  # not pass it as a URL query parameter.
@@ -102,6 +124,10 @@ module OpenAI
102
124
  # Who handles tasks delegated by the Live model. Omitted or null selects your
103
125
  # application; use `responses` or `decisions` to delegate to the corresponding
104
126
  # API.
127
+ # @param idle_timeout_s
128
+ # Whole seconds of inactivity after which a Live WebRTC session with a speech wake
129
+ # policy pauses inference. The connection and conversation history are retained.
130
+ # Omit to keep inference active until the session ends.
105
131
  # @param input
106
132
  # Ordered text-only history supplied before startup. Supports developer, user, and
107
133
  # assistant messages with one text part each; at most 128 messages and a
@@ -125,16 +151,21 @@ module OpenAI
125
151
  # independently of delegation. On update, omit triggers to keep the current
126
152
  # configuration, send a list to replace it, or send an empty list to disable
127
153
  # triggers.
154
+ # @param wake_policy
155
+ # Inference starts when the Live WebRTC session connects. After an idle pause,
156
+ # microphone speech resumes inference.
128
157
  def initialize: (
129
158
  model: OpenAI::Models::Live::MediaSessionConfig::model,
130
159
  ?audio: OpenAI::Live::MediaSessionConfig::Audio,
131
160
  ?client: OpenAI::Live::ClientConfig,
132
161
  ?delegation: OpenAI::Models::Live::MediaSessionConfig::delegation?,
162
+ ?idle_timeout_s: Integer,
133
163
  ?input: ::Array[OpenAI::Models::Live::initial_item],
134
164
  ?instructions: String?,
135
165
  ?safety_identifier: String?,
136
166
  ?store: bool,
137
- ?triggers: ::Array[OpenAI::Live::DecisionTrigger]
167
+ ?triggers: ::Array[OpenAI::Live::DecisionTrigger],
168
+ ?wake_policy: OpenAI::Live::MediaSessionConfig::WakePolicy
138
169
  ) -> void
139
170
 
140
171
  def to_hash: -> {
@@ -142,11 +173,13 @@ module OpenAI
142
173
  ?audio: OpenAI::Live::MediaSessionConfig::Audio,
143
174
  ?client: OpenAI::Live::ClientConfig,
144
175
  ?delegation: OpenAI::Models::Live::MediaSessionConfig::delegation?,
176
+ ?idle_timeout_s: Integer,
145
177
  ?input: ::Array[OpenAI::Models::Live::initial_item],
146
178
  ?instructions: String?,
147
179
  ?safety_identifier: String?,
148
180
  ?store: bool,
149
- ?triggers: ::Array[OpenAI::Live::DecisionTrigger]
181
+ ?triggers: ::Array[OpenAI::Live::DecisionTrigger],
182
+ ?wake_policy: OpenAI::Live::MediaSessionConfig::WakePolicy
150
183
  }
151
184
 
152
185
  type model = String | :"gpt-live-1" | :"gpt-live-1.1"
@@ -336,6 +369,33 @@ module OpenAI
336
369
 
337
370
  def self?.variants: -> ::Array[OpenAI::Models::Live::MediaSessionConfig::delegation]
338
371
  end
372
+
373
+ type wake_policy = { ?type: :speech, ?vad_threshold: Float }
374
+
375
+ class WakePolicy < OpenAI::Internal::Type::BaseModel
376
+ # The wake policy type, always `speech`.
377
+ attr_accessor type: :speech
378
+
379
+ # The speech detection threshold for resuming paused inference, from 0 to 1
380
+ # inclusive. Defaults to 0.5. Higher values require stronger evidence of speech.
381
+ # This setting is independent of active turn detection.
382
+ attr_reader vad_threshold: Float?
383
+
384
+ # The speech detection threshold for resuming paused inference, from 0 to 1
385
+ # inclusive. Defaults to 0.5. Higher values require stronger evidence of speech.
386
+ # This setting is independent of active turn detection.
387
+ def vad_threshold=: (Float) -> Float
388
+
389
+ # @param vad_threshold
390
+ # The speech detection threshold for resuming paused inference, from 0 to 1
391
+ # inclusive. Defaults to 0.5. Higher values require stronger evidence of speech.
392
+ # This setting is independent of active turn detection.
393
+ # @param type
394
+ # The wake policy type, always `speech`.
395
+ def initialize: (?vad_threshold: Float, ?type: :speech) -> void
396
+
397
+ def to_hash: -> { ?type: :speech, ?vad_threshold: Float }
398
+ end
339
399
  end
340
400
  end
341
401
  end
@@ -4,6 +4,8 @@ module OpenAI
4
4
  type server_event =
5
5
  OpenAI::Live::SessionStartedEvent
6
6
  | OpenAI::Live::SessionUpdatedEvent
7
+ | OpenAI::Live::ServerEvent::SessionResumed
8
+ | OpenAI::Live::ServerEvent::SessionPaused
7
9
  | OpenAI::Live::InputAudioMutedEvent
8
10
  | OpenAI::Live::InputAudioUnmutedEvent
9
11
  | OpenAI::Live::OutputAudioFixturePlayingEvent
@@ -34,6 +36,84 @@ module OpenAI
34
36
  module ServerEvent
35
37
  extend OpenAI::Internal::Type::Union
36
38
 
39
+ type session_resumed =
40
+ {
41
+ event_id: String,
42
+ ?type: :"session.resumed",
43
+ ?client_event_id: String
44
+ }
45
+
46
+ class SessionResumed < OpenAI::Internal::Type::BaseModel
47
+ # The unique ID of the Live server event.
48
+ attr_accessor event_id: String
49
+
50
+ attr_accessor type: :"session.resumed"
51
+
52
+ # The event_id of the client command associated with this server event, when
53
+ # supplied.
54
+ attr_reader client_event_id: String?
55
+
56
+ # The event_id of the client command associated with this server event, when
57
+ # supplied.
58
+ def client_event_id=: (String) -> String
59
+
60
+ # @param event_id
61
+ # The unique ID of the Live server event.
62
+ # @param client_event_id
63
+ # The event_id of the client command associated with this server event, when
64
+ # supplied.
65
+ def initialize: (
66
+ event_id: String,
67
+ ?client_event_id: String,
68
+ ?type: :"session.resumed"
69
+ ) -> void
70
+
71
+ def to_hash: -> {
72
+ event_id: String,
73
+ ?type: :"session.resumed",
74
+ ?client_event_id: String
75
+ }
76
+ end
77
+
78
+ type session_paused =
79
+ {
80
+ event_id: String,
81
+ ?type: :"session.paused",
82
+ ?client_event_id: String
83
+ }
84
+
85
+ class SessionPaused < OpenAI::Internal::Type::BaseModel
86
+ # The unique ID of the Live server event.
87
+ attr_accessor event_id: String
88
+
89
+ attr_accessor type: :"session.paused"
90
+
91
+ # The event_id of the client command associated with this server event, when
92
+ # supplied.
93
+ attr_reader client_event_id: String?
94
+
95
+ # The event_id of the client command associated with this server event, when
96
+ # supplied.
97
+ def client_event_id=: (String) -> String
98
+
99
+ # @param event_id
100
+ # The unique ID of the Live server event.
101
+ # @param client_event_id
102
+ # The event_id of the client command associated with this server event, when
103
+ # supplied.
104
+ def initialize: (
105
+ event_id: String,
106
+ ?client_event_id: String,
107
+ ?type: :"session.paused"
108
+ ) -> void
109
+
110
+ def to_hash: -> {
111
+ event_id: String,
112
+ ?type: :"session.paused",
113
+ ?client_event_id: String
114
+ }
115
+ end
116
+
37
117
  type session_input_audio_append =
38
118
  { audio: String, ?type: :"session.input_audio.append" }
39
119
 
@@ -1,19 +1,50 @@
1
1
  module OpenAI
2
2
  module Models
3
3
  module Live
4
- type session_usage = { seconds: Float }
4
+ type session_usage =
5
+ { seconds: Float, ?active_seconds: Integer, ?paused_seconds: Integer }
5
6
 
6
7
  class SessionUsage < OpenAI::Internal::Type::BaseModel
7
- # The cumulative Live audio duration in seconds. Do not sum this value across
8
- # usage events.
8
+ # The cumulative billable duration in whole seconds. When present, the active and
9
+ # paused breakdown adds up to this total.
9
10
  attr_accessor seconds: Float
10
11
 
12
+ # The remaining billable seconds attributed to active audio and any unused prepaid
13
+ # duration.
14
+ attr_reader active_seconds: Integer?
15
+
16
+ # The remaining billable seconds attributed to active audio and any unused prepaid
17
+ # duration.
18
+ def active_seconds=: (Integer) -> Integer
19
+
20
+ # Billable time attributed to paused inference at the configured rate, rounded
21
+ # down to whole seconds.
22
+ attr_reader paused_seconds: Integer?
23
+
24
+ # Billable time attributed to paused inference at the configured rate, rounded
25
+ # down to whole seconds.
26
+ def paused_seconds=: (Integer) -> Integer
27
+
11
28
  # @param seconds
12
- # The cumulative Live audio duration in seconds. Do not sum this value across
13
- # usage events.
14
- def initialize: (seconds: Float) -> void
29
+ # The cumulative billable duration in whole seconds. When present, the active and
30
+ # paused breakdown adds up to this total.
31
+ # @param active_seconds
32
+ # The remaining billable seconds attributed to active audio and any unused prepaid
33
+ # duration.
34
+ # @param paused_seconds
35
+ # Billable time attributed to paused inference at the configured rate, rounded
36
+ # down to whole seconds.
37
+ def initialize: (
38
+ seconds: Float,
39
+ ?active_seconds: Integer,
40
+ ?paused_seconds: Integer
41
+ ) -> void
15
42
 
16
- def to_hash: -> { seconds: Float }
43
+ def to_hash: -> {
44
+ seconds: Float,
45
+ ?active_seconds: Integer,
46
+ ?paused_seconds: Integer
47
+ }
17
48
  end
18
49
  end
19
50
  end
@@ -4,6 +4,8 @@ module OpenAI
4
4
  type sideband_server_event =
5
5
  OpenAI::Live::SessionStartedEvent
6
6
  | OpenAI::Live::SessionUpdatedEvent
7
+ | OpenAI::Live::SidebandServerEvent::SessionResumed
8
+ | OpenAI::Live::SidebandServerEvent::SessionPaused
7
9
  | OpenAI::Live::InputAudioMutedEvent
8
10
  | OpenAI::Live::InputAudioUnmutedEvent
9
11
  | OpenAI::Live::OutputAudioFixturePlayingEvent
@@ -34,6 +36,84 @@ module OpenAI
34
36
  module SidebandServerEvent
35
37
  extend OpenAI::Internal::Type::Union
36
38
 
39
+ type session_resumed =
40
+ {
41
+ event_id: String,
42
+ ?type: :"session.resumed",
43
+ ?client_event_id: String
44
+ }
45
+
46
+ class SessionResumed < OpenAI::Internal::Type::BaseModel
47
+ # The unique ID of the Live server event.
48
+ attr_accessor event_id: String
49
+
50
+ attr_accessor type: :"session.resumed"
51
+
52
+ # The event_id of the client command associated with this server event, when
53
+ # supplied.
54
+ attr_reader client_event_id: String?
55
+
56
+ # The event_id of the client command associated with this server event, when
57
+ # supplied.
58
+ def client_event_id=: (String) -> String
59
+
60
+ # @param event_id
61
+ # The unique ID of the Live server event.
62
+ # @param client_event_id
63
+ # The event_id of the client command associated with this server event, when
64
+ # supplied.
65
+ def initialize: (
66
+ event_id: String,
67
+ ?client_event_id: String,
68
+ ?type: :"session.resumed"
69
+ ) -> void
70
+
71
+ def to_hash: -> {
72
+ event_id: String,
73
+ ?type: :"session.resumed",
74
+ ?client_event_id: String
75
+ }
76
+ end
77
+
78
+ type session_paused =
79
+ {
80
+ event_id: String,
81
+ ?type: :"session.paused",
82
+ ?client_event_id: String
83
+ }
84
+
85
+ class SessionPaused < OpenAI::Internal::Type::BaseModel
86
+ # The unique ID of the Live server event.
87
+ attr_accessor event_id: String
88
+
89
+ attr_accessor type: :"session.paused"
90
+
91
+ # The event_id of the client command associated with this server event, when
92
+ # supplied.
93
+ attr_reader client_event_id: String?
94
+
95
+ # The event_id of the client command associated with this server event, when
96
+ # supplied.
97
+ def client_event_id=: (String) -> String
98
+
99
+ # @param event_id
100
+ # The unique ID of the Live server event.
101
+ # @param client_event_id
102
+ # The event_id of the client command associated with this server event, when
103
+ # supplied.
104
+ def initialize: (
105
+ event_id: String,
106
+ ?client_event_id: String,
107
+ ?type: :"session.paused"
108
+ ) -> void
109
+
110
+ def to_hash: -> {
111
+ event_id: String,
112
+ ?type: :"session.paused",
113
+ ?client_event_id: String
114
+ }
115
+ end
116
+
37
117
  type session_input_audio_append =
38
118
  { audio: String, ?type: :"session.input_audio.append" }
39
119
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.129.0
4
+ version: 0.130.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenAI