openai 0.23.0 → 0.23.1

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.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +1 -1
  4. data/lib/openai/models/realtime/client_secret_create_response.rb +6 -8
  5. data/lib/openai/models/realtime/realtime_audio_input_turn_detection.rb +1 -1
  6. data/lib/openai/models/realtime/realtime_client_event.rb +2 -6
  7. data/lib/openai/models/realtime/{models.rb → realtime_function_tool.rb} +6 -6
  8. data/lib/openai/models/realtime/realtime_response_create_params.rb +4 -4
  9. data/lib/openai/models/realtime/realtime_server_event.rb +1 -8
  10. data/lib/openai/models/realtime/realtime_session.rb +3 -3
  11. data/lib/openai/models/realtime/realtime_session_create_request.rb +2 -2
  12. data/lib/openai/models/realtime/realtime_session_create_response.rb +21 -33
  13. data/lib/openai/models/realtime/realtime_tools_config_union.rb +2 -2
  14. data/lib/openai/models/realtime/realtime_transcription_session_create_response.rb +117 -40
  15. data/lib/openai/models/realtime/transcription_session_updated_event.rb +152 -3
  16. data/lib/openai/version.rb +1 -1
  17. data/lib/openai.rb +1 -4
  18. data/rbi/openai/models/realtime/realtime_audio_input_turn_detection.rbi +2 -2
  19. data/rbi/openai/models/realtime/realtime_client_event.rbi +1 -2
  20. data/rbi/openai/models/realtime/{models.rbi → realtime_function_tool.rbi} +27 -9
  21. data/rbi/openai/models/realtime/realtime_response_create_params.rbi +5 -5
  22. data/rbi/openai/models/realtime/realtime_server_event.rbi +0 -2
  23. data/rbi/openai/models/realtime/realtime_session.rbi +10 -4
  24. data/rbi/openai/models/realtime/realtime_session_create_request.rbi +4 -4
  25. data/rbi/openai/models/realtime/realtime_session_create_response.rbi +29 -77
  26. data/rbi/openai/models/realtime/realtime_tools_config_union.rbi +1 -1
  27. data/rbi/openai/models/realtime/realtime_transcription_session_create_response.rbi +290 -101
  28. data/rbi/openai/models/realtime/transcription_session_updated_event.rbi +311 -4
  29. data/sig/openai/models/realtime/realtime_client_event.rbs +0 -1
  30. data/sig/openai/models/realtime/{models.rbs → realtime_function_tool.rbs} +9 -9
  31. data/sig/openai/models/realtime/realtime_response_create_params.rbs +1 -1
  32. data/sig/openai/models/realtime/realtime_server_event.rbs +0 -2
  33. data/sig/openai/models/realtime/realtime_session.rbs +6 -6
  34. data/sig/openai/models/realtime/realtime_session_create_response.rbs +13 -31
  35. data/sig/openai/models/realtime/realtime_tools_config_union.rbs +1 -1
  36. data/sig/openai/models/realtime/realtime_transcription_session_create_response.rbs +123 -35
  37. data/sig/openai/models/realtime/transcription_session_updated_event.rbs +118 -4
  38. metadata +5 -14
  39. data/lib/openai/models/realtime/realtime_transcription_session_client_secret.rb +0 -38
  40. data/lib/openai/models/realtime/realtime_transcription_session_input_audio_transcription.rb +0 -66
  41. data/lib/openai/models/realtime/transcription_session_created.rb +0 -43
  42. data/rbi/openai/models/realtime/realtime_transcription_session_client_secret.rbi +0 -51
  43. data/rbi/openai/models/realtime/realtime_transcription_session_input_audio_transcription.rbi +0 -144
  44. data/rbi/openai/models/realtime/transcription_session_created.rbi +0 -79
  45. data/sig/openai/models/realtime/realtime_transcription_session_client_secret.rbs +0 -20
  46. data/sig/openai/models/realtime/realtime_transcription_session_input_audio_transcription.rbs +0 -59
  47. data/sig/openai/models/realtime/transcription_session_created.rbs +0 -32
@@ -17,8 +17,8 @@ module OpenAI
17
17
  # contains an ephemeral key. Default TTL for keys is 10 minutes. This property is
