openai 0.22.1 → 0.23.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +1 -1
- data/lib/openai/models/realtime/audio_transcription.rb +60 -0
- data/lib/openai/models/realtime/client_secret_create_params.rb +18 -9
- data/lib/openai/models/realtime/client_secret_create_response.rb +11 -250
- data/lib/openai/models/realtime/conversation_item.rb +1 -1
- data/lib/openai/models/realtime/conversation_item_added.rb +14 -1
- data/lib/openai/models/realtime/conversation_item_done.rb +3 -0
- data/lib/openai/models/realtime/conversation_item_input_audio_transcription_completed_event.rb +10 -8
- data/lib/openai/models/realtime/conversation_item_input_audio_transcription_delta_event.rb +14 -5
- data/lib/openai/models/realtime/conversation_item_truncate_event.rb +2 -2
- data/lib/openai/models/realtime/input_audio_buffer_append_event.rb +10 -5
- data/lib/openai/models/realtime/models.rb +58 -0
- data/lib/openai/models/realtime/noise_reduction_type.rb +20 -0
- data/lib/openai/models/realtime/realtime_audio_config.rb +6 -427
- data/lib/openai/models/realtime/realtime_audio_config_input.rb +89 -0
- data/lib/openai/models/realtime/realtime_audio_config_output.rb +100 -0
- data/lib/openai/models/realtime/realtime_audio_formats.rb +121 -0
- data/lib/openai/models/realtime/realtime_audio_input_turn_detection.rb +131 -0
- data/lib/openai/models/realtime/realtime_client_event.rb +31 -23
- data/lib/openai/models/realtime/realtime_conversation_item_assistant_message.rb +43 -10
- data/lib/openai/models/realtime/realtime_conversation_item_function_call.rb +16 -7
- data/lib/openai/models/realtime/realtime_conversation_item_function_call_output.rb +15 -7
- data/lib/openai/models/realtime/realtime_conversation_item_system_message.rb +18 -6
- data/lib/openai/models/realtime/realtime_conversation_item_user_message.rb +62 -13
- data/lib/openai/models/realtime/realtime_response.rb +117 -107
- data/lib/openai/models/realtime/realtime_response_create_audio_output.rb +100 -0
- data/lib/openai/models/realtime/realtime_response_create_mcp_tool.rb +310 -0
- data/lib/openai/models/realtime/realtime_response_create_params.rb +225 -0
- data/lib/openai/models/realtime/realtime_response_status.rb +1 -1
- data/lib/openai/models/realtime/realtime_response_usage.rb +5 -2
- data/lib/openai/models/realtime/realtime_response_usage_input_token_details.rb +58 -8
- data/lib/openai/models/realtime/realtime_server_event.rb +21 -5
- data/lib/openai/models/realtime/realtime_session.rb +9 -125
- data/lib/openai/models/realtime/realtime_session_client_secret.rb +36 -0
- data/lib/openai/models/realtime/realtime_session_create_request.rb +50 -71
- data/lib/openai/models/realtime/realtime_session_create_response.rb +621 -219
- data/lib/openai/models/realtime/realtime_tools_config_union.rb +2 -53
- data/lib/openai/models/realtime/realtime_tracing_config.rb +7 -6
- data/lib/openai/models/realtime/realtime_transcription_session_audio.rb +19 -0
- data/lib/openai/models/realtime/realtime_transcription_session_audio_input.rb +90 -0
- data/lib/openai/models/realtime/realtime_transcription_session_audio_input_turn_detection.rb +131 -0
- data/lib/openai/models/realtime/realtime_transcription_session_client_secret.rb +38 -0
- data/lib/openai/models/realtime/realtime_transcription_session_create_request.rb +12 -270
- data/lib/openai/models/realtime/realtime_transcription_session_create_response.rb +78 -0
- data/lib/openai/models/realtime/realtime_transcription_session_input_audio_transcription.rb +66 -0
- data/lib/openai/models/realtime/realtime_transcription_session_turn_detection.rb +57 -0
- data/lib/openai/models/realtime/realtime_truncation.rb +8 -40
- data/lib/openai/models/realtime/realtime_truncation_retention_ratio.rb +34 -0
- data/lib/openai/models/realtime/response_cancel_event.rb +3 -1
- data/lib/openai/models/realtime/response_create_event.rb +18 -348
- data/lib/openai/models/realtime/response_done_event.rb +7 -0
- data/lib/openai/models/realtime/session_created_event.rb +20 -4
- data/lib/openai/models/realtime/session_update_event.rb +36 -12
- data/lib/openai/models/realtime/session_updated_event.rb +20 -4
- data/lib/openai/models/realtime/transcription_session_created.rb +8 -243
- data/lib/openai/models/realtime/transcription_session_update.rb +179 -3
- data/lib/openai/models/realtime/transcription_session_updated_event.rb +8 -243
- data/lib/openai/resources/realtime/client_secrets.rb +2 -3
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +19 -1
- data/rbi/openai/models/realtime/audio_transcription.rbi +132 -0
- data/rbi/openai/models/realtime/client_secret_create_params.rbi +25 -11
- data/rbi/openai/models/realtime/client_secret_create_response.rbi +2 -587
- data/rbi/openai/models/realtime/conversation_item_added.rbi +14 -1
- data/rbi/openai/models/realtime/conversation_item_done.rbi +3 -0
- data/rbi/openai/models/realtime/conversation_item_input_audio_transcription_completed_event.rbi +11 -8
- data/rbi/openai/models/realtime/conversation_item_input_audio_transcription_delta_event.rbi +15 -5
- data/rbi/openai/models/realtime/conversation_item_truncate_event.rbi +2 -2
- data/rbi/openai/models/realtime/input_audio_buffer_append_event.rbi +10 -5
- data/rbi/openai/models/realtime/models.rbi +97 -0
- data/rbi/openai/models/realtime/noise_reduction_type.rbi +31 -0
- data/rbi/openai/models/realtime/realtime_audio_config.rbi +8 -956
- data/rbi/openai/models/realtime/realtime_audio_config_input.rbi +221 -0
- data/rbi/openai/models/realtime/realtime_audio_config_output.rbi +222 -0
- data/rbi/openai/models/realtime/realtime_audio_formats.rbi +329 -0
- data/rbi/openai/models/realtime/realtime_audio_input_turn_detection.rbi +262 -0
- data/rbi/openai/models/realtime/realtime_conversation_item_assistant_message.rbi +51 -10
- data/rbi/openai/models/realtime/realtime_conversation_item_function_call.rbi +16 -7
- data/rbi/openai/models/realtime/realtime_conversation_item_function_call_output.rbi +14 -7
- data/rbi/openai/models/realtime/realtime_conversation_item_system_message.rbi +16 -6
- data/rbi/openai/models/realtime/realtime_conversation_item_user_message.rbi +110 -12
- data/rbi/openai/models/realtime/realtime_response.rbi +287 -212
- data/rbi/openai/models/realtime/realtime_response_create_audio_output.rbi +250 -0
- data/rbi/openai/models/realtime/realtime_response_create_mcp_tool.rbi +616 -0
- data/rbi/openai/models/realtime/realtime_response_create_params.rbi +529 -0
- data/rbi/openai/models/realtime/realtime_response_usage.rbi +8 -2
- data/rbi/openai/models/realtime/realtime_response_usage_input_token_details.rbi +106 -7
- data/rbi/openai/models/realtime/realtime_server_event.rbi +4 -1
- data/rbi/openai/models/realtime/realtime_session.rbi +12 -262
- data/rbi/openai/models/realtime/realtime_session_client_secret.rbi +49 -0
- data/rbi/openai/models/realtime/realtime_session_create_request.rbi +112 -133
- data/rbi/openai/models/realtime/realtime_session_create_response.rbi +1229 -405
- data/rbi/openai/models/realtime/realtime_tools_config_union.rbi +1 -117
- data/rbi/openai/models/realtime/realtime_tracing_config.rbi +11 -10
- data/rbi/openai/models/realtime/realtime_transcription_session_audio.rbi +50 -0
- data/rbi/openai/models/realtime/realtime_transcription_session_audio_input.rbi +226 -0
- data/rbi/openai/models/realtime/realtime_transcription_session_audio_input_turn_detection.rbi +259 -0
- data/rbi/openai/models/realtime/realtime_transcription_session_client_secret.rbi +51 -0
- data/rbi/openai/models/realtime/realtime_transcription_session_create_request.rbi +25 -597
- data/rbi/openai/models/realtime/realtime_transcription_session_create_response.rbi +195 -0
- data/rbi/openai/models/realtime/realtime_transcription_session_input_audio_transcription.rbi +144 -0
- data/rbi/openai/models/realtime/realtime_transcription_session_turn_detection.rbi +94 -0
- data/rbi/openai/models/realtime/realtime_truncation.rbi +5 -56
- data/rbi/openai/models/realtime/realtime_truncation_retention_ratio.rbi +45 -0
- data/rbi/openai/models/realtime/response_cancel_event.rbi +3 -1
- data/rbi/openai/models/realtime/response_create_event.rbi +19 -786
- data/rbi/openai/models/realtime/response_done_event.rbi +7 -0
- data/rbi/openai/models/realtime/session_created_event.rbi +42 -9
- data/rbi/openai/models/realtime/session_update_event.rbi +57 -19
- data/rbi/openai/models/realtime/session_updated_event.rbi +42 -9
- data/rbi/openai/models/realtime/transcription_session_created.rbi +17 -591
- data/rbi/openai/models/realtime/transcription_session_update.rbi +425 -7
- data/rbi/openai/models/realtime/transcription_session_updated_event.rbi +14 -591
- data/rbi/openai/resources/realtime/client_secrets.rbi +5 -3
- data/sig/openai/models/realtime/audio_transcription.rbs +57 -0
- data/sig/openai/models/realtime/client_secret_create_response.rbs +1 -251
- data/sig/openai/models/realtime/models.rbs +57 -0
- data/sig/openai/models/realtime/noise_reduction_type.rbs +16 -0
- data/sig/openai/models/realtime/realtime_audio_config.rbs +12 -331
- data/sig/openai/models/realtime/realtime_audio_config_input.rbs +72 -0
- data/sig/openai/models/realtime/realtime_audio_config_output.rbs +72 -0
- data/sig/openai/models/realtime/realtime_audio_formats.rbs +128 -0
- data/sig/openai/models/realtime/realtime_audio_input_turn_detection.rbs +99 -0
- data/sig/openai/models/realtime/realtime_conversation_item_assistant_message.rbs +17 -2
- data/sig/openai/models/realtime/realtime_conversation_item_user_message.rbs +30 -1
- data/sig/openai/models/realtime/realtime_response.rbs +103 -82
- data/sig/openai/models/realtime/realtime_response_create_audio_output.rbs +84 -0
- data/sig/openai/models/realtime/realtime_response_create_mcp_tool.rbs +218 -0
- data/sig/openai/models/realtime/realtime_response_create_params.rbs +148 -0
- data/sig/openai/models/realtime/realtime_response_usage_input_token_details.rbs +50 -1
- data/sig/openai/models/realtime/realtime_session.rbs +16 -106
- data/sig/openai/models/realtime/realtime_session_client_secret.rbs +20 -0
- data/sig/openai/models/realtime/realtime_session_create_request.rbs +27 -43
- data/sig/openai/models/realtime/realtime_session_create_response.rbs +389 -187
- data/sig/openai/models/realtime/realtime_tools_config_union.rbs +1 -53
- data/sig/openai/models/realtime/realtime_transcription_session_audio.rbs +24 -0
- data/sig/openai/models/realtime/realtime_transcription_session_audio_input.rbs +72 -0
- data/sig/openai/models/realtime/realtime_transcription_session_audio_input_turn_detection.rbs +99 -0
- data/sig/openai/models/realtime/realtime_transcription_session_client_secret.rbs +20 -0
- data/sig/openai/models/realtime/realtime_transcription_session_create_request.rbs +11 -203
- data/sig/openai/models/realtime/realtime_transcription_session_create_response.rbs +69 -0
- data/sig/openai/models/realtime/realtime_transcription_session_input_audio_transcription.rbs +59 -0
- data/sig/openai/models/realtime/realtime_transcription_session_turn_detection.rbs +47 -0
- data/sig/openai/models/realtime/realtime_truncation.rbs +1 -28
- data/sig/openai/models/realtime/realtime_truncation_retention_ratio.rbs +21 -0
- data/sig/openai/models/realtime/response_create_event.rbs +6 -249
- data/sig/openai/models/realtime/session_created_event.rbs +14 -4
- data/sig/openai/models/realtime/session_update_event.rbs +14 -4
- data/sig/openai/models/realtime/session_updated_event.rbs +14 -4
- data/sig/openai/models/realtime/transcription_session_created.rbs +4 -254
- data/sig/openai/models/realtime/transcription_session_update.rbs +154 -4
- data/sig/openai/models/realtime/transcription_session_updated_event.rbs +4 -254
- metadata +59 -5
- data/lib/openai/models/realtime/realtime_client_secret_config.rb +0 -64
- data/rbi/openai/models/realtime/realtime_client_secret_config.rbi +0 -147
- data/sig/openai/models/realtime/realtime_client_secret_config.rbs +0 -60
|
@@ -16,16 +16,20 @@ module OpenAI
|
|
|
16
16
|
sig { returns(String) }
|
|
17
17
|
attr_accessor :event_id
|
|
18
18
|
|
|
19
|
-
# A Realtime transcription session configuration
|
|
19
|
+
# A new Realtime transcription session configuration.
|
|
20
|
+
#
|
|
21
|
+
# When a session is created on the server via REST API, the session object also
|
|
22
|
+
# contains an ephemeral key. Default TTL for keys is 10 minutes. This property is
|
|
23
|
+
# not present when a session is updated via the WebSocket API.
|
|
20
24
|
sig do
|
|
21
|
-
returns(OpenAI::Realtime::
|
|
25
|
+
returns(OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse)
|
|
22
26
|
end
|
|
23
27
|
attr_reader :session
|
|
24
28
|
|
|
25
29
|
sig do
|
|
26
30
|
params(
|
|
27
31
|
session:
|
|
28
|
-
OpenAI::Realtime::
|
|
32
|
+
OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::OrHash
|
|
29
33
|
).void
|
|
30
34
|
end
|
|
31
35
|
attr_writer :session
|
|
@@ -40,14 +44,18 @@ module OpenAI
|
|
|
40
44
|
params(
|
|
41
45
|
event_id: String,
|
|
42
46
|
session:
|
|
43
|
-
OpenAI::Realtime::
|
|
47
|
+
OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::OrHash,
|
|
44
48
|
type: Symbol
|
|
45
49
|
).returns(T.attached_class)
|
|
46
50
|
end
|
|
47
51
|
def self.new(
|
|
48
52
|
# The unique ID of the server event.
|
|
49
53
|
event_id:,
|
|
50
|
-
# A Realtime transcription session configuration
|
|
54
|
+
# A new Realtime transcription session configuration.
|
|
55
|
+
#
|
|
56
|
+
# When a session is created on the server via REST API, the session object also
|
|
57
|
+
# contains an ephemeral key. Default TTL for keys is 10 minutes. This property is
|
|
58
|
+
# not present when a session is updated via the WebSocket API.
|
|
51
59
|
session:,
|
|
52
60
|
# The event type, must be `transcription_session.updated`.
|
|
53
61
|
type: :"transcription_session.updated"
|
|
@@ -59,598 +67,13 @@ module OpenAI
|
|
|
59
67
|
{
|
|
60
68
|
event_id: String,
|
|
61
69
|
session:
|
|
62
|
-
OpenAI::Realtime::
|
|
70
|
+
OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse,
|
|
63
71
|
type: Symbol
|
|
64
72
|
}
|
|
65
73
|
)
|
|
66
74
|
end
|
|
67
75
|
def to_hash
|
|
68
76
|
end
|
|
69
|
-
|
|
70
|
-
class Session < OpenAI::Internal::Type::BaseModel
|
|
71
|
-
OrHash =
|
|
72
|
-
T.type_alias do
|
|
73
|
-
T.any(
|
|
74
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session,
|
|
75
|
-
OpenAI::Internal::AnyHash
|
|
76
|
-
)
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
# Unique identifier for the session that looks like `sess_1234567890abcdef`.
|
|
80
|
-
sig { returns(T.nilable(String)) }
|
|
81
|
-
attr_reader :id
|
|
82
|
-
|
|
83
|
-
sig { params(id: String).void }
|
|
84
|
-
attr_writer :id
|
|
85
|
-
|
|
86
|
-
# Configuration for input audio for the session.
|
|
87
|
-
sig do
|
|
88
|
-
returns(
|
|
89
|
-
T.nilable(
|
|
90
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio
|
|
91
|
-
)
|
|
92
|
-
)
|
|
93
|
-
end
|
|
94
|
-
attr_reader :audio
|
|
95
|
-
|
|
96
|
-
sig do
|
|
97
|
-
params(
|
|
98
|
-
audio:
|
|
99
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::OrHash
|
|
100
|
-
).void
|
|
101
|
-
end
|
|
102
|
-
attr_writer :audio
|
|
103
|
-
|
|
104
|
-
# Expiration timestamp for the session, in seconds since epoch.
|
|
105
|
-
sig { returns(T.nilable(Integer)) }
|
|
106
|
-
attr_reader :expires_at
|
|
107
|
-
|
|
108
|
-
sig { params(expires_at: Integer).void }
|
|
109
|
-
attr_writer :expires_at
|
|
110
|
-
|
|
111
|
-
# Additional fields to include in server outputs.
|
|
112
|
-
#
|
|
113
|
-
# - `item.input_audio_transcription.logprobs`: Include logprobs for input audio
|
|
114
|
-
# transcription.
|
|
115
|
-
sig do
|
|
116
|
-
returns(
|
|
117
|
-
T.nilable(
|
|
118
|
-
T::Array[
|
|
119
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Include::OrSymbol
|
|
120
|
-
]
|
|
121
|
-
)
|
|
122
|
-
)
|
|
123
|
-
end
|
|
124
|
-
attr_reader :include
|
|
125
|
-
|
|
126
|
-
sig do
|
|
127
|
-
params(
|
|
128
|
-
include:
|
|
129
|
-
T::Array[
|
|
130
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Include::OrSymbol
|
|
131
|
-
]
|
|
132
|
-
).void
|
|
133
|
-
end
|
|
134
|
-
attr_writer :include
|
|
135
|
-
|
|
136
|
-
# The object type. Always `realtime.transcription_session`.
|
|
137
|
-
sig { returns(T.nilable(String)) }
|
|
138
|
-
attr_reader :object
|
|
139
|
-
|
|
140
|
-
sig { params(object: String).void }
|
|
141
|
-
attr_writer :object
|
|
142
|
-
|
|
143
|
-
# A Realtime transcription session configuration object.
|
|
144
|
-
sig do
|
|
145
|
-
params(
|
|
146
|
-
id: String,
|
|
147
|
-
audio:
|
|
148
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::OrHash,
|
|
149
|
-
expires_at: Integer,
|
|
150
|
-
include:
|
|
151
|
-
T::Array[
|
|
152
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Include::OrSymbol
|
|
153
|
-
],
|
|
154
|
-
object: String
|
|
155
|
-
).returns(T.attached_class)
|
|
156
|
-
end
|
|
157
|
-
def self.new(
|
|
158
|
-
# Unique identifier for the session that looks like `sess_1234567890abcdef`.
|
|
159
|
-
id: nil,
|
|
160
|
-
# Configuration for input audio for the session.
|
|
161
|
-
audio: nil,
|
|
162
|
-
# Expiration timestamp for the session, in seconds since epoch.
|
|
163
|
-
expires_at: nil,
|
|
164
|
-
# Additional fields to include in server outputs.
|
|
165
|
-
#
|
|
166
|
-
# - `item.input_audio_transcription.logprobs`: Include logprobs for input audio
|
|
167
|
-
# transcription.
|
|
168
|
-
include: nil,
|
|
169
|
-
# The object type. Always `realtime.transcription_session`.
|
|
170
|
-
object: nil
|
|
171
|
-
)
|
|
172
|
-
end
|
|
173
|
-
|
|
174
|
-
sig do
|
|
175
|
-
override.returns(
|
|
176
|
-
{
|
|
177
|
-
id: String,
|
|
178
|
-
audio:
|
|
179
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio,
|
|
180
|
-
expires_at: Integer,
|
|
181
|
-
include:
|
|
182
|
-
T::Array[
|
|
183
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Include::OrSymbol
|
|
184
|
-
],
|
|
185
|
-
object: String
|
|
186
|
-
}
|
|
187
|
-
)
|
|
188
|
-
end
|
|
189
|
-
def to_hash
|
|
190
|
-
end
|
|
191
|
-
|
|
192
|
-
class Audio < OpenAI::Internal::Type::BaseModel
|
|
193
|
-
OrHash =
|
|
194
|
-
T.type_alias do
|
|
195
|
-
T.any(
|
|
196
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio,
|
|
197
|
-
OpenAI::Internal::AnyHash
|
|
198
|
-
)
|
|
199
|
-
end
|
|
200
|
-
|
|
201
|
-
sig do
|
|
202
|
-
returns(
|
|
203
|
-
T.nilable(
|
|
204
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input
|
|
205
|
-
)
|
|
206
|
-
)
|
|
207
|
-
end
|
|
208
|
-
attr_reader :input
|
|
209
|
-
|
|
210
|
-
sig do
|
|
211
|
-
params(
|
|
212
|
-
input:
|
|
213
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::OrHash
|
|
214
|
-
).void
|
|
215
|
-
end
|
|
216
|
-
attr_writer :input
|
|
217
|
-
|
|
218
|
-
# Configuration for input audio for the session.
|
|
219
|
-
sig do
|
|
220
|
-
params(
|
|
221
|
-
input:
|
|
222
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::OrHash
|
|
223
|
-
).returns(T.attached_class)
|
|
224
|
-
end
|
|
225
|
-
def self.new(input: nil)
|
|
226
|
-
end
|
|
227
|
-
|
|
228
|
-
sig do
|
|
229
|
-
override.returns(
|
|
230
|
-
{
|
|
231
|
-
input:
|
|
232
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input
|
|
233
|
-
}
|
|
234
|
-
)
|
|
235
|
-
end
|
|
236
|
-
def to_hash
|
|
237
|
-
end
|
|
238
|
-
|
|
239
|
-
class Input < OpenAI::Internal::Type::BaseModel
|
|
240
|
-
OrHash =
|
|
241
|
-
T.type_alias do
|
|
242
|
-
T.any(
|
|
243
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input,
|
|
244
|
-
OpenAI::Internal::AnyHash
|
|
245
|
-
)
|
|
246
|
-
end
|
|
247
|
-
|
|
248
|
-
# The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
|
|
249
|
-
sig { returns(T.nilable(String)) }
|
|
250
|
-
attr_reader :format_
|
|
251
|
-
|
|
252
|
-
sig { params(format_: String).void }
|
|
253
|
-
attr_writer :format_
|
|
254
|
-
|
|
255
|
-
# Configuration for input audio noise reduction.
|
|
256
|
-
sig do
|
|
257
|
-
returns(
|
|
258
|
-
T.nilable(
|
|
259
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::NoiseReduction
|
|
260
|
-
)
|
|
261
|
-
)
|
|
262
|
-
end
|
|
263
|
-
attr_reader :noise_reduction
|
|
264
|
-
|
|
265
|
-
sig do
|
|
266
|
-
params(
|
|
267
|
-
noise_reduction:
|
|
268
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::NoiseReduction::OrHash
|
|
269
|
-
).void
|
|
270
|
-
end
|
|
271
|
-
attr_writer :noise_reduction
|
|
272
|
-
|
|
273
|
-
# Configuration of the transcription model.
|
|
274
|
-
sig do
|
|
275
|
-
returns(
|
|
276
|
-
T.nilable(
|
|
277
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::Transcription
|
|
278
|
-
)
|
|
279
|
-
)
|
|
280
|
-
end
|
|
281
|
-
attr_reader :transcription
|
|
282
|
-
|
|
283
|
-
sig do
|
|
284
|
-
params(
|
|
285
|
-
transcription:
|
|
286
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::Transcription::OrHash
|
|
287
|
-
).void
|
|
288
|
-
end
|
|
289
|
-
attr_writer :transcription
|
|
290
|
-
|
|
291
|
-
# Configuration for turn detection.
|
|
292
|
-
sig do
|
|
293
|
-
returns(
|
|
294
|
-
T.nilable(
|
|
295
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::TurnDetection
|
|
296
|
-
)
|
|
297
|
-
)
|
|
298
|
-
end
|
|
299
|
-
attr_reader :turn_detection
|
|
300
|
-
|
|
301
|
-
sig do
|
|
302
|
-
params(
|
|
303
|
-
turn_detection:
|
|
304
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::TurnDetection::OrHash
|
|
305
|
-
).void
|
|
306
|
-
end
|
|
307
|
-
attr_writer :turn_detection
|
|
308
|
-
|
|
309
|
-
sig do
|
|
310
|
-
params(
|
|
311
|
-
format_: String,
|
|
312
|
-
noise_reduction:
|
|
313
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::NoiseReduction::OrHash,
|
|
314
|
-
transcription:
|
|
315
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::Transcription::OrHash,
|
|
316
|
-
turn_detection:
|
|
317
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::TurnDetection::OrHash
|
|
318
|
-
).returns(T.attached_class)
|
|
319
|
-
end
|
|
320
|
-
def self.new(
|
|
321
|
-
# The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`.
|
|
322
|
-
format_: nil,
|
|
323
|
-
# Configuration for input audio noise reduction.
|
|
324
|
-
noise_reduction: nil,
|
|
325
|
-
# Configuration of the transcription model.
|
|
326
|
-
transcription: nil,
|
|
327
|
-
# Configuration for turn detection.
|
|
328
|
-
turn_detection: nil
|
|
329
|
-
)
|
|
330
|
-
end
|
|
331
|
-
|
|
332
|
-
sig do
|
|
333
|
-
override.returns(
|
|
334
|
-
{
|
|
335
|
-
format_: String,
|
|
336
|
-
noise_reduction:
|
|
337
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::NoiseReduction,
|
|
338
|
-
transcription:
|
|
339
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::Transcription,
|
|
340
|
-
turn_detection:
|
|
341
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::TurnDetection
|
|
342
|
-
}
|
|
343
|
-
)
|
|
344
|
-
end
|
|
345
|
-
def to_hash
|
|
346
|
-
end
|
|
347
|
-
|
|
348
|
-
class NoiseReduction < OpenAI::Internal::Type::BaseModel
|
|
349
|
-
OrHash =
|
|
350
|
-
T.type_alias do
|
|
351
|
-
T.any(
|
|
352
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::NoiseReduction,
|
|
353
|
-
OpenAI::Internal::AnyHash
|
|
354
|
-
)
|
|
355
|
-
end
|
|
356
|
-
|
|
357
|
-
sig do
|
|
358
|
-
returns(
|
|
359
|
-
T.nilable(
|
|
360
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::NoiseReduction::Type::OrSymbol
|
|
361
|
-
)
|
|
362
|
-
)
|
|
363
|
-
end
|
|
364
|
-
attr_reader :type
|
|
365
|
-
|
|
366
|
-
sig do
|
|
367
|
-
params(
|
|
368
|
-
type:
|
|
369
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::NoiseReduction::Type::OrSymbol
|
|
370
|
-
).void
|
|
371
|
-
end
|
|
372
|
-
attr_writer :type
|
|
373
|
-
|
|
374
|
-
# Configuration for input audio noise reduction.
|
|
375
|
-
sig do
|
|
376
|
-
params(
|
|
377
|
-
type:
|
|
378
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::NoiseReduction::Type::OrSymbol
|
|
379
|
-
).returns(T.attached_class)
|
|
380
|
-
end
|
|
381
|
-
def self.new(type: nil)
|
|
382
|
-
end
|
|
383
|
-
|
|
384
|
-
sig do
|
|
385
|
-
override.returns(
|
|
386
|
-
{
|
|
387
|
-
type:
|
|
388
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::NoiseReduction::Type::OrSymbol
|
|
389
|
-
}
|
|
390
|
-
)
|
|
391
|
-
end
|
|
392
|
-
def to_hash
|
|
393
|
-
end
|
|
394
|
-
|
|
395
|
-
module Type
|
|
396
|
-
extend OpenAI::Internal::Type::Enum
|
|
397
|
-
|
|
398
|
-
TaggedSymbol =
|
|
399
|
-
T.type_alias do
|
|
400
|
-
T.all(
|
|
401
|
-
Symbol,
|
|
402
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::NoiseReduction::Type
|
|
403
|
-
)
|
|
404
|
-
end
|
|
405
|
-
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
406
|
-
|
|
407
|
-
NEAR_FIELD =
|
|
408
|
-
T.let(
|
|
409
|
-
:near_field,
|
|
410
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::NoiseReduction::Type::TaggedSymbol
|
|
411
|
-
)
|
|
412
|
-
FAR_FIELD =
|
|
413
|
-
T.let(
|
|
414
|
-
:far_field,
|
|
415
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::NoiseReduction::Type::TaggedSymbol
|
|
416
|
-
)
|
|
417
|
-
|
|
418
|
-
sig do
|
|
419
|
-
override.returns(
|
|
420
|
-
T::Array[
|
|
421
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::NoiseReduction::Type::TaggedSymbol
|
|
422
|
-
]
|
|
423
|
-
)
|
|
424
|
-
end
|
|
425
|
-
def self.values
|
|
426
|
-
end
|
|
427
|
-
end
|
|
428
|
-
end
|
|
429
|
-
|
|
430
|
-
class Transcription < OpenAI::Internal::Type::BaseModel
|
|
431
|
-
OrHash =
|
|
432
|
-
T.type_alias do
|
|
433
|
-
T.any(
|
|
434
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::Transcription,
|
|
435
|
-
OpenAI::Internal::AnyHash
|
|
436
|
-
)
|
|
437
|
-
end
|
|
438
|
-
|
|
439
|
-
# The language of the input audio. Supplying the input language in
|
|
440
|
-
# [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`)
|
|
441
|
-
# format will improve accuracy and latency.
|
|
442
|
-
sig { returns(T.nilable(String)) }
|
|
443
|
-
attr_reader :language
|
|
444
|
-
|
|
445
|
-
sig { params(language: String).void }
|
|
446
|
-
attr_writer :language
|
|
447
|
-
|
|
448
|
-
# The model to use for transcription. Can be `gpt-4o-transcribe`,
|
|
449
|
-
# `gpt-4o-mini-transcribe`, or `whisper-1`.
|
|
450
|
-
sig do
|
|
451
|
-
returns(
|
|
452
|
-
T.nilable(
|
|
453
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::Transcription::Model::OrSymbol
|
|
454
|
-
)
|
|
455
|
-
)
|
|
456
|
-
end
|
|
457
|
-
attr_reader :model
|
|
458
|
-
|
|
459
|
-
sig do
|
|
460
|
-
params(
|
|
461
|
-
model:
|
|
462
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::Transcription::Model::OrSymbol
|
|
463
|
-
).void
|
|
464
|
-
end
|
|
465
|
-
attr_writer :model
|
|
466
|
-
|
|
467
|
-
# An optional text to guide the model's style or continue a previous audio
|
|
468
|
-
# segment. The
|
|
469
|
-
# [prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting)
|
|
470
|
-
# should match the audio language.
|
|
471
|
-
sig { returns(T.nilable(String)) }
|
|
472
|
-
attr_reader :prompt
|
|
473
|
-
|
|
474
|
-
sig { params(prompt: String).void }
|
|
475
|
-
attr_writer :prompt
|
|
476
|
-
|
|
477
|
-
# Configuration of the transcription model.
|
|
478
|
-
sig do
|
|
479
|
-
params(
|
|
480
|
-
language: String,
|
|
481
|
-
model:
|
|
482
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::Transcription::Model::OrSymbol,
|
|
483
|
-
prompt: String
|
|
484
|
-
).returns(T.attached_class)
|
|
485
|
-
end
|
|
486
|
-
def self.new(
|
|
487
|
-
# The language of the input audio. Supplying the input language in
|
|
488
|
-
# [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`)
|
|
489
|
-
# format will improve accuracy and latency.
|
|
490
|
-
language: nil,
|
|
491
|
-
# The model to use for transcription. Can be `gpt-4o-transcribe`,
|
|
492
|
-
# `gpt-4o-mini-transcribe`, or `whisper-1`.
|
|
493
|
-
model: nil,
|
|
494
|
-
# An optional text to guide the model's style or continue a previous audio
|
|
495
|
-
# segment. The
|
|
496
|
-
# [prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting)
|
|
497
|
-
# should match the audio language.
|
|
498
|
-
prompt: nil
|
|
499
|
-
)
|
|
500
|
-
end
|
|
501
|
-
|
|
502
|
-
sig do
|
|
503
|
-
override.returns(
|
|
504
|
-
{
|
|
505
|
-
language: String,
|
|
506
|
-
model:
|
|
507
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::Transcription::Model::OrSymbol,
|
|
508
|
-
prompt: String
|
|
509
|
-
}
|
|
510
|
-
)
|
|
511
|
-
end
|
|
512
|
-
def to_hash
|
|
513
|
-
end
|
|
514
|
-
|
|
515
|
-
# The model to use for transcription. Can be `gpt-4o-transcribe`,
|
|
516
|
-
# `gpt-4o-mini-transcribe`, or `whisper-1`.
|
|
517
|
-
module Model
|
|
518
|
-
extend OpenAI::Internal::Type::Enum
|
|
519
|
-
|
|
520
|
-
TaggedSymbol =
|
|
521
|
-
T.type_alias do
|
|
522
|
-
T.all(
|
|
523
|
-
Symbol,
|
|
524
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::Transcription::Model
|
|
525
|
-
)
|
|
526
|
-
end
|
|
527
|
-
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
528
|
-
|
|
529
|
-
GPT_4O_TRANSCRIBE =
|
|
530
|
-
T.let(
|
|
531
|
-
:"gpt-4o-transcribe",
|
|
532
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::Transcription::Model::TaggedSymbol
|
|
533
|
-
)
|
|
534
|
-
GPT_4O_MINI_TRANSCRIBE =
|
|
535
|
-
T.let(
|
|
536
|
-
:"gpt-4o-mini-transcribe",
|
|
537
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::Transcription::Model::TaggedSymbol
|
|
538
|
-
)
|
|
539
|
-
WHISPER_1 =
|
|
540
|
-
T.let(
|
|
541
|
-
:"whisper-1",
|
|
542
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::Transcription::Model::TaggedSymbol
|
|
543
|
-
)
|
|
544
|
-
|
|
545
|
-
sig do
|
|
546
|
-
override.returns(
|
|
547
|
-
T::Array[
|
|
548
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::Transcription::Model::TaggedSymbol
|
|
549
|
-
]
|
|
550
|
-
)
|
|
551
|
-
end
|
|
552
|
-
def self.values
|
|
553
|
-
end
|
|
554
|
-
end
|
|
555
|
-
end
|
|
556
|
-
|
|
557
|
-
class TurnDetection < OpenAI::Internal::Type::BaseModel
|
|
558
|
-
OrHash =
|
|
559
|
-
T.type_alias do
|
|
560
|
-
T.any(
|
|
561
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Audio::Input::TurnDetection,
|
|
562
|
-
OpenAI::Internal::AnyHash
|
|
563
|
-
)
|
|
564
|
-
end
|
|
565
|
-
|
|
566
|
-
sig { returns(T.nilable(Integer)) }
|
|
567
|
-
attr_reader :prefix_padding_ms
|
|
568
|
-
|
|
569
|
-
sig { params(prefix_padding_ms: Integer).void }
|
|
570
|
-
attr_writer :prefix_padding_ms
|
|
571
|
-
|
|
572
|
-
sig { returns(T.nilable(Integer)) }
|
|
573
|
-
attr_reader :silence_duration_ms
|
|
574
|
-
|
|
575
|
-
sig { params(silence_duration_ms: Integer).void }
|
|
576
|
-
attr_writer :silence_duration_ms
|
|
577
|
-
|
|
578
|
-
sig { returns(T.nilable(Float)) }
|
|
579
|
-
attr_reader :threshold
|
|
580
|
-
|
|
581
|
-
sig { params(threshold: Float).void }
|
|
582
|
-
attr_writer :threshold
|
|
583
|
-
|
|
584
|
-
# Type of turn detection, only `server_vad` is currently supported.
|
|
585
|
-
sig { returns(T.nilable(String)) }
|
|
586
|
-
attr_reader :type
|
|
587
|
-
|
|
588
|
-
sig { params(type: String).void }
|
|
589
|
-
attr_writer :type
|
|
590
|
-
|
|
591
|
-
# Configuration for turn detection.
|
|
592
|
-
sig do
|
|
593
|
-
params(
|
|
594
|
-
prefix_padding_ms: Integer,
|
|
595
|
-
silence_duration_ms: Integer,
|
|
596
|
-
threshold: Float,
|
|
597
|
-
type: String
|
|
598
|
-
).returns(T.attached_class)
|
|
599
|
-
end
|
|
600
|
-
def self.new(
|
|
601
|
-
prefix_padding_ms: nil,
|
|
602
|
-
silence_duration_ms: nil,
|
|
603
|
-
threshold: nil,
|
|
604
|
-
# Type of turn detection, only `server_vad` is currently supported.
|
|
605
|
-
type: nil
|
|
606
|
-
)
|
|
607
|
-
end
|
|
608
|
-
|
|
609
|
-
sig do
|
|
610
|
-
override.returns(
|
|
611
|
-
{
|
|
612
|
-
prefix_padding_ms: Integer,
|
|
613
|
-
silence_duration_ms: Integer,
|
|
614
|
-
threshold: Float,
|
|
615
|
-
type: String
|
|
616
|
-
}
|
|
617
|
-
)
|
|
618
|
-
end
|
|
619
|
-
def to_hash
|
|
620
|
-
end
|
|
621
|
-
end
|
|
622
|
-
end
|
|
623
|
-
end
|
|
624
|
-
|
|
625
|
-
module Include
|
|
626
|
-
extend OpenAI::Internal::Type::Enum
|
|
627
|
-
|
|
628
|
-
TaggedSymbol =
|
|
629
|
-
T.type_alias do
|
|
630
|
-
T.all(
|
|
631
|
-
Symbol,
|
|
632
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Include
|
|
633
|
-
)
|
|
634
|
-
end
|
|
635
|
-
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
636
|
-
|
|
637
|
-
ITEM_INPUT_AUDIO_TRANSCRIPTION_LOGPROBS =
|
|
638
|
-
T.let(
|
|
639
|
-
:"item.input_audio_transcription.logprobs",
|
|
640
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Include::TaggedSymbol
|
|
641
|
-
)
|
|
642
|
-
|
|
643
|
-
sig do
|
|
644
|
-
override.returns(
|
|
645
|
-
T::Array[
|
|
646
|
-
OpenAI::Realtime::TranscriptionSessionUpdatedEvent::Session::Include::TaggedSymbol
|
|
647
|
-
]
|
|
648
|
-
)
|
|
649
|
-
end
|
|
650
|
-
def self.values
|
|
651
|
-
end
|
|
652
|
-
end
|
|
653
|
-
end
|
|
654
77
|
end
|
|
655
78
|
end
|
|
656
79
|
end
|
|
@@ -4,8 +4,7 @@ module OpenAI
|
|
|
4
4
|
module Resources
|
|
5
5
|
class Realtime
|
|
6
6
|
class ClientSecrets
|
|
7
|
-
# Create a Realtime
|
|
8
|
-
# transcription.
|
|
7
|
+
# Create a Realtime client secret with an associated session configuration.
|
|
9
8
|
sig do
|
|
10
9
|
params(
|
|
11
10
|
expires_after:
|
|
@@ -19,7 +18,10 @@ module OpenAI
|
|
|
19
18
|
).returns(OpenAI::Models::Realtime::ClientSecretCreateResponse)
|
|
20
19
|
end
|
|
21
20
|
def create(
|
|
22
|
-
# Configuration for the
|
|
21
|
+
# Configuration for the client secret expiration. Expiration refers to the time
|
|
22
|
+
# after which a client secret will no longer be valid for creating sessions. The
|
|
23
|
+
# session itself may continue after that time once started. A secret can be used
|
|
24
|
+
# to create multiple sessions until it expires.
|
|
23
25
|
expires_after: nil,
|
|
24
26
|
# Session configuration to use for the client secret. Choose either a realtime
|
|
25
27
|
# session or a transcription session.
|