openai 0.95.0 → 0.97.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 +51 -0
- data/README.md +5 -2
- data/docs/architecture/security-model.md +2 -2
- data/examples/audio/record_and_play.rb +1 -1
- data/lib/openai/helpers/live/transcript_grouper.rb +264 -0
- data/lib/openai/helpers/live/transcript_grouping.rb +309 -0
- data/lib/openai/helpers/live/websocket.rb +454 -0
- data/lib/openai/helpers/realtime/translation.rb +440 -0
- data/lib/openai/helpers/realtime.rb +1 -0
- data/lib/openai/helpers/responses_websocket/incremental.rb +246 -0
- data/lib/openai/helpers/responses_websocket/transports/async_websocket.rb +183 -0
- data/lib/openai/helpers/responses_websocket.rb +1 -0
- data/lib/openai/helpers/streaming/response_stream.rb +19 -11
- data/lib/openai/helpers/structured_output/chat_completion_parser.rb +0 -2
- data/lib/openai/helpers/structured_output/response_parser.rb +1 -2
- data/lib/openai/helpers/structured_output/union_of.rb +0 -2
- data/lib/openai/helpers/websocket/async_websocket_transport.rb +11 -6
- data/lib/openai/helpers/websocket/connection_manager.rb +9 -0
- data/lib/openai/internal/read_io_adapter.rb +0 -2
- data/lib/openai/internal/stream.rb +0 -2
- data/lib/openai/internal/type/base_model.rb +4 -6
- data/lib/openai/internal/type/converter.rb +5 -3
- data/lib/openai/internal/type/enum.rb +0 -2
- data/lib/openai/internal/type/union.rb +0 -6
- data/lib/openai/internal/type/unknown.rb +34 -6
- data/lib/openai/internal/util.rb +0 -4
- data/lib/openai/models/audio/speech_create_params.rb +9 -0
- data/lib/openai/models/audio/transcription_create_response.rb +4 -1
- data/lib/openai/models/audio/translation_create_response.rb +4 -1
- data/lib/openai/models/beta/agent.rb +3 -2
- data/lib/openai/models/beta/agent_browser_authentication_cancel_param.rb +23 -0
- data/lib/openai/models/beta/agent_browser_authentication_submit_param.rb +70 -0
- data/lib/openai/models/beta/agent_browser_origin_access_param.rb +45 -0
- data/lib/openai/models/beta/agent_create_params.rb +5 -2
- data/lib/openai/models/beta/agent_output_item.rb +276 -1
- data/lib/openai/models/beta/agent_session.rb +252 -5
- data/lib/openai/models/beta/agent_session_input_param.rb +64 -1
- data/lib/openai/models/beta/agent_session_item.rb +391 -1
- data/lib/openai/models/beta/agent_session_turn_item_added_event.rb +2 -2
- data/lib/openai/models/beta/agent_session_turn_item_done_event.rb +2 -2
- data/lib/openai/models/beta/agent_tool.rb +27 -1
- data/lib/openai/models/beta/agent_tool_param.rb +27 -1
- data/lib/openai/models/beta/agent_update_params.rb +5 -2
- data/lib/openai/models/beta/agents/environments/environment_template.rb +26 -2
- data/lib/openai/models/beta/agents/environments/template_create_params.rb +51 -6
- data/lib/openai/models/beta/agents/environments/template_update_params.rb +51 -9
- data/lib/openai/models/beta/agents/session_create_params.rb +5 -2
- data/lib/openai/models/beta/agents/session_update_params.rb +3 -0
- data/lib/openai/models/beta/agents/sessions/event_create_params.rb +2 -2
- data/lib/openai/models/beta/agents/vaults/credential.rb +10 -1
- data/lib/openai/models/beta/agents/vaults/credential_create_params.rb +12 -1
- data/lib/openai/models/beta/agents/vaults/credential_update_params.rb +14 -3
- data/lib/openai/models/beta/beta_response.rb +38 -1
- data/lib/openai/models/beta/beta_responses_client_event.rb +73 -1
- data/lib/openai/models/beta/beta_web_search_preview_tool.rb +9 -3
- data/lib/openai/models/beta/beta_web_search_tool.rb +9 -3
- data/lib/openai/models/beta/environment.rb +26 -2
- data/lib/openai/models/beta/environment_param.rb +46 -6
- data/lib/openai/models/beta/persisted_agent_tool.rb +27 -1
- data/lib/openai/models/beta/persisted_agent_tool_param.rb +27 -1
- data/lib/openai/models/beta/response_compact_params.rb +3 -0
- data/lib/openai/models/beta/response_create_params.rb +68 -1
- data/lib/openai/models/beta/session_turn_error.rb +3 -0
- data/lib/openai/models/chat_model.rb +1 -0
- data/lib/openai/models/responses/response.rb +35 -1
- data/lib/openai/models/responses/response_compact_params.rb +3 -0
- data/lib/openai/models/responses/response_create_params.rb +65 -1
- data/lib/openai/models/responses/responses_client_event.rb +70 -1
- data/lib/openai/models/responses/web_search_preview_tool.rb +9 -3
- data/lib/openai/models/responses/web_search_tool.rb +9 -3
- data/lib/openai/net_http_client.rb +0 -2
- data/lib/openai/resources/audio/transcriptions.rb +5 -3
- data/lib/openai/resources/audio/translations.rb +1 -1
- data/lib/openai/resources/beta/agents/environments/templates.rb +12 -5
- data/lib/openai/resources/beta/agents/sessions/events.rb +1 -1
- data/lib/openai/resources/beta/agents/sessions/items.rb +1 -1
- data/lib/openai/resources/beta/agents/sessions/subagents/items.rb +1 -1
- data/lib/openai/resources/beta/agents/sessions/subagents/turns/items.rb +1 -1
- data/lib/openai/resources/beta/agents/vaults/credentials.rb +12 -4
- data/lib/openai/resources/beta/agents.rb +2 -2
- data/lib/openai/resources/beta/responses.rb +8 -2
- data/lib/openai/resources/responses.rb +8 -1
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +4 -0
- data/rbi/openai/helpers/live/transcript_grouper.rbi +67 -0
- data/rbi/openai/helpers/live/websocket.rbi +299 -0
- data/rbi/openai/helpers/realtime/translation.rbi +137 -0
- data/rbi/openai/helpers/responses_websocket/incremental.rbi +32 -0
- data/rbi/openai/helpers/responses_websocket/transports/async_websocket.rbi +24 -0
- data/rbi/openai/helpers/streaming/response_stream.rbi +5 -0
- data/rbi/openai/internal/type/converter.rbi +3 -2
- data/rbi/openai/models/audio/speech_create_params.rbi +3 -0
- data/rbi/openai/models/audio/transcription_create_response.rbi +2 -1
- data/rbi/openai/models/audio/translation_create_response.rbi +2 -1
- data/rbi/openai/models/beta/agent.rbi +3 -1
- data/rbi/openai/models/beta/agent_browser_authentication_cancel_param.rbi +53 -0
- data/rbi/openai/models/beta/agent_browser_authentication_submit_param.rbi +125 -0
- data/rbi/openai/models/beta/agent_browser_origin_access_param.rbi +76 -0
- data/rbi/openai/models/beta/agent_create_params.rbi +9 -3
- data/rbi/openai/models/beta/agent_output_item.rbi +422 -0
- data/rbi/openai/models/beta/agent_session.rbi +374 -1
- data/rbi/openai/models/beta/agent_session_input_param.rbi +102 -0
- data/rbi/openai/models/beta/agent_session_item.rbi +614 -0
- data/rbi/openai/models/beta/agent_session_turn_item_added_event.rbi +3 -0
- data/rbi/openai/models/beta/agent_session_turn_item_done_event.rbi +2 -0
- data/rbi/openai/models/beta/agent_tool.rbi +49 -1
- data/rbi/openai/models/beta/agent_tool_param.rbi +52 -1
- data/rbi/openai/models/beta/agent_update_params.rbi +9 -3
- data/rbi/openai/models/beta/agents/environments/environment_template.rbi +53 -2
- data/rbi/openai/models/beta/agents/environments/template_create_params.rbi +77 -7
- data/rbi/openai/models/beta/agents/environments/template_update_params.rbi +77 -10
- data/rbi/openai/models/beta/agents/session_create_params.rbi +9 -3
- data/rbi/openai/models/beta/agents/session_update_params.rbi +3 -0
- data/rbi/openai/models/beta/agents/sessions/event_create_params.rbi +3 -0
- data/rbi/openai/models/beta/agents/vaults/credential.rbi +10 -0
- data/rbi/openai/models/beta/agents/vaults/credential_create_params.rbi +15 -0
- data/rbi/openai/models/beta/agents/vaults/credential_update_params.rbi +35 -6
- data/rbi/openai/models/beta/beta_response.rbi +64 -0
- data/rbi/openai/models/beta/beta_responses_client_event.rbi +128 -0
- data/rbi/openai/models/beta/beta_web_search_preview_tool.rbi +9 -3
- data/rbi/openai/models/beta/beta_web_search_tool.rbi +9 -3
- data/rbi/openai/models/beta/environment.rbi +53 -2
- data/rbi/openai/models/beta/environment_param.rbi +75 -7
- data/rbi/openai/models/beta/persisted_agent_tool.rbi +49 -1
- data/rbi/openai/models/beta/persisted_agent_tool_param.rbi +52 -1
- data/rbi/openai/models/beta/response_compact_params.rbi +1 -0
- data/rbi/openai/models/beta/response_create_params.rbi +100 -0
- data/rbi/openai/models/beta/session_turn_error.rbi +6 -0
- data/rbi/openai/models/chat_model.rbi +1 -0
- data/rbi/openai/models/responses/response.rbi +63 -0
- data/rbi/openai/models/responses/response_compact_params.rbi +1 -0
- data/rbi/openai/models/responses/response_create_params.rbi +106 -0
- data/rbi/openai/models/responses/responses_client_event.rbi +125 -0
- data/rbi/openai/models/responses/web_search_preview_tool.rbi +9 -3
- data/rbi/openai/models/responses/web_search_tool.rbi +9 -3
- data/rbi/openai/resources/audio/transcriptions.rbi +4 -2
- data/rbi/openai/resources/beta/agents/environments/templates.rbi +10 -3
- data/rbi/openai/resources/beta/agents/sessions/events.rbi +1 -0
- data/rbi/openai/resources/beta/agents/vaults/credentials.rbi +11 -3
- data/rbi/openai/resources/beta/agents.rbi +4 -2
- data/rbi/openai/resources/beta/responses.rbi +6 -0
- data/rbi/openai/resources/responses.rbi +11 -0
- data/responses-websocket.md +55 -0
- data/sig/openai/helpers/live/transcript_grouper.rbs +42 -0
- data/sig/openai/helpers/live/websocket.rbs +152 -0
- data/sig/openai/helpers/realtime/translation.rbs +81 -0
- data/sig/openai/helpers/responses_websocket/incremental.rbs +14 -0
- data/sig/openai/helpers/responses_websocket/transports/async_websocket.rbs +21 -0
- data/sig/openai/helpers/streaming/response_stream.rbs +9 -0
- data/sig/openai/internal/type/converter.rbs +3 -1
- data/sig/openai/models/audio/speech_create_params.rbs +6 -0
- data/sig/openai/models/audio/transcription_create_response.rbs +1 -0
- data/sig/openai/models/audio/translation_create_response.rbs +3 -1
- data/sig/openai/models/beta/agent.rbs +3 -1
- data/sig/openai/models/beta/agent_browser_authentication_cancel_param.rbs +21 -0
- data/sig/openai/models/beta/agent_browser_authentication_submit_param.rbs +63 -0
- data/sig/openai/models/beta/agent_browser_origin_access_param.rbs +47 -0
- data/sig/openai/models/beta/agent_create_params.rbs +5 -1
- data/sig/openai/models/beta/agent_output_item.rbs +254 -0
- data/sig/openai/models/beta/agent_session.rbs +218 -2
- data/sig/openai/models/beta/agent_session_input_param.rbs +51 -1
- data/sig/openai/models/beta/agent_session_item.rbs +362 -0
- data/sig/openai/models/beta/agent_tool.rbs +22 -0
- data/sig/openai/models/beta/agent_tool_param.rbs +25 -0
- data/sig/openai/models/beta/agent_update_params.rbs +5 -1
- data/sig/openai/models/beta/agents/environments/environment_template.rbs +29 -3
- data/sig/openai/models/beta/agents/environments/template_create_params.rbs +41 -6
- data/sig/openai/models/beta/agents/environments/template_update_params.rbs +41 -8
- data/sig/openai/models/beta/agents/session_create_params.rbs +5 -1
- data/sig/openai/models/beta/agents/session_update_params.rbs +5 -1
- data/sig/openai/models/beta/agents/vaults/credential.rbs +8 -0
- data/sig/openai/models/beta/agents/vaults/credential_create_params.rbs +14 -0
- data/sig/openai/models/beta/agents/vaults/credential_update_params.rbs +23 -4
- data/sig/openai/models/beta/beta_response.rbs +37 -0
- data/sig/openai/models/beta/beta_responses_client_event.rbs +79 -0
- data/sig/openai/models/beta/beta_web_search_preview_tool.rbs +6 -2
- data/sig/openai/models/beta/beta_web_search_tool.rbs +6 -2
- data/sig/openai/models/beta/environment.rbs +29 -3
- data/sig/openai/models/beta/environment_param.rbs +41 -6
- data/sig/openai/models/beta/persisted_agent_tool.rbs +22 -0
- data/sig/openai/models/beta/persisted_agent_tool_param.rbs +25 -0
- data/sig/openai/models/beta/response_compact_params.rbs +2 -0
- data/sig/openai/models/beta/response_create_params.rbs +79 -0
- data/sig/openai/models/beta/session_turn_error.rbs +4 -0
- data/sig/openai/models/chat_model.rbs +2 -0
- data/sig/openai/models/responses/response.rbs +35 -0
- data/sig/openai/models/responses/response_compact_params.rbs +2 -0
- data/sig/openai/models/responses/response_create_params.rbs +77 -0
- data/sig/openai/models/responses/responses_client_event.rbs +77 -0
- data/sig/openai/models/responses/web_search_preview_tool.rbs +6 -2
- data/sig/openai/models/responses/web_search_tool.rbs +6 -2
- data/sig/openai/resources/beta/agents/environments/templates.rbs +2 -0
- data/sig/openai/resources/beta/agents/vaults/credentials.rbs +3 -1
- data/sig/openai/resources/beta/responses.rbs +2 -0
- data/sig/openai/resources/responses.rbs +4 -0
- metadata +23 -1
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
module OpenAI
|
|
2
|
+
class Client
|
|
3
|
+
# @api private
|
|
4
|
+
def with_live_websocket_connection_request: (
|
|
5
|
+
?path: String | ::Array[String],
|
|
6
|
+
?query: ::Hash[String, String],
|
|
7
|
+
?websocket_base_url: String?,
|
|
8
|
+
?options: OpenAI::request_opts?
|
|
9
|
+
) {
|
|
10
|
+
(
|
|
11
|
+
OpenAI::Internal::Transport::BaseClient::request_input request,
|
|
12
|
+
^-> void mark_handshake_completed
|
|
13
|
+
) -> top
|
|
14
|
+
} -> top
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
module Errors
|
|
18
|
+
class LiveConnectionError < OpenAI::Errors::WebSocketConnectionError
|
|
19
|
+
end
|
|
20
|
+
class LiveProtocolError < OpenAI::Errors::WebSocketProtocolError
|
|
21
|
+
def initialize: -> void
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
module Models
|
|
26
|
+
module Live
|
|
27
|
+
type connection_server_event =
|
|
28
|
+
OpenAI::Models::Live::server_event | OpenAI::Live::UnknownServerEvent
|
|
29
|
+
type connection_client_event =
|
|
30
|
+
OpenAI::Models::Live::client_event | ::Hash[Symbol | String, untyped]
|
|
31
|
+
type fork_connection_server_event =
|
|
32
|
+
OpenAI::Models::Live::fork_server_event
|
|
33
|
+
| OpenAI::Live::UnknownServerEvent
|
|
34
|
+
type fork_connection_client_event =
|
|
35
|
+
OpenAI::Models::Live::fork_client_event
|
|
36
|
+
| ::Hash[Symbol | String, untyped]
|
|
37
|
+
type sideband_connection_client_event =
|
|
38
|
+
OpenAI::Models::Live::SessionUpdateEvent
|
|
39
|
+
| OpenAI::Models::Live::InputAudioMuteEvent
|
|
40
|
+
| OpenAI::Models::Live::InputAudioUnmuteEvent
|
|
41
|
+
| OpenAI::Models::Live::InstructionsAppendEvent
|
|
42
|
+
| OpenAI::Models::Live::ThinkingAppendEvent
|
|
43
|
+
| OpenAI::Models::Live::CommentaryAppendEvent
|
|
44
|
+
| OpenAI::Models::Live::ResponseItemCreateEvent
|
|
45
|
+
| OpenAI::Models::Live::ResponseCreateEvent
|
|
46
|
+
| OpenAI::Models::Live::SessionCloseEvent
|
|
47
|
+
| ::Hash[Symbol | String, untyped]
|
|
48
|
+
|
|
49
|
+
class UnknownServerEvent
|
|
50
|
+
attr_reader type: Symbol
|
|
51
|
+
attr_reader data: ::Hash[Symbol | String, untyped]
|
|
52
|
+
def initialize: (data: ::Hash[Symbol | String, untyped]) -> void
|
|
53
|
+
def to_h: -> ::Hash[(Symbol | String), untyped]
|
|
54
|
+
def inspect: -> String
|
|
55
|
+
alias to_s inspect
|
|
56
|
+
end
|
|
57
|
+
class Connection
|
|
58
|
+
include Enumerable[OpenAI::Models::Live::connection_server_event]
|
|
59
|
+
attr_reader url: URI::Generic
|
|
60
|
+
def initialize: (socket: top, url: URI::Generic) -> void
|
|
61
|
+
def each:
|
|
62
|
+
-> Enumerator[OpenAI::Models::Live::connection_server_event, self]
|
|
63
|
+
| {
|
|
64
|
+
(OpenAI::Models::Live::connection_server_event event) -> void
|
|
65
|
+
} -> self
|
|
66
|
+
def receive: -> OpenAI::Models::Live::connection_server_event?
|
|
67
|
+
def receive_raw: -> String?
|
|
68
|
+
def send_event: (
|
|
69
|
+
OpenAI::Models::Live::connection_client_event event
|
|
70
|
+
) -> nil
|
|
71
|
+
def send_raw: (String data) -> nil
|
|
72
|
+
def close: (?code: Integer, ?reason: String) -> nil
|
|
73
|
+
def abort: -> nil
|
|
74
|
+
def closed?: -> bool
|
|
75
|
+
end
|
|
76
|
+
class SidebandConnection
|
|
77
|
+
include Enumerable[OpenAI::Models::Live::connection_server_event]
|
|
78
|
+
attr_reader url: URI::Generic
|
|
79
|
+
def initialize: (socket: top, url: URI::Generic) -> void
|
|
80
|
+
def each:
|
|
81
|
+
-> Enumerator[OpenAI::Models::Live::connection_server_event, self]
|
|
82
|
+
| {
|
|
83
|
+
(OpenAI::Models::Live::connection_server_event event) -> void
|
|
84
|
+
} -> self
|
|
85
|
+
def receive: -> OpenAI::Models::Live::connection_server_event?
|
|
86
|
+
def receive_raw: -> String?
|
|
87
|
+
def send_event: (
|
|
88
|
+
OpenAI::Models::Live::sideband_connection_client_event event
|
|
89
|
+
) -> nil
|
|
90
|
+
def send_raw: (String data) -> nil
|
|
91
|
+
def close: (?code: Integer, ?reason: String) -> nil
|
|
92
|
+
def abort: -> nil
|
|
93
|
+
def closed?: -> bool
|
|
94
|
+
end
|
|
95
|
+
class ForkConnection
|
|
96
|
+
include Enumerable[OpenAI::Models::Live::fork_connection_server_event]
|
|
97
|
+
attr_reader url: URI::Generic
|
|
98
|
+
def initialize: (socket: top, url: URI::Generic) -> void
|
|
99
|
+
def each:
|
|
100
|
+
-> Enumerator[OpenAI::Models::Live::fork_connection_server_event, self]
|
|
101
|
+
| {
|
|
102
|
+
(OpenAI::Models::Live::fork_connection_server_event event) -> void
|
|
103
|
+
} -> self
|
|
104
|
+
def receive: -> OpenAI::Models::Live::fork_connection_server_event?
|
|
105
|
+
def receive_raw: -> String?
|
|
106
|
+
def send_event: (
|
|
107
|
+
OpenAI::Models::Live::fork_connection_client_event event
|
|
108
|
+
) -> nil
|
|
109
|
+
def send_raw: (String data) -> nil
|
|
110
|
+
def close: (?code: Integer, ?reason: String) -> nil
|
|
111
|
+
def abort: -> nil
|
|
112
|
+
def closed?: -> bool
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
module Resources
|
|
118
|
+
class Live
|
|
119
|
+
def connect: [T] (
|
|
120
|
+
?websocket_base_url: String?,
|
|
121
|
+
?request_options: OpenAI::request_opts?,
|
|
122
|
+
?transport: top,
|
|
123
|
+
?transport_options: ::Hash[Symbol, top]
|
|
124
|
+
) {
|
|
125
|
+
(OpenAI::Live::Connection connection) -> T
|
|
126
|
+
} -> T
|
|
127
|
+
class Sideband
|
|
128
|
+
def connect: [T] (
|
|
129
|
+
String session_id,
|
|
130
|
+
?graceful_close: bool?,
|
|
131
|
+
?websocket_base_url: String?,
|
|
132
|
+
?request_options: OpenAI::request_opts?,
|
|
133
|
+
?transport: top,
|
|
134
|
+
?transport_options: ::Hash[Symbol, top]
|
|
135
|
+
) {
|
|
136
|
+
(OpenAI::Live::SidebandConnection connection) -> T
|
|
137
|
+
} -> T
|
|
138
|
+
end
|
|
139
|
+
class Forks
|
|
140
|
+
def connect: [T] (
|
|
141
|
+
String session_id,
|
|
142
|
+
?websocket_base_url: String?,
|
|
143
|
+
?request_options: OpenAI::request_opts?,
|
|
144
|
+
?transport: top,
|
|
145
|
+
?transport_options: ::Hash[Symbol, top]
|
|
146
|
+
) {
|
|
147
|
+
(OpenAI::Live::ForkConnection connection) -> T
|
|
148
|
+
} -> T
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
end
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
module OpenAI
|
|
2
|
+
class Client
|
|
3
|
+
# @api private
|
|
4
|
+
def with_translation_connection_request: (
|
|
5
|
+
model: String,
|
|
6
|
+
?websocket_base_url: String?,
|
|
7
|
+
?options: OpenAI::request_opts?
|
|
8
|
+
) {
|
|
9
|
+
(
|
|
10
|
+
OpenAI::Internal::Transport::BaseClient::request_input request,
|
|
11
|
+
^-> void mark_handshake_completed
|
|
12
|
+
) -> top
|
|
13
|
+
} -> top
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
module Errors
|
|
17
|
+
class TranslationConnectionError < OpenAI::Errors::WebSocketConnectionError
|
|
18
|
+
end
|
|
19
|
+
class TranslationProtocolError < OpenAI::Errors::WebSocketProtocolError
|
|
20
|
+
def initialize: -> void
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
module Models
|
|
25
|
+
module Realtime
|
|
26
|
+
type translation_connection_server_event =
|
|
27
|
+
OpenAI::Models::Realtime::realtime_translation_server_event
|
|
28
|
+
| OpenAI::Realtime::UnknownTranslationServerEvent
|
|
29
|
+
type translation_connection_client_event =
|
|
30
|
+
OpenAI::Models::Realtime::realtime_translation_client_event
|
|
31
|
+
| ::Hash[Symbol | String, untyped]
|
|
32
|
+
|
|
33
|
+
class UnknownTranslationServerEvent < OpenAI::Realtime::UnknownServerEvent
|
|
34
|
+
def inspect: -> String
|
|
35
|
+
alias to_s inspect
|
|
36
|
+
end
|
|
37
|
+
class TranslationConnection
|
|
38
|
+
include Enumerable[OpenAI::Models::Realtime::translation_connection_server_event]
|
|
39
|
+
attr_reader url: URI::Generic
|
|
40
|
+
def initialize: (socket: top, url: URI::Generic) -> void
|
|
41
|
+
def each:
|
|
42
|
+
-> Enumerator[OpenAI::Models::Realtime::translation_connection_server_event, self]
|
|
43
|
+
| {
|
|
44
|
+
(
|
|
45
|
+
OpenAI::Models::Realtime::translation_connection_server_event event
|
|
46
|
+
) -> void
|
|
47
|
+
} -> self
|
|
48
|
+
def receive: -> OpenAI::Models::Realtime::translation_connection_server_event?
|
|
49
|
+
def receive_raw: -> String?
|
|
50
|
+
def send_event: (
|
|
51
|
+
OpenAI::Models::Realtime::translation_connection_client_event event
|
|
52
|
+
) -> nil
|
|
53
|
+
def finish: (
|
|
54
|
+
timeout: Numeric
|
|
55
|
+
) {
|
|
56
|
+
(
|
|
57
|
+
OpenAI::Models::Realtime::translation_connection_server_event event
|
|
58
|
+
) -> void
|
|
59
|
+
} -> OpenAI::Realtime::RealtimeTranslationSessionClosedEvent
|
|
60
|
+
def send_raw: (String data) -> nil
|
|
61
|
+
def close: (?code: Integer, ?reason: String) -> nil
|
|
62
|
+
def abort: -> nil
|
|
63
|
+
def closed?: -> bool
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
module Resources
|
|
69
|
+
class Realtime
|
|
70
|
+
def connect_translation: [T] (
|
|
71
|
+
model: String,
|
|
72
|
+
?websocket_base_url: String?,
|
|
73
|
+
?request_options: OpenAI::request_opts?,
|
|
74
|
+
?transport: top,
|
|
75
|
+
?transport_options: ::Hash[Symbol, top]
|
|
76
|
+
) {
|
|
77
|
+
(OpenAI::Realtime::TranslationConnection connection) -> T
|
|
78
|
+
} -> T
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module OpenAI
|
|
2
|
+
module Models
|
|
3
|
+
module Responses
|
|
4
|
+
class IncrementalResponse
|
|
5
|
+
attr_reader phase: (:provisional | :unavailable | :terminal)?
|
|
6
|
+
def initialize: -> void
|
|
7
|
+
def output: -> Array[(response_output_item | Hash[Symbol, untyped])]?
|
|
8
|
+
def terminal_event: -> connection_server_event?
|
|
9
|
+
def add: (connection_server_event event) -> void
|
|
10
|
+
def reset: -> void
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -3,6 +3,27 @@ module OpenAI
|
|
|
3
3
|
module Responses
|
|
4
4
|
module Transports
|
|
5
5
|
class AsyncWebSocket
|
|
6
|
+
# @api private
|
|
7
|
+
module PeekableFramer
|
|
8
|
+
# @api private
|
|
9
|
+
def next_frame_compressed?: -> bool
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# @api private
|
|
13
|
+
class BoundedFramer
|
|
14
|
+
# @api private
|
|
15
|
+
def compression_negotiated=: (bool value) -> bool
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# @api private
|
|
19
|
+
module BoundedInflate
|
|
20
|
+
# @api private
|
|
21
|
+
def bound_decoded_messages: (
|
|
22
|
+
Integer max_bytes,
|
|
23
|
+
BoundedFramer framer
|
|
24
|
+
) -> void
|
|
25
|
+
end
|
|
26
|
+
|
|
6
27
|
def initialize: -> void
|
|
7
28
|
def open: (
|
|
8
29
|
url: URI::Generic,
|
|
@@ -98,6 +98,15 @@ module OpenAI
|
|
|
98
98
|
def get_final_response: -> OpenAI::Responses::Response
|
|
99
99
|
def get_output_text: -> String
|
|
100
100
|
end
|
|
101
|
+
|
|
102
|
+
# @api private
|
|
103
|
+
class ResponseStreamState
|
|
104
|
+
def initialize: (
|
|
105
|
+
text_format: untyped,
|
|
106
|
+
?starting_after: Integer?
|
|
107
|
+
) -> void
|
|
108
|
+
def accumulate_output: (untyped event, Array[untyped] items) -> void
|
|
109
|
+
end
|
|
101
110
|
end
|
|
102
111
|
end
|
|
103
112
|
end
|
|
@@ -9,6 +9,7 @@ module OpenAI
|
|
|
9
9
|
type coerce_state =
|
|
10
10
|
{
|
|
11
11
|
translate_names: bool,
|
|
12
|
+
request_only: bool,
|
|
12
13
|
strictness: bool,
|
|
13
14
|
exactness: { yes: Integer, no: Integer, maybe: Integer },
|
|
14
15
|
error: StandardError?,
|
|
@@ -57,7 +58,8 @@ module OpenAI
|
|
|
57
58
|
) -> ::Hash[Symbol, top]
|
|
58
59
|
|
|
59
60
|
def self.new_coerce_state: (
|
|
60
|
-
?translate_names: bool
|
|
61
|
+
?translate_names: bool,
|
|
62
|
+
?request_only: bool
|
|
61
63
|
) -> OpenAI::Internal::Type::Converter::coerce_state
|
|
62
64
|
|
|
63
65
|
def self.coerce: (
|
|
@@ -136,6 +136,9 @@ module OpenAI
|
|
|
136
136
|
| :verse
|
|
137
137
|
| :marin
|
|
138
138
|
| :cedar
|
|
139
|
+
| :fable
|
|
140
|
+
| :onyx
|
|
141
|
+
| :nova
|
|
139
142
|
| OpenAI::Audio::SpeechCreateParams::Voice::ID
|
|
140
143
|
|
|
141
144
|
module Voice
|
|
@@ -166,6 +169,9 @@ module OpenAI
|
|
|
166
169
|
VERSE: :verse
|
|
167
170
|
MARIN: :marin
|
|
168
171
|
CEDAR: :cedar
|
|
172
|
+
FABLE: :fable
|
|
173
|
+
ONYX: :onyx
|
|
174
|
+
NOVA: :nova
|
|
169
175
|
end
|
|
170
176
|
|
|
171
177
|
type response_format = :mp3 | :opus | :aac | :flac | :wav | :pcm
|
|
@@ -2,7 +2,9 @@ module OpenAI
|
|
|
2
2
|
module Models
|
|
3
3
|
module Audio
|
|
4
4
|
type translation_create_response =
|
|
5
|
-
OpenAI::Audio::Translation
|
|
5
|
+
OpenAI::Audio::Translation
|
|
6
|
+
| OpenAI::Audio::TranslationVerbose
|
|
7
|
+
| StringIO
|
|
6
8
|
|
|
7
9
|
module TranslationCreateResponse
|
|
8
10
|
extend OpenAI::Internal::Type::Union
|
|
@@ -118,7 +118,8 @@ module OpenAI
|
|
|
118
118
|
updated_at: Integer
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
type service_tier =
|
|
121
|
+
type service_tier =
|
|
122
|
+
:auto | :default | :flex | :priority | :fast | :ultrafast
|
|
122
123
|
|
|
123
124
|
module ServiceTier
|
|
124
125
|
extend OpenAI::Internal::Type::Enum
|
|
@@ -128,6 +129,7 @@ module OpenAI
|
|
|
128
129
|
FLEX: :flex
|
|
129
130
|
PRIORITY: :priority
|
|
130
131
|
FAST: :fast
|
|
132
|
+
ULTRAFAST: :ultrafast
|
|
131
133
|
|
|
132
134
|
def self?.values: -> ::Array[OpenAI::Models::Beta::Agent::service_tier]
|
|
133
135
|
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module OpenAI
|
|
2
|
+
module Models
|
|
3
|
+
module Beta
|
|
4
|
+
type agent_browser_authentication_cancel_param =
|
|
5
|
+
{ ?action: :cancel, ?type: :browser_authentication }
|
|
6
|
+
|
|
7
|
+
class AgentBrowserAuthenticationCancelParam < OpenAI::Internal::Type::BaseModel
|
|
8
|
+
attr_accessor action: :cancel
|
|
9
|
+
|
|
10
|
+
attr_accessor type: :browser_authentication
|
|
11
|
+
|
|
12
|
+
def initialize: (
|
|
13
|
+
?action: :cancel,
|
|
14
|
+
?type: :browser_authentication
|
|
15
|
+
) -> void
|
|
16
|
+
|
|
17
|
+
def to_hash: -> { ?action: :cancel, ?type: :browser_authentication }
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
module OpenAI
|
|
2
|
+
module Models
|
|
3
|
+
module Beta
|
|
4
|
+
type agent_browser_authentication_submit_param =
|
|
5
|
+
{
|
|
6
|
+
?action: :submit,
|
|
7
|
+
fields: ::Array[OpenAI::Beta::AgentBrowserAuthenticationSubmitParam::Field],
|
|
8
|
+
?type: :browser_authentication,
|
|
9
|
+
?selected_option: String?
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
class AgentBrowserAuthenticationSubmitParam < OpenAI::Internal::Type::BaseModel
|
|
13
|
+
attr_accessor action: :submit
|
|
14
|
+
|
|
15
|
+
# Values for up to six active fields in the required action. The submitted
|
|
16
|
+
# field-value mapping and selected option must fit within 120 KiB of JSON.
|
|
17
|
+
attr_accessor fields: ::Array[OpenAI::Beta::AgentBrowserAuthenticationSubmitParam::Field]
|
|
18
|
+
|
|
19
|
+
attr_accessor type: :browser_authentication
|
|
20
|
+
|
|
21
|
+
# The chosen method. Required when the required action contains options.
|
|
22
|
+
attr_accessor selected_option: String?
|
|
23
|
+
|
|
24
|
+
# @param fields
|
|
25
|
+
# Values for up to six active fields in the required action. The submitted
|
|
26
|
+
# field-value mapping and selected option must fit within 120 KiB of JSON.
|
|
27
|
+
# @param selected_option
|
|
28
|
+
# The chosen method. Required when the required action contains options.
|
|
29
|
+
def initialize: (
|
|
30
|
+
fields: ::Array[OpenAI::Beta::AgentBrowserAuthenticationSubmitParam::Field],
|
|
31
|
+
?selected_option: String?,
|
|
32
|
+
?action: :submit,
|
|
33
|
+
?type: :browser_authentication
|
|
34
|
+
) -> void
|
|
35
|
+
|
|
36
|
+
def to_hash: -> {
|
|
37
|
+
?action: :submit,
|
|
38
|
+
fields: ::Array[OpenAI::Beta::AgentBrowserAuthenticationSubmitParam::Field],
|
|
39
|
+
?type: :browser_authentication,
|
|
40
|
+
?selected_option: String?
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
type field = { field_id: String, value: String }
|
|
44
|
+
|
|
45
|
+
class Field < OpenAI::Internal::Type::BaseModel
|
|
46
|
+
# The field ID from the required action.
|
|
47
|
+
attr_accessor field_id: String
|
|
48
|
+
|
|
49
|
+
# The value to enter into the registered control.
|
|
50
|
+
attr_accessor value: String
|
|
51
|
+
|
|
52
|
+
# @param field_id
|
|
53
|
+
# The field ID from the required action.
|
|
54
|
+
# @param value
|
|
55
|
+
# The value to enter into the registered control.
|
|
56
|
+
def initialize: (field_id: String, value: String) -> void
|
|
57
|
+
|
|
58
|
+
def to_hash: -> { field_id: String, value: String }
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
module OpenAI
|
|
2
|
+
module Models
|
|
3
|
+
module Beta
|
|
4
|
+
type agent_browser_origin_access_param =
|
|
5
|
+
{
|
|
6
|
+
decision: OpenAI::Models::Beta::AgentBrowserOriginAccessParam::decision,
|
|
7
|
+
?type: :browser_origin_access
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
class AgentBrowserOriginAccessParam < OpenAI::Internal::Type::BaseModel
|
|
11
|
+
# Whether to allow, deny, or cancel the requested origin access.
|
|
12
|
+
attr_accessor decision: OpenAI::Models::Beta::AgentBrowserOriginAccessParam::decision
|
|
13
|
+
|
|
14
|
+
attr_accessor type: :browser_origin_access
|
|
15
|
+
|
|
16
|
+
# @param decision
|
|
17
|
+
# Whether to allow, deny, or cancel the requested origin access.
|
|
18
|
+
def initialize: (
|
|
19
|
+
decision: OpenAI::Models::Beta::AgentBrowserOriginAccessParam::decision,
|
|
20
|
+
?type: :browser_origin_access
|
|
21
|
+
) -> void
|
|
22
|
+
|
|
23
|
+
def to_hash: -> {
|
|
24
|
+
decision: OpenAI::Models::Beta::AgentBrowserOriginAccessParam::decision,
|
|
25
|
+
?type: :browser_origin_access
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
type decision = :approve | :deny | :cancel
|
|
29
|
+
|
|
30
|
+
module Decision
|
|
31
|
+
extend OpenAI::Internal::Type::Enum
|
|
32
|
+
|
|
33
|
+
# Allow the browser to access this origin.
|
|
34
|
+
APPROVE: :approve
|
|
35
|
+
|
|
36
|
+
# Deny access to this origin.
|
|
37
|
+
DENY: :deny
|
|
38
|
+
|
|
39
|
+
# Dismiss this request without approving access.
|
|
40
|
+
CANCEL: :cancel
|
|
41
|
+
|
|
42
|
+
def self?.values: -> ::Array[OpenAI::Models::Beta::AgentBrowserOriginAccessParam::decision]
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -98,7 +98,8 @@ module OpenAI
|
|
|
98
98
|
?request_options: OpenAI::RequestOptions
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
type service_tier =
|
|
101
|
+
type service_tier =
|
|
102
|
+
:auto | :default | :flex | :priority | :fast | :ultrafast
|
|
102
103
|
|
|
103
104
|
module ServiceTier
|
|
104
105
|
extend OpenAI::Internal::Type::Enum
|
|
@@ -118,6 +119,9 @@ module OpenAI
|
|
|
118
119
|
# Uses the fast service tier.
|
|
119
120
|
FAST: :fast
|
|
120
121
|
|
|
122
|
+
# Uses the ultrafast service tier.
|
|
123
|
+
ULTRAFAST: :ultrafast
|
|
124
|
+
|
|
121
125
|
def self?.values: -> ::Array[OpenAI::Models::Beta::AgentCreateParams::service_tier]
|
|
122
126
|
end
|
|
123
127
|
end
|