18
18
  # not present when a session is updated via the WebSocket API.
19
19
  #
20
- # @return [OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse]
21
- required :session, -> { OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse }
20
+ # @return [OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session]
21
+ required :session, -> { OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session }
22
22
 
23
23
  # @!attribute type
24
24
  # The event type, must be `transcription_session.updated`.
@@ -35,9 +35,158 @@ module OpenAI
35
35
  #
36
36
  # @param event_id [String] The unique ID of the server event.
37
37
  #
38
- # @param session [OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse] A new Realtime transcription session configuration.
38
+ # @param session [OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session] A new Realtime transcription session configuration.
39
39
  #
40
40
  # @param type [Symbol, :"transcription_session.updated"] The event type, must be `transcription_session.updated`.
41
+
42
+ # @see OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent#session
43
+ class Session < OpenAI::Internal::Type::BaseModel
44
+ # @!attribute client_secret
45
+ # Ephemeral key returned by the API. Only present when the session is created on
46
+ # the server via REST API.
47
+ #
48
+ # @return [OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session::ClientSecret]
49
+ required :client_secret, -> { OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::ClientSecret }
50
+
51
+ # @!attribute input_audio_format
52
+ # The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
53
+ #
54
+ # @return [String, nil]
55
+ optional :input_audio_format, String
56
+
57
+ # @!attribute input_audio_transcription
58
+ # Configuration of the transcription model.
59
+ #
60
+ # @return [OpenAI::Models::Realtime::AudioTranscription, nil]
61
+ optional :input_audio_transcription, -> { OpenAI::Realtime::AudioTranscription }
62
+
63
+ # @!attribute modalities
64
+ # The set of modalities the model can respond with. To disable audio, set this to
65
+ # ["text"].
66
+ #
67
+ # @return [Array<Symbol, OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session::Modality>, nil]
68
+ optional :modalities,
69
+ -> { OpenAI::Internal::Type::ArrayOf[enum: OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Modality] }
70
+
71
+ # @!attribute turn_detection
72
+ # Configuration for turn detection. Can be set to `null` to turn off. Server VAD
73
+ # means that the model will detect the start and end of speech based on audio
74
+ # volume and respond at the end of user speech.
75
+ #
76
+ # @return [OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session::TurnDetection, nil]
77
+ optional :turn_detection,
78
+ -> { OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::TurnDetection }
79
+
80
+ # @!method initialize(client_secret:, input_audio_format: nil, input_audio_transcription: nil, modalities: nil, turn_detection: nil)
81
+ # Some parameter documentations has been truncated, see
82
+ # {OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session} for more
83
+ # details.
84
+ #
85
+ # A new Realtime transcription session configuration.
86
+ #
87
+ # When a session is created on the server via REST API, the session object also
88
+ # contains an ephemeral key. Default TTL for keys is 10 minutes. This property is
89
+ # not present when a session is updated via the WebSocket API.
90
+ #
91
+ # @param client_secret [OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session::ClientSecret] Ephemeral key returned by the API. Only present when the session is
92
+ #
93
+ # @param input_audio_format [String] The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
94
+ #
95
+ # @param input_audio_transcription [OpenAI::Models::Realtime::AudioTranscription] Configuration of the transcription model.
96
+ #
97
+ # @param modalities [Array<Symbol, OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session::Modality>] The set of modalities the model can respond with. To disable audio,
98
+ #
99
+ # @param turn_detection [OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session::TurnDetection] Configuration for turn detection. Can be set to `null` to turn off. Server
100
+
101
+ # @see OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session#client_secret
102
+ class ClientSecret < OpenAI::Internal::Type::BaseModel
103
+ # @!attribute expires_at
104
+ # Timestamp for when the token expires. Currently, all tokens expire after one
105
+ # minute.
106
+ #
107
+ # @return [Integer]
108
+ required :expires_at, Integer
109
+
110
+ # @!attribute value
111
+ # Ephemeral key usable in client environments to authenticate connections to the
112
+ # Realtime API. Use this in client-side environments rather than a standard API
113
+ # token, which should only be used server-side.
114
+ #
115
+ # @return [String]
116
+ required :value, String
117
+
118
+ # @!method initialize(expires_at:, value:)
119
+ # Some parameter documentations has been truncated, see
120
+ # {OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session::ClientSecret}
121
+ # for more details.
122
+ #
123
+ # Ephemeral key returned by the API. Only present when the session is created on
124
+ # the server via REST API.
125
+ #
126
+ # @param expires_at [Integer] Timestamp for when the token expires. Currently, all tokens expire
127
+ #
128
+ # @param value [String] Ephemeral key usable in client environments to authenticate connections
129
+ end
130
+
131
+ module Modality
132
+ extend OpenAI::Internal::Type::Enum
133
+
134
+ TEXT = :text
135
+ AUDIO = :audio
136
+
137
+ # @!method self.values
138
+ # @return [Array<Symbol>]
139
+ end
140
+
141
+ # @see OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session#turn_detection
142
+ class TurnDetection < OpenAI::Internal::Type::BaseModel
143
+ # @!attribute prefix_padding_ms
144
+ # Amount of audio to include before the VAD detected speech (in milliseconds).
145
+ # Defaults to 300ms.
146
+ #
147
+ # @return [Integer, nil]
148
+ optional :prefix_padding_ms, Integer
149
+
150
+ # @!attribute silence_duration_ms
151
+ # Duration of silence to detect speech stop (in milliseconds). Defaults to 500ms.
152
+ # With shorter values the model will respond more quickly, but may jump in on
153
+ # short pauses from the user.
154
+ #
155
+ # @return [Integer, nil]
156
+ optional :silence_duration_ms, Integer
157
+
158
+ # @!attribute threshold
159
+ # Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A higher
160
+ # threshold will require louder audio to activate the model, and thus might
161
+ # perform better in noisy environments.
162
+ #
163
+ # @return [Float, nil]
164
+ optional :threshold, Float
165
+
166
+ # @!attribute type
167
+ # Type of turn detection, only `server_vad` is currently supported.
168
+ #
169
+ # @return [String, nil]
170
+ optional :type, String
171
+
172
+ # @!method initialize(prefix_padding_ms: nil, silence_duration_ms: nil, threshold: nil, type: nil)
173
+ # Some parameter documentations has been truncated, see
174
+ # {OpenAI::Models::Realtime::TranscriptionSessionUpdatedEvent::Session::TurnDetection}
175
+ # for more details.
176
+ #
177
+ # Configuration for turn detection. Can be set to `null` to turn off. Server VAD
178
+ # means that the model will detect the start and end of speech based on audio
179
+ # volume and respond at the end of user speech.
180
+ #
181
+ # @param prefix_padding_ms [Integer] Amount of audio to include before the VAD detected speech (in
182
+ #
183
+ # @param silence_duration_ms [Integer] Duration of silence to detect speech stop (in milliseconds). Defaults
184
+ #
185
+ # @param threshold [Float] Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A
186
+ #
187
+ # @param type [String] Type of turn detection, only `server_vad` is currently supported.
188
+ end
189
+ end
41
190
  end
