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
|
@@ -12,41 +12,76 @@ module OpenAI
|
|
|
12
12
|
)
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
# The number of audio tokens used
|
|
15
|
+
# The number of audio tokens used as input for the Response.
|
|
16
16
|
sig { returns(T.nilable(Integer)) }
|
|
17
17
|
attr_reader :audio_tokens
|
|
18
18
|
|
|
19
19
|
sig { params(audio_tokens: Integer).void }
|
|
20
20
|
attr_writer :audio_tokens
|
|
21
21
|
|
|
22
|
-
# The number of cached tokens used
|
|
22
|
+
# The number of cached tokens used as input for the Response.
|
|
23
23
|
sig { returns(T.nilable(Integer)) }
|
|
24
24
|
attr_reader :cached_tokens
|
|
25
25
|
|
|
26
26
|
sig { params(cached_tokens: Integer).void }
|
|
27
27
|
attr_writer :cached_tokens
|
|
28
28
|
|
|
29
|
-
#
|
|
29
|
+
# Details about the cached tokens used as input for the Response.
|
|
30
|
+
sig do
|
|
31
|
+
returns(
|
|
32
|
+
T.nilable(
|
|
33
|
+
OpenAI::Realtime::RealtimeResponseUsageInputTokenDetails::CachedTokensDetails
|
|
34
|
+
)
|
|
35
|
+
)
|
|
36
|
+
end
|
|
37
|
+
attr_reader :cached_tokens_details
|
|
38
|
+
|
|
39
|
+
sig do
|
|
40
|
+
params(
|
|
41
|
+
cached_tokens_details:
|
|
42
|
+
OpenAI::Realtime::RealtimeResponseUsageInputTokenDetails::CachedTokensDetails::OrHash
|
|
43
|
+
).void
|
|
44
|
+
end
|
|
45
|
+
attr_writer :cached_tokens_details
|
|
46
|
+
|
|
47
|
+
# The number of image tokens used as input for the Response.
|
|
48
|
+
sig { returns(T.nilable(Integer)) }
|
|
49
|
+
attr_reader :image_tokens
|
|
50
|
+
|
|
51
|
+
sig { params(image_tokens: Integer).void }
|
|
52
|
+
attr_writer :image_tokens
|
|
53
|
+
|
|
54
|
+
# The number of text tokens used as input for the Response.
|
|
30
55
|
sig { returns(T.nilable(Integer)) }
|
|
31
56
|
attr_reader :text_tokens
|
|
32
57
|
|
|
33
58
|
sig { params(text_tokens: Integer).void }
|
|
34
59
|
attr_writer :text_tokens
|
|
35
60
|
|
|
36
|
-
# Details about the input tokens used in the Response.
|
|
61
|
+
# Details about the input tokens used in the Response. Cached tokens are tokens
|
|
62
|
+
# from previous turns in the conversation that are included as context for the
|
|
63
|
+
# current response. Cached tokens here are counted as a subset of input tokens,
|
|
64
|
+
# meaning input tokens will include cached and uncached tokens.
|
|
37
65
|
sig do
|
|
38
66
|
params(
|
|
39
67
|
audio_tokens: Integer,
|
|
40
68
|
cached_tokens: Integer,
|
|
69
|
+
cached_tokens_details:
|
|
70
|
+
OpenAI::Realtime::RealtimeResponseUsageInputTokenDetails::CachedTokensDetails::OrHash,
|
|
71
|
+
image_tokens: Integer,
|
|
41
72
|
text_tokens: Integer
|
|
42
73
|
).returns(T.attached_class)
|
|
43
74
|
end
|
|
44
75
|
def self.new(
|
|
45
|
-
# The number of audio tokens used
|
|
76
|
+
# The number of audio tokens used as input for the Response.
|
|
46
77
|
audio_tokens: nil,
|
|
47
|
-
# The number of cached tokens used
|
|
78
|
+
# The number of cached tokens used as input for the Response.
|
|
48
79
|
cached_tokens: nil,
|
|
49
|
-
#
|
|
80
|
+
# Details about the cached tokens used as input for the Response.
|
|
81
|
+
cached_tokens_details: nil,
|
|
82
|
+
# The number of image tokens used as input for the Response.
|
|
83
|
+
image_tokens: nil,
|
|
84
|
+
# The number of text tokens used as input for the Response.
|
|
50
85
|
text_tokens: nil
|
|
51
86
|
)
|
|
52
87
|
end
|
|
@@ -56,12 +91,76 @@ module OpenAI
|
|
|
56
91
|
{
|
|
57
92
|
audio_tokens: Integer,
|
|
58
93
|
cached_tokens: Integer,
|
|
94
|
+
cached_tokens_details:
|
|
95
|
+
OpenAI::Realtime::RealtimeResponseUsageInputTokenDetails::CachedTokensDetails,
|
|
96
|
+
image_tokens: Integer,
|
|
59
97
|
text_tokens: Integer
|
|
60
98
|
}
|
|
61
99
|
)
|
|
62
100
|
end
|
|
63
101
|
def to_hash
|
|
64
102
|
end
|
|
103
|
+
|
|
104
|
+
class CachedTokensDetails < OpenAI::Internal::Type::BaseModel
|
|
105
|
+
OrHash =
|
|
106
|
+
T.type_alias do
|
|
107
|
+
T.any(
|
|
108
|
+
OpenAI::Realtime::RealtimeResponseUsageInputTokenDetails::CachedTokensDetails,
|
|
109
|
+
OpenAI::Internal::AnyHash
|
|
110
|
+
)
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# The number of cached audio tokens used as input for the Response.
|
|
114
|
+
sig { returns(T.nilable(Integer)) }
|
|
115
|
+
attr_reader :audio_tokens
|
|
116
|
+
|
|
117
|
+
sig { params(audio_tokens: Integer).void }
|
|
118
|
+
attr_writer :audio_tokens
|
|
119
|
+
|
|
120
|
+
# The number of cached image tokens used as input for the Response.
|
|
121
|
+
sig { returns(T.nilable(Integer)) }
|
|
122
|
+
attr_reader :image_tokens
|
|
123
|
+
|
|
124
|
+
sig { params(image_tokens: Integer).void }
|
|
125
|
+
attr_writer :image_tokens
|
|
126
|
+
|
|
127
|
+
# The number of cached text tokens used as input for the Response.
|
|
128
|
+
sig { returns(T.nilable(Integer)) }
|
|
129
|
+
attr_reader :text_tokens
|
|
130
|
+
|
|
131
|
+
sig { params(text_tokens: Integer).void }
|
|
132
|
+
attr_writer :text_tokens
|
|
133
|
+
|
|
134
|
+
# Details about the cached tokens used as input for the Response.
|
|
135
|
+
sig do
|
|
136
|
+
params(
|
|
137
|
+
audio_tokens: Integer,
|
|
138
|
+
image_tokens: Integer,
|
|
139
|
+
text_tokens: Integer
|
|
140
|
+
).returns(T.attached_class)
|
|
141
|
+
end
|
|
142
|
+
def self.new(
|
|
143
|
+
# The number of cached audio tokens used as input for the Response.
|
|
144
|
+
audio_tokens: nil,
|
|
145
|
+
# The number of cached image tokens used as input for the Response.
|
|
146
|
+
image_tokens: nil,
|
|
147
|
+
# The number of cached text tokens used as input for the Response.
|
|
148
|
+
text_tokens: nil
|
|
149
|
+
)
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
sig do
|
|
153
|
+
override.returns(
|
|
154
|
+
{
|
|
155
|
+
audio_tokens: Integer,
|
|
156
|
+
image_tokens: Integer,
|
|
157
|
+
text_tokens: Integer
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
end
|
|
161
|
+
def to_hash
|
|
162
|
+
end
|
|
163
|
+
end
|
|
65
164
|
end
|
|
66
165
|
end
|
|
67
166
|
end
|
|
@@ -96,7 +96,10 @@ module OpenAI
|
|
|
96
96
|
attr_accessor :type
|
|
97
97
|
|
|
98
98
|
# Returned when a conversation item is retrieved with
|
|
99
|
-
# `conversation.item.retrieve`.
|
|
99
|
+
# `conversation.item.retrieve`. This is provided as a way to fetch the server's
|
|
100
|
+
# representation of an item, for example to get access to the post-processed audio
|
|
101
|
+
# data after noise cancellation and VAD. It includes the full content of the Item,
|
|
102
|
+
# including audio data.
|
|
100
103
|
sig do
|
|
101
104
|
params(
|
|
102
105
|
event_id: String,
|
|
@@ -86,21 +86,13 @@ module OpenAI
|
|
|
86
86
|
# and should be treated as guidance of input audio content rather than precisely
|
|
87
87
|
# what the model heard. The client can optionally set the language and prompt for
|
|
88
88
|
# transcription, these offer additional guidance to the transcription service.
|
|
89
|
-
sig
|
|
90
|
-
returns(
|
|
91
|
-
T.nilable(
|
|
92
|
-
OpenAI::Realtime::RealtimeSession::InputAudioTranscription
|
|
93
|
-
)
|
|
94
|
-
)
|
|
95
|
-
end
|
|
89
|
+
sig { returns(T.nilable(OpenAI::Realtime::AudioTranscription)) }
|
|
96
90
|
attr_reader :input_audio_transcription
|
|
97
91
|
|
|
98
92
|
sig do
|
|
99
93
|
params(
|
|
100
94
|
input_audio_transcription:
|
|
101
|
-
T.nilable(
|
|
102
|
-
OpenAI::Realtime::RealtimeSession::InputAudioTranscription::OrHash
|
|
103
|
-
)
|
|
95
|
+
T.nilable(OpenAI::Realtime::AudioTranscription::OrHash)
|
|
104
96
|
).void
|
|
105
97
|
end
|
|
106
98
|
attr_writer :input_audio_transcription
|
|
@@ -233,16 +225,10 @@ module OpenAI
|
|
|
233
225
|
attr_writer :tool_choice
|
|
234
226
|
|
|
235
227
|
# Tools (functions) available to the model.
|
|
236
|
-
sig
|
|
237
|
-
returns(T.nilable(T::Array[OpenAI::Realtime::RealtimeSession::Tool]))
|
|
238
|
-
end
|
|
228
|
+
sig { returns(T.nilable(T::Array[OpenAI::Realtime::Models])) }
|
|
239
229
|
attr_reader :tools
|
|
240
230
|
|
|
241
|
-
sig
|
|
242
|
-
params(
|
|
243
|
-
tools: T::Array[OpenAI::Realtime::RealtimeSession::Tool::OrHash]
|
|
244
|
-
).void
|
|
245
|
-
end
|
|
231
|
+
sig { params(tools: T::Array[OpenAI::Realtime::Models::OrHash]).void }
|
|
246
232
|
attr_writer :tools
|
|
247
233
|
|
|
248
234
|
# Configuration options for tracing. Set to null to disable tracing. Once tracing
|
|
@@ -321,9 +307,7 @@ module OpenAI
|
|
|
321
307
|
input_audio_noise_reduction:
|
|
322
308
|
OpenAI::Realtime::RealtimeSession::InputAudioNoiseReduction::OrHash,
|
|
323
309
|
input_audio_transcription:
|
|
324
|
-
T.nilable(
|
|
325
|
-
OpenAI::Realtime::RealtimeSession::InputAudioTranscription::OrHash
|
|
326
|
-
),
|
|
310
|
+
T.nilable(OpenAI::Realtime::AudioTranscription::OrHash),
|
|
327
311
|
instructions: String,
|
|
328
312
|
max_response_output_tokens: T.any(Integer, Symbol),
|
|
329
313
|
modalities:
|
|
@@ -336,7 +320,7 @@ module OpenAI
|
|
|
336
320
|
speed: Float,
|
|
337
321
|
temperature: Float,
|
|
338
322
|
tool_choice: String,
|
|
339
|
-
tools: T::Array[OpenAI::Realtime::
|
|
323
|
+
tools: T::Array[OpenAI::Realtime::Models::OrHash],
|
|
340
324
|
tracing:
|
|
341
325
|
T.nilable(
|
|
342
326
|
T.any(
|
|
@@ -460,9 +444,7 @@ module OpenAI
|
|
|
460
444
|
input_audio_noise_reduction:
|
|
461
445
|
OpenAI::Realtime::RealtimeSession::InputAudioNoiseReduction,
|
|
462
446
|
input_audio_transcription:
|
|
463
|
-
T.nilable(
|
|
464
|
-
OpenAI::Realtime::RealtimeSession::InputAudioTranscription
|
|
465
|
-
),
|
|
447
|
+
T.nilable(OpenAI::Realtime::AudioTranscription),
|
|
466
448
|
instructions: String,
|
|
467
449
|
max_response_output_tokens: T.any(Integer, Symbol),
|
|
468
450
|
modalities:
|
|
@@ -475,7 +457,7 @@ module OpenAI
|
|
|
475
457
|
speed: Float,
|
|
476
458
|
temperature: Float,
|
|
477
459
|
tool_choice: String,
|
|
478
|
-
tools: T::Array[OpenAI::Realtime::
|
|
460
|
+
tools: T::Array[OpenAI::Realtime::Models],
|
|
479
461
|
tracing:
|
|
480
462
|
T.nilable(
|
|
481
463
|
T.any(
|
|
@@ -572,19 +554,12 @@ module OpenAI
|
|
|
572
554
|
# headphones, `far_field` is for far-field microphones such as laptop or
|
|
573
555
|
# conference room microphones.
|
|
574
556
|
sig do
|
|
575
|
-
returns(
|
|
576
|
-
T.nilable(
|
|
577
|
-
OpenAI::Realtime::RealtimeSession::InputAudioNoiseReduction::Type::OrSymbol
|
|
578
|
-
)
|
|
579
|
-
)
|
|
557
|
+
returns(T.nilable(OpenAI::Realtime::NoiseReductionType::OrSymbol))
|
|
580
558
|
end
|
|
581
559
|
attr_reader :type
|
|
582
560
|
|
|
583
561
|
sig do
|
|
584
|
-
params(
|
|
585
|
-
type:
|
|
586
|
-
OpenAI::Realtime::RealtimeSession::InputAudioNoiseReduction::Type::OrSymbol
|
|
587
|
-
).void
|
|
562
|
+
params(type: OpenAI::Realtime::NoiseReductionType::OrSymbol).void
|
|
588
563
|
end
|
|
589
564
|
attr_writer :type
|
|
590
565
|
|
|
@@ -595,8 +570,7 @@ module OpenAI
|
|
|
595
570
|
# perception of the input audio.
|
|
596
571
|
sig do
|
|
597
572
|
params(
|
|
598
|
-
type:
|
|
599
|
-
OpenAI::Realtime::RealtimeSession::InputAudioNoiseReduction::Type::OrSymbol
|
|
573
|
+
type: OpenAI::Realtime::NoiseReductionType::OrSymbol
|
|
600
574
|
).returns(T.attached_class)
|
|
601
575
|
end
|
|
602
576
|
def self.new(
|
|
@@ -609,123 +583,7 @@ module OpenAI
|
|
|
609
583
|
|
|
610
584
|
sig do
|
|
611
585
|
override.returns(
|
|
612
|
-
{
|
|
613
|
-
type:
|
|
614
|
-
OpenAI::Realtime::RealtimeSession::InputAudioNoiseReduction::Type::OrSymbol
|
|
615
|
-
}
|
|
616
|
-
)
|
|
617
|
-
end
|
|
618
|
-
def to_hash
|
|
619
|
-
end
|
|
620
|
-
|
|
621
|
-
# Type of noise reduction. `near_field` is for close-talking microphones such as
|
|
622
|
-
# headphones, `far_field` is for far-field microphones such as laptop or
|
|
623
|
-
# conference room microphones.
|
|
624
|
-
module Type
|
|
625
|
-
extend OpenAI::Internal::Type::Enum
|
|
626
|
-
|
|
627
|
-
TaggedSymbol =
|
|
628
|
-
T.type_alias do
|
|
629
|
-
T.all(
|
|
630
|
-
Symbol,
|
|
631
|
-
OpenAI::Realtime::RealtimeSession::InputAudioNoiseReduction::Type
|
|
632
|
-
)
|
|
633
|
-
end
|
|
634
|
-
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
635
|
-
|
|
636
|
-
NEAR_FIELD =
|
|
637
|
-
T.let(
|
|
638
|
-
:near_field,
|
|
639
|
-
OpenAI::Realtime::RealtimeSession::InputAudioNoiseReduction::Type::TaggedSymbol
|
|
640
|
-
)
|
|
641
|
-
FAR_FIELD =
|
|
642
|
-
T.let(
|
|
643
|
-
:far_field,
|
|
644
|
-
OpenAI::Realtime::RealtimeSession::InputAudioNoiseReduction::Type::TaggedSymbol
|
|
645
|
-
)
|
|
646
|
-
|
|
647
|
-
sig do
|
|
648
|
-
override.returns(
|
|
649
|
-
T::Array[
|
|
650
|
-
OpenAI::Realtime::RealtimeSession::InputAudioNoiseReduction::Type::TaggedSymbol
|
|
651
|
-
]
|
|
652
|
-
)
|
|
653
|
-
end
|
|
654
|
-
def self.values
|
|
655
|
-
end
|
|
656
|
-
end
|
|
657
|
-
end
|
|
658
|
-
|
|
659
|
-
class InputAudioTranscription < OpenAI::Internal::Type::BaseModel
|
|
660
|
-
OrHash =
|
|
661
|
-
T.type_alias do
|
|
662
|
-
T.any(
|
|
663
|
-
OpenAI::Realtime::RealtimeSession::InputAudioTranscription,
|
|
664
|
-
OpenAI::Internal::AnyHash
|
|
665
|
-
)
|
|
666
|
-
end
|
|
667
|
-
|
|
668
|
-
# The language of the input audio. Supplying the input language in
|
|
669
|
-
# [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`)
|
|
670
|
-
# format will improve accuracy and latency.
|
|
671
|
-
sig { returns(T.nilable(String)) }
|
|
672
|
-
attr_reader :language
|
|
673
|
-
|
|
674
|
-
sig { params(language: String).void }
|
|
675
|
-
attr_writer :language
|
|
676
|
-
|
|
677
|
-
# The model to use for transcription, current options are `gpt-4o-transcribe`,
|
|
678
|
-
# `gpt-4o-mini-transcribe`, and `whisper-1`.
|
|
679
|
-
sig { returns(T.nilable(String)) }
|
|
680
|
-
attr_reader :model
|
|
681
|
-
|
|
682
|
-
sig { params(model: String).void }
|
|
683
|
-
attr_writer :model
|
|
684
|
-
|
|
685
|
-
# An optional text to guide the model's style or continue a previous audio
|
|
686
|
-
# segment. For `whisper-1`, the
|
|
687
|
-
# [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting).
|
|
688
|
-
# For `gpt-4o-transcribe` models, the prompt is a free text string, for example
|
|
689
|
-
# "expect words related to technology".
|
|
690
|
-
sig { returns(T.nilable(String)) }
|
|
691
|
-
attr_reader :prompt
|
|
692
|
-
|
|
693
|
-
sig { params(prompt: String).void }
|
|
694
|
-
attr_writer :prompt
|
|
695
|
-
|
|
696
|
-
# Configuration for input audio transcription, defaults to off and can be set to
|
|
697
|
-
# `null` to turn off once on. Input audio transcription is not native to the
|
|
698
|
-
# model, since the model consumes audio directly. Transcription runs
|
|
699
|
-
# asynchronously through
|
|
700
|
-
# [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription)
|
|
701
|
-
# and should be treated as guidance of input audio content rather than precisely
|
|
702
|
-
# what the model heard. The client can optionally set the language and prompt for
|
|
703
|
-
# transcription, these offer additional guidance to the transcription service.
|
|
704
|
-
sig do
|
|
705
|
-
params(language: String, model: String, prompt: String).returns(
|
|
706
|
-
T.attached_class
|
|
707
|
-
)
|
|
708
|
-
end
|
|
709
|
-
def self.new(
|
|
710
|
-
# The language of the input audio. Supplying the input language in
|
|
711
|
-
# [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`)
|
|
712
|
-
# format will improve accuracy and latency.
|
|
713
|
-
language: nil,
|
|
714
|
-
# The model to use for transcription, current options are `gpt-4o-transcribe`,
|
|
715
|
-
# `gpt-4o-mini-transcribe`, and `whisper-1`.
|
|
716
|
-
model: nil,
|
|
717
|
-
# An optional text to guide the model's style or continue a previous audio
|
|
718
|
-
# segment. For `whisper-1`, the
|
|
719
|
-
# [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting).
|
|
720
|
-
# For `gpt-4o-transcribe` models, the prompt is a free text string, for example
|
|
721
|
-
# "expect words related to technology".
|
|
722
|
-
prompt: nil
|
|
723
|
-
)
|
|
724
|
-
end
|
|
725
|
-
|
|
726
|
-
sig do
|
|
727
|
-
override.returns(
|
|
728
|
-
{ language: String, model: String, prompt: String }
|
|
586
|
+
{ type: OpenAI::Realtime::NoiseReductionType::OrSymbol }
|
|
729
587
|
)
|
|
730
588
|
end
|
|
731
589
|
def to_hash
|
|
@@ -908,114 +766,6 @@ module OpenAI
|
|
|
908
766
|
end
|
|
909
767
|
end
|
|
910
768
|
|
|
911
|
-
class Tool < OpenAI::Internal::Type::BaseModel
|
|
912
|
-
OrHash =
|
|
913
|
-
T.type_alias do
|
|
914
|
-
T.any(
|
|
915
|
-
OpenAI::Realtime::RealtimeSession::Tool,
|
|
916
|
-
OpenAI::Internal::AnyHash
|
|
917
|
-
)
|
|
918
|
-
end
|
|
919
|
-
|
|
920
|
-
# The description of the function, including guidance on when and how to call it,
|
|
921
|
-
# and guidance about what to tell the user when calling (if anything).
|
|
922
|
-
sig { returns(T.nilable(String)) }
|
|
923
|
-
attr_reader :description
|
|
924
|
-
|
|
925
|
-
sig { params(description: String).void }
|
|
926
|
-
attr_writer :description
|
|
927
|
-
|
|
928
|
-
# The name of the function.
|
|
929
|
-
sig { returns(T.nilable(String)) }
|
|
930
|
-
attr_reader :name
|
|
931
|
-
|
|
932
|
-
sig { params(name: String).void }
|
|
933
|
-
attr_writer :name
|
|
934
|
-
|
|
935
|
-
# Parameters of the function in JSON Schema.
|
|
936
|
-
sig { returns(T.nilable(T.anything)) }
|
|
937
|
-
attr_reader :parameters
|
|
938
|
-
|
|
939
|
-
sig { params(parameters: T.anything).void }
|
|
940
|
-
attr_writer :parameters
|
|
941
|
-
|
|
942
|
-
# The type of the tool, i.e. `function`.
|
|
943
|
-
sig do
|
|
944
|
-
returns(
|
|
945
|
-
T.nilable(OpenAI::Realtime::RealtimeSession::Tool::Type::OrSymbol)
|
|
946
|
-
)
|
|
947
|
-
end
|
|
948
|
-
attr_reader :type
|
|
949
|
-
|
|
950
|
-
sig do
|
|
951
|
-
params(
|
|
952
|
-
type: OpenAI::Realtime::RealtimeSession::Tool::Type::OrSymbol
|
|
953
|
-
).void
|
|
954
|
-
end
|
|
955
|
-
attr_writer :type
|
|
956
|
-
|
|
957
|
-
sig do
|
|
958
|
-
params(
|
|
959
|
-
description: String,
|
|
960
|
-
name: String,
|
|
961
|
-
parameters: T.anything,
|
|
962
|
-
type: OpenAI::Realtime::RealtimeSession::Tool::Type::OrSymbol
|
|
963
|
-
).returns(T.attached_class)
|
|
964
|
-
end
|
|
965
|
-
def self.new(
|
|
966
|
-
# The description of the function, including guidance on when and how to call it,
|
|
967
|
-
# and guidance about what to tell the user when calling (if anything).
|
|
968
|
-
description: nil,
|
|
969
|
-
# The name of the function.
|
|
970
|
-
name: nil,
|
|
971
|
-
# Parameters of the function in JSON Schema.
|
|
972
|
-
parameters: nil,
|
|
973
|
-
# The type of the tool, i.e. `function`.
|
|
974
|
-
type: nil
|
|
975
|
-
)
|
|
976
|
-
end
|
|
977
|
-
|
|
978
|
-
sig do
|
|
979
|
-
override.returns(
|
|
980
|
-
{
|
|
981
|
-
description: String,
|
|
982
|
-
name: String,
|
|
983
|
-
parameters: T.anything,
|
|
984
|
-
type: OpenAI::Realtime::RealtimeSession::Tool::Type::OrSymbol
|
|
985
|
-
}
|
|
986
|
-
)
|
|
987
|
-
end
|
|
988
|
-
def to_hash
|
|
989
|
-
end
|
|
990
|
-
|
|
991
|
-
# The type of the tool, i.e. `function`.
|
|
992
|
-
module Type
|
|
993
|
-
extend OpenAI::Internal::Type::Enum
|
|
994
|
-
|
|
995
|
-
TaggedSymbol =
|
|
996
|
-
T.type_alias do
|
|
997
|
-
T.all(Symbol, OpenAI::Realtime::RealtimeSession::Tool::Type)
|
|
998
|
-
end
|
|
999
|
-
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
1000
|
-
|
|
1001
|
-
FUNCTION =
|
|
1002
|
-
T.let(
|
|
1003
|
-
:function,
|
|
1004
|
-
OpenAI::Realtime::RealtimeSession::Tool::Type::TaggedSymbol
|
|
1005
|
-
)
|
|
1006
|
-
|
|
1007
|
-
sig do
|
|
1008
|
-
override.returns(
|
|
1009
|
-
T::Array[
|
|
1010
|
-
OpenAI::Realtime::RealtimeSession::Tool::Type::TaggedSymbol
|
|
1011
|
-
]
|
|
1012
|
-
)
|
|
1013
|
-
end
|
|
1014
|
-
def self.values
|
|
1015
|
-
end
|
|
1016
|
-
end
|
|
1017
|
-
end
|
|
1018
|
-
|
|
1019
769
|
# Configuration options for tracing. Set to null to disable tracing. Once tracing
|
|
1020
770
|
# is enabled for a session, the configuration cannot be modified.
|
|
1021
771
|
#
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module OpenAI
|
|
4
|
+
module Models
|
|
5
|
+
RealtimeSessionClientSecret = Realtime::RealtimeSessionClientSecret
|
|
6
|
+
|
|
7
|
+
module Realtime
|
|
8
|
+
class RealtimeSessionClientSecret < OpenAI::Internal::Type::BaseModel
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(
|
|
12
|
+
OpenAI::Realtime::RealtimeSessionClientSecret,
|
|
13
|
+
OpenAI::Internal::AnyHash
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Timestamp for when the token expires. Currently, all tokens expire after one
|
|
18
|
+
# minute.
|
|
19
|
+
sig { returns(Integer) }
|
|
20
|
+
attr_accessor :expires_at
|
|
21
|
+
|
|
22
|
+
# Ephemeral key usable in client environments to authenticate connections to the
|
|
23
|
+
# Realtime API. Use this in client-side environments rather than a standard API
|
|
24
|
+
# token, which should only be used server-side.
|
|
25
|
+
sig { returns(String) }
|
|
26
|
+
attr_accessor :value
|
|
27
|
+
|
|
28
|
+
# Ephemeral key returned by the API.
|
|
29
|
+
sig do
|
|
30
|
+
params(expires_at: Integer, value: String).returns(T.attached_class)
|
|
31
|
+
end
|
|
32
|
+
def self.new(
|
|
33
|
+
# Timestamp for when the token expires. Currently, all tokens expire after one
|
|
34
|
+
# minute.
|
|
35
|
+
expires_at:,
|
|
36
|
+
# Ephemeral key usable in client environments to authenticate connections to the
|
|
37
|
+
# Realtime API. Use this in client-side environments rather than a standard API
|
|
38
|
+
# token, which should only be used server-side.
|
|
39
|
+
value:
|
|
40
|
+
)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
sig { override.returns({ expires_at: Integer, value: String }) }
|
|
44
|
+
def to_hash
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|