openai 0.61.0 → 0.62.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 +18 -0
- data/README.md +1 -1
- data/lib/openai/models/admin/organization/usage_audio_speeches_response.rb +10 -1
- data/lib/openai/models/admin/organization/usage_audio_transcriptions_response.rb +10 -1
- data/lib/openai/models/admin/organization/usage_code_interpreter_sessions_response.rb +10 -1
- data/lib/openai/models/admin/organization/usage_completions_response.rb +10 -1
- data/lib/openai/models/admin/organization/usage_costs_response.rb +10 -1
- data/lib/openai/models/admin/organization/usage_embeddings_response.rb +10 -1
- data/lib/openai/models/admin/organization/usage_images_response.rb +10 -1
- data/lib/openai/models/admin/organization/usage_moderations_response.rb +10 -1
- data/lib/openai/models/admin/organization/usage_vector_stores_response.rb +10 -1
- data/lib/openai/models/chat/chat_completion_token_logprob.rb +1 -2
- data/lib/openai/models/chat/completion_create_params.rb +4 -3
- data/lib/openai/models/image_edit_params.rb +85 -31
- data/lib/openai/models/image_generate_params.rb +78 -26
- data/lib/openai/models/image_model.rb +5 -2
- data/lib/openai/models/realtime/audio_transcription.rb +37 -5
- data/lib/openai/models/realtime/client_secret_create_response.rb +1 -2
- data/lib/openai/models/realtime/realtime_audio_config_input.rb +3 -0
- data/lib/openai/models/realtime/realtime_audio_input_turn_detection.rb +3 -0
- data/lib/openai/models/realtime/realtime_reasoning.rb +24 -0
- data/lib/openai/models/realtime/realtime_reasoning_effort.rb +22 -0
- data/lib/openai/models/realtime/realtime_response_create_params.rb +18 -1
- data/lib/openai/models/realtime/realtime_session.rb +6 -0
- data/lib/openai/models/realtime/realtime_session_create_request.rb +21 -1
- data/lib/openai/models/realtime/realtime_session_create_response.rb +41 -17
- data/lib/openai/models/realtime/realtime_transcription_session_audio_input.rb +3 -0
- data/lib/openai/models/realtime/realtime_transcription_session_audio_input_turn_detection.rb +3 -0
- data/lib/openai/models/realtime/realtime_transcription_session_create_response.rb +9 -5
- data/lib/openai/models/realtime/realtime_transcription_session_turn_detection.rb +2 -1
- data/lib/openai/models/realtime/realtime_translation_client_event.rb +45 -0
- data/lib/openai/models/realtime/realtime_translation_client_secret_create_request.rb +85 -0
- data/lib/openai/models/realtime/realtime_translation_client_secret_create_response.rb +42 -0
- data/lib/openai/models/realtime/realtime_translation_input_audio_buffer_append_event.rb +51 -0
- data/lib/openai/models/realtime/realtime_translation_input_transcript_delta_event.rb +55 -0
- data/lib/openai/models/realtime/realtime_translation_output_audio_delta_event.rb +89 -0
- data/lib/openai/models/realtime/realtime_translation_output_transcript_delta_event.rb +54 -0
- data/lib/openai/models/realtime/realtime_translation_server_event.rb +53 -0
- data/lib/openai/models/realtime/realtime_translation_session.rb +158 -0
- data/lib/openai/models/realtime/realtime_translation_session_close_event.rb +30 -0
- data/lib/openai/models/realtime/realtime_translation_session_closed_event.rb +28 -0
- data/lib/openai/models/realtime/realtime_translation_session_create_request.rb +138 -0
- data/lib/openai/models/realtime/realtime_translation_session_created_event.rb +38 -0
- data/lib/openai/models/realtime/realtime_translation_session_update_event.rb +43 -0
- data/lib/openai/models/realtime/realtime_translation_session_update_request.rb +129 -0
- data/lib/openai/models/realtime/realtime_translation_session_updated_event.rb +37 -0
- data/lib/openai/models/realtime/transcription_session_updated_event.rb +1 -2
- data/lib/openai/models/responses/response.rb +4 -3
- data/lib/openai/models/responses/response_create_params.rb +4 -3
- data/lib/openai/models/responses/response_includable.rb +2 -0
- data/lib/openai/models/responses/response_text_delta_event.rb +2 -2
- data/lib/openai/models/responses/response_text_done_event.rb +2 -2
- data/lib/openai/models/responses/responses_client_event.rb +4 -3
- data/lib/openai/models/responses/tool.rb +81 -16
- data/lib/openai/resources/chat/completions.rb +2 -2
- data/lib/openai/resources/images.rb +6 -6
- data/lib/openai/resources/realtime/calls.rb +5 -1
- data/lib/openai/resources/responses.rb +2 -2
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +18 -1
- data/rbi/openai/models/admin/organization/usage_audio_speeches_response.rbi +11 -1
- data/rbi/openai/models/admin/organization/usage_audio_transcriptions_response.rbi +11 -1
- data/rbi/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbi +11 -1
- data/rbi/openai/models/admin/organization/usage_completions_response.rbi +11 -1
- data/rbi/openai/models/admin/organization/usage_costs_response.rbi +11 -1
- data/rbi/openai/models/admin/organization/usage_embeddings_response.rbi +11 -1
- data/rbi/openai/models/admin/organization/usage_images_response.rbi +11 -1
- data/rbi/openai/models/admin/organization/usage_moderations_response.rbi +11 -1
- data/rbi/openai/models/admin/organization/usage_vector_stores_response.rbi +11 -1
- data/rbi/openai/models/chat/chat_completion_token_logprob.rbi +2 -4
- data/rbi/openai/models/chat/completion_create_params.rbi +6 -4
- data/rbi/openai/models/image_edit_params.rbi +102 -45
- data/rbi/openai/models/image_generate_params.rbi +93 -39
- data/rbi/openai/models/image_model.rbi +8 -3
- data/rbi/openai/models/realtime/audio_transcription.rbi +85 -6
- data/rbi/openai/models/realtime/realtime_audio_config_input.rbi +6 -0
- data/rbi/openai/models/realtime/realtime_audio_input_turn_detection.rbi +3 -0
- data/rbi/openai/models/realtime/realtime_reasoning.rbi +54 -0
- data/rbi/openai/models/realtime/realtime_reasoning_effort.rbi +44 -0
- data/rbi/openai/models/realtime/realtime_response_create_params.rbi +26 -0
- data/rbi/openai/models/realtime/realtime_session.rbi +9 -0
- data/rbi/openai/models/realtime/realtime_session_create_request.rbi +31 -0
- data/rbi/openai/models/realtime/realtime_session_create_response.rbi +53 -32
- data/rbi/openai/models/realtime/realtime_transcription_session_audio_input.rbi +6 -0
- data/rbi/openai/models/realtime/realtime_transcription_session_audio_input_turn_detection.rbi +3 -0
- data/rbi/openai/models/realtime/realtime_transcription_session_create_response.rbi +13 -7
- data/rbi/openai/models/realtime/realtime_transcription_session_turn_detection.rbi +2 -1
- data/rbi/openai/models/realtime/realtime_translation_client_event.rbi +29 -0
- data/rbi/openai/models/realtime/realtime_translation_client_secret_create_request.rbi +193 -0
- data/rbi/openai/models/realtime/realtime_translation_client_secret_create_response.rbi +69 -0
- data/rbi/openai/models/realtime/realtime_translation_input_audio_buffer_append_event.rbi +69 -0
- data/rbi/openai/models/realtime/realtime_translation_input_transcript_delta_event.rbi +77 -0
- data/rbi/openai/models/realtime/realtime_translation_output_audio_delta_event.rbi +148 -0
- data/rbi/openai/models/realtime/realtime_translation_output_transcript_delta_event.rbi +76 -0
- data/rbi/openai/models/realtime/realtime_translation_server_event.rbi +33 -0
- data/rbi/openai/models/realtime/realtime_translation_session.rbi +339 -0
- data/rbi/openai/models/realtime/realtime_translation_session_close_event.rbi +44 -0
- data/rbi/openai/models/realtime/realtime_translation_session_closed_event.rbi +39 -0
- data/rbi/openai/models/realtime/realtime_translation_session_create_request.rbi +322 -0
- data/rbi/openai/models/realtime/realtime_translation_session_created_event.rbi +68 -0
- data/rbi/openai/models/realtime/realtime_translation_session_update_event.rbi +78 -0
- data/rbi/openai/models/realtime/realtime_translation_session_update_request.rbi +313 -0
- data/rbi/openai/models/realtime/realtime_translation_session_updated_event.rbi +67 -0
- data/rbi/openai/models/realtime/transcription_session_updated_event.rbi +0 -2
- data/rbi/openai/models/responses/response.rbi +6 -4
- data/rbi/openai/models/responses/response_create_params.rbi +6 -4
- data/rbi/openai/models/responses/response_includable.rbi +2 -0
- data/rbi/openai/models/responses/response_text_delta_event.rbi +2 -2
- data/rbi/openai/models/responses/response_text_done_event.rbi +2 -2
- data/rbi/openai/models/responses/responses_client_event.rbi +6 -4
- data/rbi/openai/models/responses/tool.rbi +122 -27
- data/rbi/openai/resources/chat/completions.rbi +6 -4
- data/rbi/openai/resources/images.rbi +110 -44
- data/rbi/openai/resources/realtime/calls.rbi +7 -0
- data/rbi/openai/resources/responses.rbi +6 -4
- data/sig/openai/models/admin/organization/usage_audio_speeches_response.rbs +7 -2
- data/sig/openai/models/admin/organization/usage_audio_transcriptions_response.rbs +7 -2
- data/sig/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbs +7 -2
- data/sig/openai/models/admin/organization/usage_completions_response.rbs +7 -2
- data/sig/openai/models/admin/organization/usage_costs_response.rbs +7 -2
- data/sig/openai/models/admin/organization/usage_embeddings_response.rbs +7 -2
- data/sig/openai/models/admin/organization/usage_images_response.rbs +7 -2
- data/sig/openai/models/admin/organization/usage_moderations_response.rbs +7 -2
- data/sig/openai/models/admin/organization/usage_vector_stores_response.rbs +7 -2
- data/sig/openai/models/image_edit_params.rbs +5 -4
- data/sig/openai/models/image_generate_params.rbs +5 -4
- data/sig/openai/models/image_model.rbs +11 -5
- data/sig/openai/models/realtime/audio_transcription.rbs +25 -0
- data/sig/openai/models/realtime/realtime_reasoning.rbs +24 -0
- data/sig/openai/models/realtime/realtime_reasoning_effort.rbs +20 -0
- data/sig/openai/models/realtime/realtime_response_create_params.rbs +16 -0
- data/sig/openai/models/realtime/realtime_session_create_request.rbs +18 -0
- data/sig/openai/models/realtime/realtime_session_create_response.rbs +27 -4
- data/sig/openai/models/realtime/realtime_transcription_session_create_response.rbs +4 -8
- data/sig/openai/models/realtime/realtime_translation_client_event.rbs +16 -0
- data/sig/openai/models/realtime/realtime_translation_client_secret_create_request.rbs +69 -0
- data/sig/openai/models/realtime/realtime_translation_client_secret_create_response.rbs +32 -0
- data/sig/openai/models/realtime/realtime_translation_input_audio_buffer_append_event.rbs +34 -0
- data/sig/openai/models/realtime/realtime_translation_input_transcript_delta_event.rbs +37 -0
- data/sig/openai/models/realtime/realtime_translation_output_audio_delta_event.rbs +70 -0
- data/sig/openai/models/realtime/realtime_translation_output_transcript_delta_event.rbs +37 -0
- data/sig/openai/models/realtime/realtime_translation_server_event.rbs +20 -0
- data/sig/openai/models/realtime/realtime_translation_session.rbs +131 -0
- data/sig/openai/models/realtime/realtime_translation_session_close_event.rbs +20 -0
- data/sig/openai/models/realtime/realtime_translation_session_closed_event.rbs +18 -0
- data/sig/openai/models/realtime/realtime_translation_session_create_request.rbs +120 -0
- data/sig/openai/models/realtime/realtime_translation_session_created_event.rbs +32 -0
- data/sig/openai/models/realtime/realtime_translation_session_update_event.rbs +34 -0
- data/sig/openai/models/realtime/realtime_translation_session_update_request.rbs +115 -0
- data/sig/openai/models/realtime/realtime_translation_session_updated_event.rbs +32 -0
- data/sig/openai/models/responses/tool.rbs +15 -5
- data/sig/openai/resources/realtime/calls.rbs +2 -0
- metadata +56 -5
- data/lib/openai/models/realtime/realtime_session_client_secret.rb +0 -36
- data/rbi/openai/models/realtime/realtime_session_client_secret.rbi +0 -49
- data/sig/openai/models/realtime/realtime_session_client_secret.rbs +0 -20
|
@@ -91,6 +91,9 @@ module OpenAI
|
|
|
91
91
|
# trails off with "uhhm", the model will score a low probability of turn end and
|
|
92
92
|
# wait longer for the user to continue speaking. This can be useful for more
|
|
93
93
|
# natural conversations, but may have a higher latency.
|
|
94
|
+
#
|
|
95
|
+
# For `gpt-realtime-whisper` transcription sessions, turn detection must be set to
|
|
96
|
+
# `null`; VAD is not supported.
|
|
94
97
|
sig do
|
|
95
98
|
returns(
|
|
96
99
|
T.nilable(
|
|
@@ -154,6 +157,9 @@ module OpenAI
|
|
|
154
157
|
# trails off with "uhhm", the model will score a low probability of turn end and
|
|
155
158
|
# wait longer for the user to continue speaking. This can be useful for more
|
|
156
159
|
# natural conversations, but may have a higher latency.
|
|
160
|
+
#
|
|
161
|
+
# For `gpt-realtime-whisper` transcription sessions, turn detection must be set to
|
|
162
|
+
# `null`; VAD is not supported.
|
|
157
163
|
turn_detection: nil
|
|
158
164
|
)
|
|
159
165
|
end
|
data/rbi/openai/models/realtime/realtime_transcription_session_audio_input_turn_detection.rbi
CHANGED
|
@@ -16,6 +16,9 @@ module OpenAI
|
|
|
16
16
|
# trails off with "uhhm", the model will score a low probability of turn end and
|
|
17
17
|
# wait longer for the user to continue speaking. This can be useful for more
|
|
18
18
|
# natural conversations, but may have a higher latency.
|
|
19
|
+
#
|
|
20
|
+
# For `gpt-realtime-whisper` transcription sessions, turn detection must be set to
|
|
21
|
+
# `null`; VAD is not supported.
|
|
19
22
|
module RealtimeTranscriptionSessionAudioInputTurnDetection
|
|
20
23
|
extend OpenAI::Internal::Type::Union
|
|
21
24
|
|
|
@@ -224,7 +224,6 @@ module OpenAI
|
|
|
224
224
|
end
|
|
225
225
|
attr_writer :noise_reduction
|
|
226
226
|
|
|
227
|
-
# Configuration of the transcription model.
|
|
228
227
|
sig { returns(T.nilable(OpenAI::Realtime::AudioTranscription)) }
|
|
229
228
|
attr_reader :transcription
|
|
230
229
|
|
|
@@ -237,7 +236,8 @@ module OpenAI
|
|
|
237
236
|
|
|
238
237
|
# Configuration for turn detection. Can be set to `null` to turn off. Server VAD
|
|
239
238
|
# means that the model will detect the start and end of speech based on audio
|
|
240
|
-
# volume and respond at the end of user speech.
|
|
239
|
+
# volume and respond at the end of user speech. For `gpt-realtime-whisper`, this
|
|
240
|
+
# must be `null`; VAD is not supported.
|
|
241
241
|
sig do
|
|
242
242
|
returns(
|
|
243
243
|
T.nilable(
|
|
@@ -250,7 +250,9 @@ module OpenAI
|
|
|
250
250
|
sig do
|
|
251
251
|
params(
|
|
252
252
|
turn_detection:
|
|
253
|
-
|
|
253
|
+
T.nilable(
|
|
254
|
+
OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection::OrHash
|
|
255
|
+
)
|
|
254
256
|
).void
|
|
255
257
|
end
|
|
256
258
|
attr_writer :turn_detection
|
|
@@ -267,7 +269,9 @@ module OpenAI
|
|
|
267
269
|
OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input::NoiseReduction::OrHash,
|
|
268
270
|
transcription: OpenAI::Realtime::AudioTranscription::OrHash,
|
|
269
271
|
turn_detection:
|
|
270
|
-
|
|
272
|
+
T.nilable(
|
|
273
|
+
OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection::OrHash
|
|
274
|
+
)
|
|
271
275
|
).returns(T.attached_class)
|
|
272
276
|
end
|
|
273
277
|
def self.new(
|
|
@@ -275,11 +279,11 @@ module OpenAI
|
|
|
275
279
|
format_: nil,
|
|
276
280
|
# Configuration for input audio noise reduction.
|
|
277
281
|
noise_reduction: nil,
|
|
278
|
-
# Configuration of the transcription model.
|
|
279
282
|
transcription: nil,
|
|
280
283
|
# Configuration for turn detection. Can be set to `null` to turn off. Server VAD
|
|
281
284
|
# means that the model will detect the start and end of speech based on audio
|
|
282
|
-
# volume and respond at the end of user speech.
|
|
285
|
+
# volume and respond at the end of user speech. For `gpt-realtime-whisper`, this
|
|
286
|
+
# must be `null`; VAD is not supported.
|
|
283
287
|
turn_detection: nil
|
|
284
288
|
)
|
|
285
289
|
end
|
|
@@ -292,7 +296,9 @@ module OpenAI
|
|
|
292
296
|
OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input::NoiseReduction,
|
|
293
297
|
transcription: OpenAI::Realtime::AudioTranscription,
|
|
294
298
|
turn_detection:
|
|
295
|
-
|
|
299
|
+
T.nilable(
|
|
300
|
+
OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection
|
|
301
|
+
)
|
|
296
302
|
}
|
|
297
303
|
)
|
|
298
304
|
end
|
|
@@ -50,7 +50,8 @@ module OpenAI
|
|
|
50
50
|
|
|
51
51
|
# Configuration for turn detection. Can be set to `null` to turn off. Server VAD
|
|
52
52
|
# means that the model will detect the start and end of speech based on audio
|
|
53
|
-
# volume and respond at the end of user speech.
|
|
53
|
+
# volume and respond at the end of user speech. For `gpt-realtime-whisper`, this
|
|
54
|
+
# must be `null`; VAD is not supported.
|
|
54
55
|
sig do
|
|
55
56
|
params(
|
|
56
57
|
prefix_padding_ms: Integer,
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module OpenAI
|
|
4
|
+
module Models
|
|
5
|
+
module Realtime
|
|
6
|
+
# A Realtime translation client event.
|
|
7
|
+
module RealtimeTranslationClientEvent
|
|
8
|
+
extend OpenAI::Internal::Type::Union
|
|
9
|
+
|
|
10
|
+
Variants =
|
|
11
|
+
T.type_alias do
|
|
12
|
+
T.any(
|
|
13
|
+
OpenAI::Realtime::RealtimeTranslationSessionUpdateEvent,
|
|
14
|
+
OpenAI::Realtime::RealtimeTranslationInputAudioBufferAppendEvent,
|
|
15
|
+
OpenAI::Realtime::RealtimeTranslationSessionCloseEvent
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
sig do
|
|
20
|
+
override.returns(
|
|
21
|
+
T::Array[OpenAI::Realtime::RealtimeTranslationClientEvent::Variants]
|
|
22
|
+
)
|
|
23
|
+
end
|
|
24
|
+
def self.variants
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module OpenAI
|
|
4
|
+
module Models
|
|
5
|
+
module Realtime
|
|
6
|
+
class RealtimeTranslationClientSecretCreateRequest < OpenAI::Internal::Type::BaseModel
|
|
7
|
+
OrHash =
|
|
8
|
+
T.type_alias do
|
|
9
|
+
T.any(
|
|
10
|
+
OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest,
|
|
11
|
+
OpenAI::Internal::AnyHash
|
|
12
|
+
)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Realtime translation session configuration. Translation sessions stream source
|
|
16
|
+
# audio in and translated audio plus transcript deltas out continuously.
|
|
17
|
+
sig do
|
|
18
|
+
returns(OpenAI::Realtime::RealtimeTranslationSessionCreateRequest)
|
|
19
|
+
end
|
|
20
|
+
attr_reader :session
|
|
21
|
+
|
|
22
|
+
sig do
|
|
23
|
+
params(
|
|
24
|
+
session:
|
|
25
|
+
OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::OrHash
|
|
26
|
+
).void
|
|
27
|
+
end
|
|
28
|
+
attr_writer :session
|
|
29
|
+
|
|
30
|
+
# Configuration for the client secret expiration. Expiration refers to the time
|
|
31
|
+
# after which a client secret will no longer be valid for creating sessions. The
|
|
32
|
+
# session itself may continue after that time once started. A secret can be used
|
|
33
|
+
# to create multiple sessions until it expires.
|
|
34
|
+
sig do
|
|
35
|
+
returns(
|
|
36
|
+
T.nilable(
|
|
37
|
+
OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter
|
|
38
|
+
)
|
|
39
|
+
)
|
|
40
|
+
end
|
|
41
|
+
attr_reader :expires_after
|
|
42
|
+
|
|
43
|
+
sig do
|
|
44
|
+
params(
|
|
45
|
+
expires_after:
|
|
46
|
+
OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::OrHash
|
|
47
|
+
).void
|
|
48
|
+
end
|
|
49
|
+
attr_writer :expires_after
|
|
50
|
+
|
|
51
|
+
# Create a translation session and client secret for the Realtime API.
|
|
52
|
+
sig do
|
|
53
|
+
params(
|
|
54
|
+
session:
|
|
55
|
+
OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::OrHash,
|
|
56
|
+
expires_after:
|
|
57
|
+
OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::OrHash
|
|
58
|
+
).returns(T.attached_class)
|
|
59
|
+
end
|
|
60
|
+
def self.new(
|
|
61
|
+
# Realtime translation session configuration. Translation sessions stream source
|
|
62
|
+
# audio in and translated audio plus transcript deltas out continuously.
|
|
63
|
+
session:,
|
|
64
|
+
# Configuration for the client secret expiration. Expiration refers to the time
|
|
65
|
+
# after which a client secret will no longer be valid for creating sessions. The
|
|
66
|
+
# session itself may continue after that time once started. A secret can be used
|
|
67
|
+
# to create multiple sessions until it expires.
|
|
68
|
+
expires_after: nil
|
|
69
|
+
)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
sig do
|
|
73
|
+
override.returns(
|
|
74
|
+
{
|
|
75
|
+
session:
|
|
76
|
+
OpenAI::Realtime::RealtimeTranslationSessionCreateRequest,
|
|
77
|
+
expires_after:
|
|
78
|
+
OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
end
|
|
82
|
+
def to_hash
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
class ExpiresAfter < OpenAI::Internal::Type::BaseModel
|
|
86
|
+
OrHash =
|
|
87
|
+
T.type_alias do
|
|
88
|
+
T.any(
|
|
89
|
+
OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter,
|
|
90
|
+
OpenAI::Internal::AnyHash
|
|
91
|
+
)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# The anchor point for the client secret expiration, meaning that `seconds` will
|
|
95
|
+
# be added to the `created_at` time of the client secret to produce an expiration
|
|
96
|
+
# timestamp. Only `created_at` is currently supported.
|
|
97
|
+
sig do
|
|
98
|
+
returns(
|
|
99
|
+
T.nilable(
|
|
100
|
+
OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::Anchor::OrSymbol
|
|
101
|
+
)
|
|
102
|
+
)
|
|
103
|
+
end
|
|
104
|
+
attr_reader :anchor
|
|
105
|
+
|
|
106
|
+
sig do
|
|
107
|
+
params(
|
|
108
|
+
anchor:
|
|
109
|
+
OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::Anchor::OrSymbol
|
|
110
|
+
).void
|
|
111
|
+
end
|
|
112
|
+
attr_writer :anchor
|
|
113
|
+
|
|
114
|
+
# The number of seconds from the anchor point to the expiration. Select a value
|
|
115
|
+
# between `10` and `7200` (2 hours). This default to 600 seconds (10 minutes) if
|
|
116
|
+
# not specified.
|
|
117
|
+
sig { returns(T.nilable(Integer)) }
|
|
118
|
+
attr_reader :seconds
|
|
119
|
+
|
|
120
|
+
sig { params(seconds: Integer).void }
|
|
121
|
+
attr_writer :seconds
|
|
122
|
+
|
|
123
|
+
# Configuration for the client secret expiration. Expiration refers to the time
|
|
124
|
+
# after which a client secret will no longer be valid for creating sessions. The
|
|
125
|
+
# session itself may continue after that time once started. A secret can be used
|
|
126
|
+
# to create multiple sessions until it expires.
|
|
127
|
+
sig do
|
|
128
|
+
params(
|
|
129
|
+
anchor:
|
|
130
|
+
OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::Anchor::OrSymbol,
|
|
131
|
+
seconds: Integer
|
|
132
|
+
).returns(T.attached_class)
|
|
133
|
+
end
|
|
134
|
+
def self.new(
|
|
135
|
+
# The anchor point for the client secret expiration, meaning that `seconds` will
|
|
136
|
+
# be added to the `created_at` time of the client secret to produce an expiration
|
|
137
|
+
# timestamp. Only `created_at` is currently supported.
|
|
138
|
+
anchor: nil,
|
|
139
|
+
# The number of seconds from the anchor point to the expiration. Select a value
|
|
140
|
+
# between `10` and `7200` (2 hours). This default to 600 seconds (10 minutes) if
|
|
141
|
+
# not specified.
|
|
142
|
+
seconds: nil
|
|
143
|
+
)
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
sig do
|
|
147
|
+
override.returns(
|
|
148
|
+
{
|
|
149
|
+
anchor:
|
|
150
|
+
OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::Anchor::OrSymbol,
|
|
151
|
+
seconds: Integer
|
|
152
|
+
}
|
|
153
|
+
)
|
|
154
|
+
end
|
|
155
|
+
def to_hash
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
# The anchor point for the client secret expiration, meaning that `seconds` will
|
|
159
|
+
# be added to the `created_at` time of the client secret to produce an expiration
|
|
160
|
+
# timestamp. Only `created_at` is currently supported.
|
|
161
|
+
module Anchor
|
|
162
|
+
extend OpenAI::Internal::Type::Enum
|
|
163
|
+
|
|
164
|
+
TaggedSymbol =
|
|
165
|
+
T.type_alias do
|
|
166
|
+
T.all(
|
|
167
|
+
Symbol,
|
|
168
|
+
OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::Anchor
|
|
169
|
+
)
|
|
170
|
+
end
|
|
171
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
172
|
+
|
|
173
|
+
CREATED_AT =
|
|
174
|
+
T.let(
|
|
175
|
+
:created_at,
|
|
176
|
+
OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::Anchor::TaggedSymbol
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
sig do
|
|
180
|
+
override.returns(
|
|
181
|
+
T::Array[
|
|
182
|
+
OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::Anchor::TaggedSymbol
|
|
183
|
+
]
|
|
184
|
+
)
|
|
185
|
+
end
|
|
186
|
+
def self.values
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module OpenAI
|
|
4
|
+
module Models
|
|
5
|
+
module Realtime
|
|
6
|
+
class RealtimeTranslationClientSecretCreateResponse < OpenAI::Internal::Type::BaseModel
|
|
7
|
+
OrHash =
|
|
8
|
+
T.type_alias do
|
|
9
|
+
T.any(
|
|
10
|
+
OpenAI::Realtime::RealtimeTranslationClientSecretCreateResponse,
|
|
11
|
+
OpenAI::Internal::AnyHash
|
|
12
|
+
)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Expiration timestamp for the client secret, in seconds since epoch.
|
|
16
|
+
sig { returns(Integer) }
|
|
17
|
+
attr_accessor :expires_at
|
|
18
|
+
|
|
19
|
+
# A Realtime translation session. Translation sessions continuously translate
|
|
20
|
+
# input audio into the configured output language.
|
|
21
|
+
sig { returns(OpenAI::Realtime::RealtimeTranslationSession) }
|
|
22
|
+
attr_reader :session
|
|
23
|
+
|
|
24
|
+
sig do
|
|
25
|
+
params(
|
|
26
|
+
session: OpenAI::Realtime::RealtimeTranslationSession::OrHash
|
|
27
|
+
).void
|
|
28
|
+
end
|
|
29
|
+
attr_writer :session
|
|
30
|
+
|
|
31
|
+
# The generated client secret value.
|
|
32
|
+
sig { returns(String) }
|
|
33
|
+
attr_accessor :value
|
|
34
|
+
|
|
35
|
+
# Response from creating a translation session and client secret for the Realtime
|
|
36
|
+
# API.
|
|
37
|
+
sig do
|
|
38
|
+
params(
|
|
39
|
+
expires_at: Integer,
|
|
40
|
+
session: OpenAI::Realtime::RealtimeTranslationSession::OrHash,
|
|
41
|
+
value: String
|
|
42
|
+
).returns(T.attached_class)
|
|
43
|
+
end
|
|
44
|
+
def self.new(
|
|
45
|
+
# Expiration timestamp for the client secret, in seconds since epoch.
|
|
46
|
+
expires_at:,
|
|
47
|
+
# A Realtime translation session. Translation sessions continuously translate
|
|
48
|
+
# input audio into the configured output language.
|
|
49
|
+
session:,
|
|
50
|
+
# The generated client secret value.
|
|
51
|
+
value:
|
|
52
|
+
)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
sig do
|
|
56
|
+
override.returns(
|
|
57
|
+
{
|
|
58
|
+
expires_at: Integer,
|
|
59
|
+
session: OpenAI::Realtime::RealtimeTranslationSession,
|
|
60
|
+
value: String
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
end
|
|
64
|
+
def to_hash
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module OpenAI
|
|
4
|
+
module Models
|
|
5
|
+
module Realtime
|
|
6
|
+
class RealtimeTranslationInputAudioBufferAppendEvent < OpenAI::Internal::Type::BaseModel
|
|
7
|
+
OrHash =
|
|
8
|
+
T.type_alias do
|
|
9
|
+
T.any(
|
|
10
|
+
OpenAI::Realtime::RealtimeTranslationInputAudioBufferAppendEvent,
|
|
11
|
+
OpenAI::Internal::AnyHash
|
|
12
|
+
)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Base64-encoded 24 kHz PCM16 mono audio bytes.
|
|
16
|
+
sig { returns(String) }
|
|
17
|
+
attr_accessor :audio
|
|
18
|
+
|
|
19
|
+
# The event type, must be `session.input_audio_buffer.append`.
|
|
20
|
+
sig { returns(Symbol) }
|
|
21
|
+
attr_accessor :type
|
|
22
|
+
|
|
23
|
+
# Optional client-generated ID used to identify this event.
|
|
24
|
+
sig { returns(T.nilable(String)) }
|
|
25
|
+
attr_reader :event_id
|
|
26
|
+
|
|
27
|
+
sig { params(event_id: String).void }
|
|
28
|
+
attr_writer :event_id
|
|
29
|
+
|
|
30
|
+
# Send this event to append audio bytes to the translation session input audio
|
|
31
|
+
# buffer.
|
|
32
|
+
#
|
|
33
|
+
# WebSocket translation sessions accept base64-encoded 24 kHz PCM16 mono
|
|
34
|
+
# little-endian raw audio bytes. Unsupported websocket audio formats return a
|
|
35
|
+
# validation error because lower-quality audio materially degrades translation
|
|
36
|
+
# quality.
|
|
37
|
+
#
|
|
38
|
+
# Translation consumes 200 ms engine frames. For best realtime behavior, append
|
|
39
|
+
# audio in 200 ms chunks. If a chunk is shorter, the server buffers it until it
|
|
40
|
+
# has enough audio for one frame. If a chunk is longer, the server splits it into
|
|
41
|
+
# 200 ms frames and enqueues them back-to-back.
|
|
42
|
+
#
|
|
43
|
+
# Keep appending silence while the session is active. If a client stops sending
|
|
44
|
+
# audio and later resumes, model time treats the resumed audio as contiguous with
|
|
45
|
+
# the previous audio rather than as a real-world pause.
|
|
46
|
+
sig do
|
|
47
|
+
params(audio: String, event_id: String, type: Symbol).returns(
|
|
48
|
+
T.attached_class
|
|
49
|
+
)
|
|
50
|
+
end
|
|
51
|
+
def self.new(
|
|
52
|
+
# Base64-encoded 24 kHz PCM16 mono audio bytes.
|
|
53
|
+
audio:,
|
|
54
|
+
# Optional client-generated ID used to identify this event.
|
|
55
|
+
event_id: nil,
|
|
56
|
+
# The event type, must be `session.input_audio_buffer.append`.
|
|
57
|
+
type: :"session.input_audio_buffer.append"
|
|
58
|
+
)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
sig do
|
|
62
|
+
override.returns({ audio: String, type: Symbol, event_id: String })
|
|
63
|
+
end
|
|
64
|
+
def to_hash
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module OpenAI
|
|
4
|
+
module Models
|
|
5
|
+
module Realtime
|
|
6
|
+
class RealtimeTranslationInputTranscriptDeltaEvent < OpenAI::Internal::Type::BaseModel
|
|
7
|
+
OrHash =
|
|
8
|
+
T.type_alias do
|
|
9
|
+
T.any(
|
|
10
|
+
OpenAI::Realtime::RealtimeTranslationInputTranscriptDeltaEvent,
|
|
11
|
+
OpenAI::Internal::AnyHash
|
|
12
|
+
)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Append-only source-language transcript text.
|
|
16
|
+
sig { returns(String) }
|
|
17
|
+
attr_accessor :delta
|
|
18
|
+
|
|
19
|
+
# The unique ID of the server event.
|
|
20
|
+
sig { returns(String) }
|
|
21
|
+
attr_accessor :event_id
|
|
22
|
+
|
|
23
|
+
# The event type, must be `session.input_transcript.delta`.
|
|
24
|
+
sig { returns(Symbol) }
|
|
25
|
+
attr_accessor :type
|
|
26
|
+
|
|
27
|
+
# Timing metadata for stream alignment, derived from the translation frame when
|
|
28
|
+
# available. It advances in 200 ms increments, but multiple transcript deltas may
|
|
29
|
+
# share the same `elapsed_ms`. Treat it as alignment metadata, not a unique
|
|
30
|
+
# transcript-delta identifier.
|
|
31
|
+
sig { returns(T.nilable(Integer)) }
|
|
32
|
+
attr_accessor :elapsed_ms
|
|
33
|
+
|
|
34
|
+
# Returned when optional source-language transcript text is available. This event
|
|
35
|
+
# is emitted only when `audio.input.transcription` is configured.
|
|
36
|
+
#
|
|
37
|
+
# Transcript deltas are append-only text fragments. Clients should not insert
|
|
38
|
+
# unconditional spaces between deltas.
|
|
39
|
+
sig do
|
|
40
|
+
params(
|
|
41
|
+
delta: String,
|
|
42
|
+
event_id: String,
|
|
43
|
+
elapsed_ms: T.nilable(Integer),
|
|
44
|
+
type: Symbol
|
|
45
|
+
).returns(T.attached_class)
|
|
46
|
+
end
|
|
47
|
+
def self.new(
|
|
48
|
+
# Append-only source-language transcript text.
|
|
49
|
+
delta:,
|
|
50
|
+
# The unique ID of the server event.
|
|
51
|
+
event_id:,
|
|
52
|
+
# Timing metadata for stream alignment, derived from the translation frame when
|
|
53
|
+
# available. It advances in 200 ms increments, but multiple transcript deltas may
|
|
54
|
+
# share the same `elapsed_ms`. Treat it as alignment metadata, not a unique
|
|
55
|
+
# transcript-delta identifier.
|
|
56
|
+
elapsed_ms: nil,
|
|
57
|
+
# The event type, must be `session.input_transcript.delta`.
|
|
58
|
+
type: :"session.input_transcript.delta"
|
|
59
|
+
)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
sig do
|
|
63
|
+
override.returns(
|
|
64
|
+
{
|
|
65
|
+
delta: String,
|
|
66
|
+
event_id: String,
|
|
67
|
+
type: Symbol,
|
|
68
|
+
elapsed_ms: T.nilable(Integer)
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
end
|
|
72
|
+
def to_hash
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module OpenAI
|
|
4
|
+
module Models
|
|
5
|
+
module Realtime
|
|
6
|
+
class RealtimeTranslationOutputAudioDeltaEvent < OpenAI::Internal::Type::BaseModel
|
|
7
|
+
OrHash =
|
|
8
|
+
T.type_alias do
|
|
9
|
+
T.any(
|
|
10
|
+
OpenAI::Realtime::RealtimeTranslationOutputAudioDeltaEvent,
|
|
11
|
+
OpenAI::Internal::AnyHash
|
|
12
|
+
)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Base64-encoded translated audio data.
|
|
16
|
+
sig { returns(String) }
|
|
17
|
+
attr_accessor :delta
|
|
18
|
+
|
|
19
|
+
# The unique ID of the server event.
|
|
20
|
+
sig { returns(String) }
|
|
21
|
+
attr_accessor :event_id
|
|
22
|
+
|
|
23
|
+
# The event type, must be `session.output_audio.delta`.
|
|
24
|
+
sig { returns(Symbol) }
|
|
25
|
+
attr_accessor :type
|
|
26
|
+
|
|
27
|
+
# Number of audio channels.
|
|
28
|
+
sig { returns(T.nilable(Integer)) }
|
|
29
|
+
attr_reader :channels
|
|
30
|
+
|
|
31
|
+
sig { params(channels: Integer).void }
|
|
32
|
+
attr_writer :channels
|
|
33
|
+
|
|
34
|
+
# Timing metadata for stream alignment, derived from the translation frame when
|
|
35
|
+
# available. Treat `elapsed_ms` as alignment metadata, not a unique event
|
|
36
|
+
# identifier.
|
|
37
|
+
sig { returns(T.nilable(Integer)) }
|
|
38
|
+
attr_accessor :elapsed_ms
|
|
39
|
+
|
|
40
|
+
# Audio encoding for `delta`.
|
|
41
|
+
sig do
|
|
42
|
+
returns(
|
|
43
|
+
T.nilable(
|
|
44
|
+
OpenAI::Realtime::RealtimeTranslationOutputAudioDeltaEvent::Format::OrSymbol
|
|
45
|
+
)
|
|
46
|
+
)
|
|
47
|
+
end
|
|
48
|
+
attr_reader :format_
|
|
49
|
+
|
|
50
|
+
sig do
|
|
51
|
+
params(
|
|
52
|
+
format_:
|
|
53
|
+
OpenAI::Realtime::RealtimeTranslationOutputAudioDeltaEvent::Format::OrSymbol
|
|
54
|
+
).void
|
|
55
|
+
end
|
|
56
|
+
attr_writer :format_
|
|
57
|
+
|
|
58
|
+
# Sample rate of the audio delta.
|
|
59
|
+
sig { returns(T.nilable(Integer)) }
|
|
60
|
+
attr_reader :sample_rate
|
|
61
|
+
|
|
62
|
+
sig { params(sample_rate: Integer).void }
|
|
63
|
+
attr_writer :sample_rate
|
|
64
|
+
|
|
65
|
+
# Returned when translated output audio is available. Output audio deltas are 200
|
|
66
|
+
# ms frames of PCM16 audio.
|
|
67
|
+
sig do
|
|
68
|
+
params(
|
|
69
|
+
delta: String,
|
|
70
|
+
event_id: String,
|
|
71
|
+
channels: Integer,
|
|
72
|
+
elapsed_ms: T.nilable(Integer),
|
|
73
|
+
format_:
|
|
74
|
+
OpenAI::Realtime::RealtimeTranslationOutputAudioDeltaEvent::Format::OrSymbol,
|
|
75
|
+
sample_rate: Integer,
|
|
76
|
+
type: Symbol
|
|
77
|
+
).returns(T.attached_class)
|
|
78
|
+
end
|
|
79
|
+
def self.new(
|
|
80
|
+
# Base64-encoded translated audio data.
|
|
81
|
+
delta:,
|
|
82
|
+
# The unique ID of the server event.
|
|
83
|
+
event_id:,
|
|
84
|
+
# Number of audio channels.
|
|
85
|
+
channels: nil,
|
|
86
|
+
# Timing metadata for stream alignment, derived from the translation frame when
|
|
87
|
+
# available. Treat `elapsed_ms` as alignment metadata, not a unique event
|
|
88
|
+
# identifier.
|
|
89
|
+
elapsed_ms: nil,
|
|
90
|
+
# Audio encoding for `delta`.
|
|
91
|
+
format_: nil,
|
|
92
|
+
# Sample rate of the audio delta.
|
|
93
|
+
sample_rate: nil,
|
|
94
|
+
# The event type, must be `session.output_audio.delta`.
|
|
95
|
+
type: :"session.output_audio.delta"
|
|
96
|
+
)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
sig do
|
|
100
|
+
override.returns(
|
|
101
|
+
{
|
|
102
|
+
delta: String,
|
|
103
|
+
event_id: String,
|
|
104
|
+
type: Symbol,
|
|
105
|
+
channels: Integer,
|
|
106
|
+
elapsed_ms: T.nilable(Integer),
|
|
107
|
+
format_:
|
|
108
|
+
OpenAI::Realtime::RealtimeTranslationOutputAudioDeltaEvent::Format::OrSymbol,
|
|
109
|
+
sample_rate: Integer
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
end
|
|
113
|
+
def to_hash
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Audio encoding for `delta`.
|
|
117
|
+
module Format
|
|
118
|
+
extend OpenAI::Internal::Type::Enum
|
|
119
|
+
|
|
120
|
+
TaggedSymbol =
|
|
121
|
+
T.type_alias do
|
|
122
|
+
T.all(
|
|
123
|
+
Symbol,
|
|
124
|
+
OpenAI::Realtime::RealtimeTranslationOutputAudioDeltaEvent::Format
|
|
125
|
+
)
|
|
126
|
+
end
|
|
127
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
128
|
+
|
|
129
|
+
PCM16 =
|
|
130
|
+
T.let(
|
|
131
|
+
:pcm16,
|
|
132
|
+
OpenAI::Realtime::RealtimeTranslationOutputAudioDeltaEvent::Format::TaggedSymbol
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
sig do
|
|
136
|
+
override.returns(
|
|
137
|
+
T::Array[
|
|
138
|
+
OpenAI::Realtime::RealtimeTranslationOutputAudioDeltaEvent::Format::TaggedSymbol
|
|
139
|
+
]
|
|
140
|
+
)
|
|
141
|
+
end
|
|
142
|
+
def self.values
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
end
|