42
191
  end
43
192
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenAI
4
- VERSION = "0.23.0"
4
+ VERSION = "0.23.1"
5
5
  end
data/lib/openai.rb CHANGED
@@ -411,7 +411,6 @@ require_relative "openai/models/realtime/log_prob_properties"
411
411
  require_relative "openai/models/realtime/mcp_list_tools_completed"
412
412
  require_relative "openai/models/realtime/mcp_list_tools_failed"
413
413
  require_relative "openai/models/realtime/mcp_list_tools_in_progress"
414
- require_relative "openai/models/realtime/models"
415
414
  require_relative "openai/models/realtime/noise_reduction_type"
416
415
  require_relative "openai/models/realtime/output_audio_buffer_clear_event"
417
416
  require_relative "openai/models/realtime/rate_limits_updated_event"
@@ -428,6 +427,7 @@ require_relative "openai/models/realtime/realtime_conversation_item_system_messa
428
427
  require_relative "openai/models/realtime/realtime_conversation_item_user_message"
429
428
  require_relative "openai/models/realtime/realtime_error"
430
429
  require_relative "openai/models/realtime/realtime_error_event"
430
+ require_relative "openai/models/realtime/realtime_function_tool"
431
431
  require_relative "openai/models/realtime/realtime_mcp_approval_request"
432
432
  require_relative "openai/models/realtime/realtime_mcp_approval_response"
433
433
  require_relative "openai/models/realtime/realtime_mcphttp_error"
@@ -455,10 +455,8 @@ require_relative "openai/models/realtime/realtime_tracing_config"
455
455
  require_relative "openai/models/realtime/realtime_transcription_session_audio"
456
456
  require_relative "openai/models/realtime/realtime_transcription_session_audio_input"
457
457
  require_relative "openai/models/realtime/realtime_transcription_session_audio_input_turn_detection"
458
- require_relative "openai/models/realtime/realtime_transcription_session_client_secret"
459
458
  require_relative "openai/models/realtime/realtime_transcription_session_create_request"
460
459
  require_relative "openai/models/realtime/realtime_transcription_session_create_response"
461
- require_relative "openai/models/realtime/realtime_transcription_session_input_audio_transcription"
462
460
  require_relative "openai/models/realtime/realtime_transcription_session_turn_detection"
463
461
  require_relative "openai/models/realtime/realtime_truncation"
464
462
  require_relative "openai/models/realtime/realtime_truncation_retention_ratio"
@@ -486,7 +484,6 @@ require_relative "openai/models/realtime/response_text_done_event"
486
484
  require_relative "openai/models/realtime/session_created_event"
487
485
  require_relative "openai/models/realtime/session_updated_event"
488
486
  require_relative "openai/models/realtime/session_update_event"
489
- require_relative "openai/models/realtime/transcription_session_created"
490
487
  require_relative "openai/models/realtime/transcription_session_update"
491
488
  require_relative "openai/models/realtime/transcription_session_updated_event"
492
489
  require_relative "openai/models/reasoning"
@@ -42,7 +42,7 @@ module OpenAI
42
42
  attr_writer :eagerness
43
43
 
44
44
  # Optional idle timeout after which turn detection will auto-timeout when no
45
- # additional audio is received.
45
+ # additional audio is received and emits a `timeout_triggered` event.
46
46
  sig { returns(T.nilable(Integer)) }
47
47
  attr_accessor :idle_timeout_ms
48
48
 
@@ -133,7 +133,7 @@ module OpenAI
133
133
  # and `high` have max timeouts of 8s, 4s, and 2s respectively.
134
134
  eagerness: nil,
135
135
  # Optional idle timeout after which turn detection will auto-timeout when no
136
- # additional audio is received.
136
+ # additional audio is received and emits a `timeout_triggered` event.
137
137
  idle_timeout_ms: nil,
138
138
  # Whether or not to automatically interrupt any ongoing response with output to
139
139
  # the default conversation (i.e. `conversation` of `auto`) when a VAD start event
@@ -20,8 +20,7 @@ module OpenAI
20
20
  OpenAI::Realtime::InputAudioBufferCommitEvent,
21
21
  OpenAI::Realtime::ResponseCancelEvent,
22
22
  OpenAI::Realtime::ResponseCreateEvent,
23
- OpenAI::Realtime::SessionUpdateEvent,
24
- OpenAI::Realtime::TranscriptionSessionUpdate
23
+ OpenAI::Realtime::SessionUpdateEvent
25
24
  )
26
25
  end
27
26
 
@@ -3,10 +3,13 @@
3
3
  module OpenAI
4
4
  module Models
5
5
  module Realtime
6
- class Models < OpenAI::Internal::Type::BaseModel
6
+ class RealtimeFunctionTool < OpenAI::Internal::Type::BaseModel
7
7
  OrHash =
8
8
  T.type_alias do
9
- T.any(OpenAI::Realtime::Models, OpenAI::Internal::AnyHash)
9
+ T.any(
10
+ OpenAI::Realtime::RealtimeFunctionTool,
11
+ OpenAI::Internal::AnyHash
12
+ )
10
13
  end
11
14
 
12
15
  # The description of the function, including guidance on when and how to call it,
@@ -32,10 +35,18 @@ module OpenAI
32
35
  attr_writer :parameters
33
36
 
34
37
  # The type of the tool, i.e. `function`.
35
- sig { returns(T.nilable(OpenAI::Realtime::Models::Type::OrSymbol)) }
38
+ sig do
39
+ returns(
40
+ T.nilable(OpenAI::Realtime::RealtimeFunctionTool::Type::OrSymbol)
41
+ )
42
+ end
36
43
  attr_reader :type
37
44
 
38
- sig { params(type: OpenAI::Realtime::Models::Type::OrSymbol).void }
45
+ sig do
46
+ params(
47
+ type: OpenAI::Realtime::RealtimeFunctionTool::Type::OrSymbol
48
+ ).void
49
+ end
39
50
  attr_writer :type
40
51
 
41
52
  sig do
@@ -43,7 +54,7 @@ module OpenAI
43
54
  description: String,
44
55
  name: String,
45
56
  parameters: T.anything,
46
- type: OpenAI::Realtime::Models::Type::OrSymbol
57
+ type: OpenAI::Realtime::RealtimeFunctionTool::Type::OrSymbol
47
58
  ).returns(T.attached_class)
48
59
  end
49
60
  def self.new(
@@ -65,7 +76,7 @@ module OpenAI
65
76
  description: String,
66
77
  name: String,
67
78
  parameters: T.anything,
68
- type: OpenAI::Realtime::Models::Type::OrSymbol
79
+ type: OpenAI::Realtime::RealtimeFunctionTool::Type::OrSymbol
69
80
  }
70
81
  )
71
82
  end
@@ -77,15 +88,22 @@ module OpenAI
77
88
  extend OpenAI::Internal::Type::Enum
78
89
 
79
90
  TaggedSymbol =
80
- T.type_alias { T.all(Symbol, OpenAI::Realtime::Models::Type) }
91
+ T.type_alias do
92
+ T.all(Symbol, OpenAI::Realtime::RealtimeFunctionTool::Type)
93
+ end
81
94
  OrSymbol = T.type_alias { T.any(Symbol, String) }
82
95
 
83
96
  FUNCTION =
84
- T.let(:function, OpenAI::Realtime::Models::Type::TaggedSymbol)
97
+ T.let(
98
+ :function,
99
+ OpenAI::Realtime::RealtimeFunctionTool::Type::TaggedSymbol
100
+ )
85
101
 
86
102
  sig do
87
103
  override.returns(
88
- T::Array[OpenAI::Realtime::Models::Type::TaggedSymbol]
104
+ T::Array[
105
+ OpenAI::Realtime::RealtimeFunctionTool::Type::TaggedSymbol
106
+ ]
89
107
  )
90
108
  end
91
109
  def self.values
@@ -204,7 +204,7 @@ module OpenAI
204
204
  T.nilable(
205
205
  T::Array[
206
206
  T.any(
207
- OpenAI::Realtime::Models,
207
+ OpenAI::Realtime::RealtimeFunctionTool,
208
208
  OpenAI::Realtime::RealtimeResponseCreateMcpTool
209
209
  )
210
210
  ]
@@ -218,7 +218,7 @@ module OpenAI
218
218
  tools:
219
219
  T::Array[
220
220
  T.any(
221
- OpenAI::Realtime::Models::OrHash,
221
+ OpenAI::Realtime::RealtimeFunctionTool::OrHash,
222
222
  OpenAI::Realtime::RealtimeResponseCreateMcpTool::OrHash
223
223
  )
224
224
  ]
@@ -266,7 +266,7 @@ module OpenAI
266
266
  tools:
267
267
  T::Array[
268
268
  T.any(
269
- OpenAI::Realtime::Models::OrHash,
269
+ OpenAI::Realtime::RealtimeFunctionTool::OrHash,
270
270
  OpenAI::Realtime::RealtimeResponseCreateMcpTool::OrHash
271
271
  )
272
272
  ]
@@ -364,7 +364,7 @@ module OpenAI
364
364
  tools:
365
365
  T::Array[
366
366
  T.any(
367
- OpenAI::Realtime::Models,
367
+ OpenAI::Realtime::RealtimeFunctionTool,
368
368
  OpenAI::Realtime::RealtimeResponseCreateMcpTool
369
369
  )
370
370
  ]
@@ -508,7 +508,7 @@ module OpenAI
508
508
  Variants =
509
509
  T.type_alias do
510
510
  T.any(
511
- OpenAI::Realtime::Models,
511
+ OpenAI::Realtime::RealtimeFunctionTool,
512
512
  OpenAI::Realtime::RealtimeResponseCreateMcpTool
513
513
  )
514
514
  end
@@ -40,8 +40,6 @@ module OpenAI
40
40
  OpenAI::Realtime::ResponseTextDoneEvent,
41
41
  OpenAI::Realtime::SessionCreatedEvent,
42
42
  OpenAI::Realtime::SessionUpdatedEvent,
43
- OpenAI::Realtime::TranscriptionSessionUpdatedEvent,
44
- OpenAI::Realtime::TranscriptionSessionCreated,
45
43
  OpenAI::Realtime::RealtimeServerEvent::OutputAudioBufferStarted,
46
44
  OpenAI::Realtime::RealtimeServerEvent::OutputAudioBufferStopped,
47
45
  OpenAI::Realtime::RealtimeServerEvent::OutputAudioBufferCleared,
@@ -225,10 +225,16 @@ module OpenAI
225
225
  attr_writer :tool_choice
226
226
 
227
227
  # Tools (functions) available to the model.
228
- sig { returns(T.nilable(T::Array[OpenAI::Realtime::Models])) }
228
+ sig do
229
+ returns(T.nilable(T::Array[OpenAI::Realtime::RealtimeFunctionTool]))
230
+ end
229
231
  attr_reader :tools
230
232
 
231
- sig { params(tools: T::Array[OpenAI::Realtime::Models::OrHash]).void }
233
+ sig do
234
+ params(
235
+ tools: T::Array[OpenAI::Realtime::RealtimeFunctionTool::OrHash]
236
+ ).void
237
+ end
232
238
  attr_writer :tools
233
239
 
234
240
  # Configuration options for tracing. Set to null to disable tracing. Once tracing
@@ -320,7 +326,7 @@ module OpenAI
320
326
  speed: Float,
321
327
  temperature: Float,
322
328
  tool_choice: String,
323
- tools: T::Array[OpenAI::Realtime::Models::OrHash],
329
+ tools: T::Array[OpenAI::Realtime::RealtimeFunctionTool::OrHash],
324
330
  tracing:
325
331
  T.nilable(
326
332
  T.any(
@@ -457,7 +463,7 @@ module OpenAI
457
463
  speed: Float,
458
464
  temperature: Float,
459
465
  tool_choice: String,
460
- tools: T::Array[OpenAI::Realtime::Models],
466
+ tools: T::Array[OpenAI::Realtime::RealtimeFunctionTool],
461
467
  tracing:
462
468
  T.nilable(
463
469
  T.any(
@@ -170,7 +170,7 @@ module OpenAI
170
170
  T.nilable(
171
171
  T::Array[
172
172
  T.any(
173
- OpenAI::Realtime::Models,
173
+ OpenAI::Realtime::RealtimeFunctionTool,
174
174
  OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp
175
175
  )
176
176
  ]
@@ -184,7 +184,7 @@ module OpenAI
184
184
  tools:
185
185
  T::Array[
186
186
  T.any(
187
- OpenAI::Realtime::Models::OrHash,
187
+ OpenAI::Realtime::RealtimeFunctionTool::OrHash,
188
188
  OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::OrHash
189
189
  )
190
190
  ]
@@ -264,7 +264,7 @@ module OpenAI
264
264
  tools:
265
265
  T::Array[
266
266
  T.any(
267
- OpenAI::Realtime::Models::OrHash,
267
+ OpenAI::Realtime::RealtimeFunctionTool::OrHash,
268
268
  OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::OrHash
269
269
  )
270
270
  ],
@@ -367,7 +367,7 @@ module OpenAI
367
367
  tools:
368
368
  T::Array[
369
369
  T.any(
370
- OpenAI::Realtime::Models,
370
+ OpenAI::Realtime::RealtimeFunctionTool,
371
371
  OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp
372
372
  )
373
373
  ],
@@ -14,6 +14,21 @@ module OpenAI
14
14
  )
15
15
  end
16
16
 
17
+ # Ephemeral key returned by the API.
18
+ sig { returns(OpenAI::Realtime::RealtimeSessionClientSecret) }
19
+ attr_reader :client_secret
20
+
21
+ sig do
22
+ params(
23
+ client_secret: OpenAI::Realtime::RealtimeSessionClientSecret::OrHash
24
+ ).void
25
+ end
26
+ attr_writer :client_secret
27
+
28
+ # The type of session to create. Always `realtime` for the Realtime API.
29
+ sig { returns(Symbol) }
30
+ attr_accessor :type
31
+
17
32
  # Configuration for input and output audio.
18
33
  sig do
19
34
  returns(
@@ -30,19 +45,6 @@ module OpenAI
30
45
  end
31
46
  attr_writer :audio
32
47
 
33
- # Ephemeral key returned by the API.
34
- sig do
35
- returns(T.nilable(OpenAI::Realtime::RealtimeSessionClientSecret))
36
- end
37
- attr_reader :client_secret
38
-
39
- sig do
40
- params(
41
- client_secret: OpenAI::Realtime::RealtimeSessionClientSecret::OrHash
42
- ).void
43
- end
44
- attr_writer :client_secret
45
-
46
48
  # Additional fields to include in server outputs.
47
49
  #
48
50
  # `item.input_audio_transcription.logprobs`: Include logprobs for input audio
@@ -198,7 +200,7 @@ module OpenAI
198
200
  tools:
199
201
  T::Array[
200
202
  T.any(
201
- OpenAI::Realtime::Models::OrHash,
203
+ OpenAI::Realtime::RealtimeFunctionTool::OrHash,
202
204
  OpenAI::Realtime::RealtimeSessionCreateResponse::Tool::McpTool::OrHash
203
205
  )
204
206
  ]
@@ -239,32 +241,14 @@ module OpenAI
239
241
  end
240
242
  attr_writer :truncation
241
243
 
242
- # The type of session to create. Always `realtime` for the Realtime API.
243
- sig do
244
- returns(
245
- T.nilable(
246
- OpenAI::Realtime::RealtimeSessionCreateResponse::Type::TaggedSymbol
247
- )
248
- )
249
- end
250
- attr_reader :type
251
-
252
- sig do
253
- params(
254
- type:
255
- OpenAI::Realtime::RealtimeSessionCreateResponse::Type::OrSymbol
256
- ).void
257
- end
258
- attr_writer :type
259
-
260
244
  # A new Realtime session configuration, with an ephemeral key. Default TTL for
261
245
  # keys is one minute.
262
246
  sig do
263
247
  params(
264
- audio:
265
- OpenAI::Realtime::RealtimeSessionCreateResponse::Audio::OrHash,
266
248
  client_secret:
267
249
  OpenAI::Realtime::RealtimeSessionClientSecret::OrHash,
250
+ audio:
251
+ OpenAI::Realtime::RealtimeSessionCreateResponse::Audio::OrHash,
268
252
  include:
269
253
  T::Array[
270
254
  OpenAI::Realtime::RealtimeSessionCreateResponse::Include::OrSymbol
@@ -290,7 +274,7 @@ module OpenAI
290
274
  tools:
291
275
  T::Array[
292
276
  T.any(
293
- OpenAI::Realtime::Models::OrHash,
277
+ OpenAI::Realtime::RealtimeFunctionTool::OrHash,
294
278
  OpenAI::Realtime::RealtimeSessionCreateResponse::Tool::McpTool::OrHash
295
279
  )
296
280
  ],
@@ -306,15 +290,14 @@ module OpenAI
306
290
  OpenAI::Realtime::RealtimeTruncation::RealtimeTruncationStrategy::OrSymbol,
307
291
  OpenAI::Realtime::RealtimeTruncationRetentionRatio::OrHash
308
292
  ),
309
- type:
310
- OpenAI::Realtime::RealtimeSessionCreateResponse::Type::OrSymbol
293
+ type: Symbol
311
294
  ).returns(T.attached_class)
312
295
  end
313
296
  def self.new(
297
+ # Ephemeral key returned by the API.
298
+ client_secret:,
314
299
  # Configuration for input and output audio.
315
300
  audio: nil,
316
- # Ephemeral key returned by the API.
317
- client_secret: nil,
318
301
  # Additional fields to include in server outputs.
319
302
  #
320
303
  # `item.input_audio_transcription.logprobs`: Include logprobs for input audio
@@ -362,15 +345,16 @@ module OpenAI
362
345
  # The default is `auto`.
363
346
  truncation: nil,
364
347
  # The type of session to create. Always `realtime` for the Realtime API.
365
- type: nil
348
+ type: :realtime
366
349
  )
367
350
  end
368
351
 
369
352
  sig do
370
353
  override.returns(
371
354
  {
372
- audio: OpenAI::Realtime::RealtimeSessionCreateResponse::Audio,
373
355
  client_secret: OpenAI::Realtime::RealtimeSessionClientSecret,
356
+ type: Symbol,
357
+ audio: OpenAI::Realtime::RealtimeSessionCreateResponse::Audio,
374
358
  include:
375
359
  T::Array[
376
360
  OpenAI::Realtime::RealtimeSessionCreateResponse::Include::TaggedSymbol
@@ -395,9 +379,7 @@ module OpenAI
395
379
  T.nilable(
396
380
  OpenAI::Realtime::RealtimeSessionCreateResponse::Tracing::Variants
397
381
  ),
398
- truncation: OpenAI::Realtime::RealtimeTruncation::Variants,
399
- type:
400
- OpenAI::Realtime::RealtimeSessionCreateResponse::Type::TaggedSymbol
382
+ truncation: OpenAI::Realtime::RealtimeTruncation::Variants
401
383
  }
402
384
  )
403
385
  end
@@ -722,7 +704,7 @@ module OpenAI
722
704
  attr_writer :eagerness
723
705
 
724
706
  # Optional idle timeout after which turn detection will auto-timeout when no
725
- # additional audio is received.
707
+ # additional audio is received and emits a `timeout_triggered` event.
726
708
  sig { returns(T.nilable(Integer)) }
727
709
  attr_accessor :idle_timeout_ms
728
710
 
@@ -813,7 +795,7 @@ module OpenAI
813
795
  # and `high` have max timeouts of 8s, 4s, and 2s respectively.
814
796
  eagerness: nil,
815
797
  # Optional idle timeout after which turn detection will auto-timeout when no
816
- # additional audio is received.
798
+ # additional audio is received and emits a `timeout_triggered` event.
817
799
  idle_timeout_ms: nil,
818
800
  # Whether or not to automatically interrupt any ongoing response with output to
819
801
  # the default conversation (i.e. `conversation` of `auto`) when a VAD start event
@@ -1330,7 +1312,7 @@ module OpenAI
1330
1312
  Variants =
1331
1313
  T.type_alias do
1332
1314
  T.any(
1333
- OpenAI::Realtime::Models,
1315
+ OpenAI::Realtime::RealtimeFunctionTool,
1334
1316
  OpenAI::Realtime::RealtimeSessionCreateResponse::Tool::McpTool
1335
1317
  )
1336
1318
  end
@@ -2037,36 +2019,6 @@ module OpenAI
2037
2019
  def self.variants
2038
2020
  end
2039
2021
  end
2040
-
2041
- # The type of session to create. Always `realtime` for the Realtime API.
2042
- module Type
2043
- extend OpenAI::Internal::Type::Enum
2044
-
2045
- TaggedSymbol =
2046
- T.type_alias do
2047
- T.all(
2048
- Symbol,
2049
- OpenAI::Realtime::RealtimeSessionCreateResponse::Type
2050
- )
2051
- end
2052
- OrSymbol = T.type_alias { T.any(Symbol, String) }
2053
-
2054
- REALTIME =
2055
- T.let(
2056
- :realtime,
2057
- OpenAI::Realtime::RealtimeSessionCreateResponse::Type::TaggedSymbol
2058
- )
2059
-
2060
- sig do
2061
- override.returns(
2062
- T::Array[
2063
- OpenAI::Realtime::RealtimeSessionCreateResponse::Type::TaggedSymbol
2064
- ]
2065
- )
2066
- end
2067
- def self.values
2068
- end
2069
- end
2070
2022
  end
2071
2023
  end
2072
2024
  end
@@ -12,7 +12,7 @@ module OpenAI
12
12
  Variants =
13
13
  T.type_alias do
14
14
  T.any(
15
- OpenAI::Realtime::Models,
15
+ OpenAI::Realtime::RealtimeFunctionTool,
16
16
  OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp
17
17
  )
18
18
  end