openai 0.96.0 → 0.98.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 +31 -0
- data/README.md +76 -1
- data/lib/openai/helpers/agents/session_stream.rb +60 -3
- data/lib/openai/helpers/beta/agents/artifacts.rb +72 -0
- data/lib/openai/helpers/beta/agents/creation_stream.rb +69 -0
- data/lib/openai/helpers/beta/agents/files.rb +236 -0
- data/lib/openai/helpers/beta/agents/function_tool.rb +65 -0
- data/lib/openai/helpers/beta/agents/model_adapter.rb +27 -0
- data/lib/openai/helpers/beta/agents/result.rb +170 -0
- data/lib/openai/helpers/beta/agents/typed_output.rb +191 -0
- data/lib/openai/helpers/live/websocket.rb +7 -1
- data/lib/openai/helpers/realtime/conversation_item_variant_resolver.rb +1 -1
- data/lib/openai/helpers/responses_websocket/connection.rb +7 -1
- data/lib/openai/helpers/responses_websocket/session.rb +5 -1
- data/lib/openai/helpers/responses_websocket/transports/async_websocket.rb +12 -2
- data/lib/openai/internal/transport/base_client.rb +18 -0
- data/lib/openai/internal/type/array_of.rb +1 -1
- data/lib/openai/internal/type/base_model.rb +6 -3
- data/lib/openai/internal/type/converter.rb +50 -3
- data/lib/openai/internal/type/hash_of.rb +1 -1
- data/lib/openai/internal/type/union.rb +6 -6
- data/lib/openai/models/beta/agent.rb +2 -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 +2 -2
- data/lib/openai/models/beta/agent_output_item.rb +276 -1
- data/lib/openai/models/beta/agent_session.rb +251 -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 +2 -2
- data/lib/openai/models/beta/agents/environments/environment_template.rb +26 -2
- data/lib/openai/models/beta/agents/environments/template_create_params.rb +48 -3
- data/lib/openai/models/beta/agents/environments/template_update_params.rb +45 -3
- data/lib/openai/models/beta/agents/session_create_params.rb +2 -2
- data/lib/openai/models/beta/agents/sessions/event_create_params.rb +2 -2
- data/lib/openai/models/beta/agents/sessions/session_trace.rb +64 -0
- data/lib/openai/models/beta/agents/sessions/trace_list_params.rb +68 -0
- data/lib/openai/models/beta/agents/vaults/credential.rb +8 -4
- data/lib/openai/models/beta/beta_response_output_text.rb +2 -2
- data/lib/openai/models/beta/beta_response_output_text_annotation_added_event.rb +2 -2
- data/lib/openai/models/beta/environment.rb +58 -2
- data/lib/openai/models/beta/environment_param.rb +66 -3
- 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/session_turn_error.rb +3 -0
- data/lib/openai/models/chat/chat_completion_content_part_image.rb +1 -0
- data/lib/openai/models/live/fork_server_event.rb +14 -3
- data/lib/openai/models/live/server_event.rb +14 -3
- data/lib/openai/models/realtime/translations/client_secret_create_params.rb +28 -0
- data/lib/openai/models/responses/response_output_text.rb +2 -2
- data/lib/openai/models/responses/response_output_text_annotation_added_event.rb +2 -2
- data/lib/openai/resources/beta/agents/environments/files.rb +31 -0
- data/lib/openai/resources/beta/agents/environments/templates.rb +9 -2
- data/lib/openai/resources/beta/agents/sessions/artifacts.rb +8 -0
- data/lib/openai/resources/beta/agents/sessions/events.rb +7 -6
- 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/sessions/traces.rb +58 -0
- data/lib/openai/resources/beta/agents/sessions.rb +18 -5
- data/lib/openai/resources/beta/agents.rb +2 -2
- data/lib/openai/resources/evals/runs.rb +1 -1
- data/lib/openai/resources/realtime/translations/client_secrets.rb +58 -0
- data/lib/openai/resources/realtime/translations.rb +20 -0
- data/lib/openai/resources/realtime.rb +4 -0
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +12 -1
- data/rbi/openai/helpers/agents.rbi +20 -1
- data/rbi/openai/helpers/beta/agents/artifacts.rbi +29 -0
- data/rbi/openai/helpers/beta/agents/files.rbi +65 -0
- data/rbi/openai/helpers/beta/agents/function_tool.rbi +40 -0
- data/rbi/openai/helpers/beta/agents/model_adapter.rbi +22 -0
- data/rbi/openai/helpers/beta/agents.rbi +146 -0
- data/rbi/openai/internal/transport/base_client.rbi +12 -0
- data/rbi/openai/internal/type/base_model.rbi +2 -2
- data/rbi/openai/internal/type/converter.rbi +21 -3
- data/rbi/openai/internal/type/union.rbi +6 -2
- data/rbi/openai/models/beta/agent.rbi +2 -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 +6 -3
- data/rbi/openai/models/beta/agent_output_item.rbi +422 -0
- data/rbi/openai/models/beta/agent_session.rbi +373 -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 +6 -3
- data/rbi/openai/models/beta/agents/environments/environment_template.rbi +53 -2
- data/rbi/openai/models/beta/agents/environments/template_create_params.rbi +74 -4
- data/rbi/openai/models/beta/agents/environments/template_update_params.rbi +71 -4
- data/rbi/openai/models/beta/agents/session_create_params.rbi +6 -3
- data/rbi/openai/models/beta/agents/sessions/event_create_params.rbi +3 -0
- data/rbi/openai/models/beta/agents/sessions/session_trace.rbi +97 -0
- data/rbi/openai/models/beta/agents/sessions/trace_list_params.rbi +121 -0
- data/rbi/openai/models/beta/agents/vaults/credential.rbi +5 -5
- data/rbi/openai/models/beta/beta_response_output_text.rbi +2 -2
- data/rbi/openai/models/beta/beta_response_output_text_annotation_added_event.rbi +2 -2
- data/rbi/openai/models/beta/environment.rbi +82 -2
- data/rbi/openai/models/beta/environment_param.rbi +103 -4
- 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/session_turn_error.rbi +3 -0
- data/rbi/openai/models/chat/chat_completion_content_part_image.rbi +1 -0
- data/rbi/openai/models/live/fork_server_event.rbi +14 -2
- data/rbi/openai/models/live/server_event.rbi +14 -2
- data/rbi/openai/models/realtime/translations/client_secret_create_params.rbi +68 -0
- data/rbi/openai/models/responses/response_output_text.rbi +2 -2
- data/rbi/openai/models/responses/response_output_text_annotation_added_event.rbi +2 -2
- data/rbi/openai/resources/beta/agents/environments/files.rbi +31 -0
- data/rbi/openai/resources/beta/agents/environments/templates.rbi +7 -0
- data/rbi/openai/resources/beta/agents/sessions/artifacts.rbi +8 -0
- data/rbi/openai/resources/beta/agents/sessions/events.rbi +7 -5
- data/rbi/openai/resources/beta/agents/sessions/traces.rbi +54 -0
- data/rbi/openai/resources/beta/agents/sessions.rbi +6 -1
- data/rbi/openai/resources/beta/agents.rbi +4 -2
- data/rbi/openai/resources/realtime/translations/client_secrets.rbi +54 -0
- data/rbi/openai/resources/realtime/translations.rbi +22 -0
- data/rbi/openai/resources/realtime.rbi +3 -0
- data/sig/openai/helpers/agents.rbs +7 -0
- data/sig/openai/helpers/beta/agents/artifacts.rbs +20 -0
- data/sig/openai/helpers/beta/agents/files.rbs +41 -0
- data/sig/openai/helpers/beta/agents/function_tool.rbs +24 -0
- data/sig/openai/helpers/beta/agents/model_adapter.rbs +16 -0
- data/sig/openai/helpers/beta/agents.rbs +71 -0
- data/sig/openai/helpers/structured_output.rbs +12 -0
- data/sig/openai/internal/transport/base_client.rbs +8 -0
- data/sig/openai/internal/type/base_model.rbs +3 -1
- data/sig/openai/internal/type/converter.rbs +16 -2
- data/sig/openai/internal/type/union.rbs +2 -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_output_item.rbs +254 -0
- data/sig/openai/models/beta/agent_session.rbs +215 -1
- 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/agents/environments/environment_template.rbs +29 -3
- data/sig/openai/models/beta/agents/environments/template_create_params.rbs +39 -4
- data/sig/openai/models/beta/agents/environments/template_update_params.rbs +37 -4
- data/sig/openai/models/beta/agents/sessions/session_trace.rbs +65 -0
- data/sig/openai/models/beta/agents/sessions/trace_list_params.rbs +81 -0
- data/sig/openai/models/beta/agents/vaults/credential.rbs +5 -5
- data/sig/openai/models/beta/beta_response_output_text.rbs +2 -2
- data/sig/openai/models/beta/beta_response_output_text_annotation_added_event.rbs +2 -2
- data/sig/openai/models/beta/environment.rbs +51 -3
- data/sig/openai/models/beta/environment_param.rbs +64 -4
- 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/session_turn_error.rbs +4 -0
- data/sig/openai/models/chat/chat_completion_content_part_image.rbs +2 -1
- data/sig/openai/models/live/fork_server_event.rbs +17 -2
- data/sig/openai/models/live/server_event.rbs +17 -2
- data/sig/openai/models/realtime/translations/client_secret_create_params.rbs +39 -0
- data/sig/openai/models/responses/response_output_text.rbs +2 -2
- data/sig/openai/models/responses/response_output_text_annotation_added_event.rbs +2 -2
- data/sig/openai/resources/beta/agents/environments/files.rbs +17 -0
- data/sig/openai/resources/beta/agents/environments/templates.rbs +2 -0
- data/sig/openai/resources/beta/agents/sessions/artifacts.rbs +4 -0
- data/sig/openai/resources/beta/agents/sessions/traces.rbs +21 -0
- data/sig/openai/resources/beta/agents/sessions.rbs +4 -1
- data/sig/openai/resources/realtime/translations/client_secrets.rbs +17 -0
- data/sig/openai/resources/realtime/translations.rbs +11 -0
- data/sig/openai/resources/realtime.rbs +2 -0
- metadata +46 -1
|
@@ -159,7 +159,14 @@ module OpenAI
|
|
|
159
159
|
sig { returns(Symbol) }
|
|
160
160
|
attr_accessor :type
|
|
161
161
|
|
|
162
|
-
#
|
|
162
|
+
# The event_id of the client command, when supplied.
|
|
163
|
+
sig { returns(T.nilable(String)) }
|
|
164
|
+
attr_reader :client_event_id
|
|
165
|
+
|
|
166
|
+
sig { params(client_event_id: String).void }
|
|
167
|
+
attr_writer :client_event_id
|
|
168
|
+
|
|
169
|
+
# A SIP DTMF keypress successfully sent to the SIP trunk. Delivered only to
|
|
163
170
|
# sideband observers; this is not a client command.
|
|
164
171
|
sig do
|
|
165
172
|
params(
|
|
@@ -168,6 +175,8 @@ module OpenAI
|
|
|
168
175
|
|
|
169
176
|
event_id: String,
|
|
170
177
|
|
|
178
|
+
client_event_id: String,
|
|
179
|
+
|
|
171
180
|
type: Symbol
|
|
172
181
|
)
|
|
173
182
|
.returns(T.attached_class)
|
|
@@ -178,13 +187,16 @@ module OpenAI
|
|
|
178
187
|
|
|
179
188
|
event_id:,
|
|
180
189
|
|
|
190
|
+
# The event_id of the client command, when supplied.
|
|
191
|
+
client_event_id: nil,
|
|
192
|
+
|
|
181
193
|
type: :"transport.dtmf.send"
|
|
182
194
|
)
|
|
183
195
|
end
|
|
184
196
|
|
|
185
197
|
sig do
|
|
186
198
|
override.returns(
|
|
187
|
-
{event: String, event_id: String, type: Symbol}
|
|
199
|
+
{event: String, event_id: String, type: Symbol, client_event_id: T.nilable(String)}
|
|
188
200
|
)
|
|
189
201
|
end
|
|
190
202
|
def to_hash
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module OpenAI
|
|
4
|
+
module Models
|
|
5
|
+
|
|
6
|
+
module Realtime
|
|
7
|
+
|
|
8
|
+
module Translations
|
|
9
|
+
|
|
10
|
+
class ClientSecretCreateParams < OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest
|
|
11
|
+
|
|
12
|
+
extend OpenAI::Internal::Type::RequestParameters::Converter
|
|
13
|
+
include OpenAI::Internal::Type::RequestParameters
|
|
14
|
+
|
|
15
|
+
OrHash = T.type_alias do
|
|
16
|
+
T.any(
|
|
17
|
+
OpenAI::Realtime::Translations::ClientSecretCreateParams,
|
|
18
|
+
OpenAI::Internal::AnyHash
|
|
19
|
+
)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
sig do
|
|
23
|
+
params(
|
|
24
|
+
|
|
25
|
+
session: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::OrHash,
|
|
26
|
+
|
|
27
|
+
expires_after: OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::OrHash,
|
|
28
|
+
|
|
29
|
+
request_options: OpenAI::RequestOptions::OrHash
|
|
30
|
+
)
|
|
31
|
+
.returns(T.attached_class)
|
|
32
|
+
end
|
|
33
|
+
def self.new(
|
|
34
|
+
|
|
35
|
+
# Realtime translation session configuration. Translation sessions stream source
|
|
36
|
+
# audio in and translated audio plus transcript deltas out continuously.
|
|
37
|
+
session:,
|
|
38
|
+
|
|
39
|
+
# Configuration for the client secret expiration. Expiration refers to the time
|
|
40
|
+
# after which a client secret will no longer be valid for creating sessions. The
|
|
41
|
+
# session itself may continue after that time once started. A secret can be used
|
|
42
|
+
# to create multiple sessions until it expires.
|
|
43
|
+
expires_after: nil,
|
|
44
|
+
|
|
45
|
+
request_options: {}
|
|
46
|
+
)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
sig do
|
|
50
|
+
override.returns(
|
|
51
|
+
{
|
|
52
|
+
session: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest,
|
|
53
|
+
expires_after: OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter,
|
|
54
|
+
request_options: OpenAI::RequestOptions
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
end
|
|
58
|
+
def to_hash
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
end
|
|
68
|
+
end
|
|
@@ -133,7 +133,7 @@ module OpenAI
|
|
|
133
133
|
sig { returns(String) }
|
|
134
134
|
attr_accessor :filename
|
|
135
135
|
|
|
136
|
-
# The index
|
|
136
|
+
# The index in the output text at which to insert the file citation.
|
|
137
137
|
sig { returns(Integer) }
|
|
138
138
|
attr_accessor :index
|
|
139
139
|
|
|
@@ -163,7 +163,7 @@ module OpenAI
|
|
|
163
163
|
# The filename of the file cited.
|
|
164
164
|
filename:,
|
|
165
165
|
|
|
166
|
-
# The index
|
|
166
|
+
# The index in the output text at which to insert the file citation.
|
|
167
167
|
index:,
|
|
168
168
|
|
|
169
169
|
# The type of the file citation. Always `file_citation`.
|
|
@@ -140,7 +140,7 @@ module OpenAI
|
|
|
140
140
|
sig { returns(String) }
|
|
141
141
|
attr_accessor :filename
|
|
142
142
|
|
|
143
|
-
# The index
|
|
143
|
+
# The index in the output text at which to insert the file citation.
|
|
144
144
|
sig { returns(Integer) }
|
|
145
145
|
attr_accessor :index
|
|
146
146
|
|
|
@@ -170,7 +170,7 @@ module OpenAI
|
|
|
170
170
|
# The filename of the file cited.
|
|
171
171
|
filename:,
|
|
172
172
|
|
|
173
|
-
# The index
|
|
173
|
+
# The index in the output text at which to insert the file citation.
|
|
174
174
|
index:,
|
|
175
175
|
|
|
176
176
|
# The type of the file citation. Always `file_citation`.
|
|
@@ -10,6 +10,37 @@ module OpenAI
|
|
|
10
10
|
class Environments
|
|
11
11
|
|
|
12
12
|
class Files
|
|
13
|
+
# Beta file helpers.
|
|
14
|
+
sig {
|
|
15
|
+
params(files: T::Hash[String, T.any(String, Pathname)], request_options: OpenAI::RequestOptions::OrHash)
|
|
16
|
+
.returns(OpenAI::Helpers::Beta::Agents::PreparedFiles)
|
|
17
|
+
}
|
|
18
|
+
def prepare(files, request_options: {})
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
sig {
|
|
22
|
+
params(
|
|
23
|
+
directory: T.any(String, Pathname),
|
|
24
|
+
destination: String,
|
|
25
|
+
include: T::Array[String],
|
|
26
|
+
request_options: OpenAI::RequestOptions::OrHash
|
|
27
|
+
)
|
|
28
|
+
.returns(OpenAI::Helpers::Beta::Agents::PreparedFiles)
|
|
29
|
+
}
|
|
30
|
+
def prepare_directory(directory, destination:, include:, request_options: {})
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
sig {
|
|
34
|
+
params(
|
|
35
|
+
environment_id: String,
|
|
36
|
+
file: T.any(String, Pathname),
|
|
37
|
+
path: String,
|
|
38
|
+
request_options: OpenAI::RequestOptions::OrHash
|
|
39
|
+
)
|
|
40
|
+
.returns(OpenAI::Helpers::Beta::Agents::PreparedFiles)
|
|
41
|
+
}
|
|
42
|
+
def upload(environment_id, file:, path:, request_options: {})
|
|
43
|
+
end
|
|
13
44
|
|
|
14
45
|
# Copies inline bytes or a Files API file into a connected execution environment.
|
|
15
46
|
# See
|
|
@@ -17,6 +17,7 @@ module OpenAI
|
|
|
17
17
|
sig {
|
|
18
18
|
params(
|
|
19
19
|
capability_directories: T.nilable(T::Array[String]),
|
|
20
|
+
desktop: T.nilable(OpenAI::Beta::Agents::Environments::TemplateCreateParams::Desktop::OrHash),
|
|
20
21
|
env: T.nilable(T::Hash[Symbol, String]),
|
|
21
22
|
files: T.nilable(
|
|
22
23
|
T::Array[
|
|
@@ -47,6 +48,9 @@ module OpenAI
|
|
|
47
48
|
# Directories that contain capabilities exposed to the agent. Defaults to an empty
|
|
48
49
|
# list.
|
|
49
50
|
capability_directories: nil,
|
|
51
|
+
# Desktop provisioning. Omission or null inherits the template setting, or
|
|
52
|
+
# defaults to disabled.
|
|
53
|
+
desktop: nil,
|
|
50
54
|
# Environment variables made available to the agent.
|
|
51
55
|
env: nil,
|
|
52
56
|
# Files available before the agent starts. Defaults to an empty list.
|
|
@@ -91,6 +95,7 @@ module OpenAI
|
|
|
91
95
|
params(
|
|
92
96
|
environment_template_id: String,
|
|
93
97
|
capability_directories: T.nilable(T::Array[String]),
|
|
98
|
+
desktop: T.nilable(OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Desktop::OrHash),
|
|
94
99
|
env: T.nilable(T::Hash[Symbol, String]),
|
|
95
100
|
files: T.nilable(
|
|
96
101
|
T::Array[
|
|
@@ -122,6 +127,8 @@ module OpenAI
|
|
|
122
127
|
environment_template_id,
|
|
123
128
|
# Directories that expose capabilities to the agent.
|
|
124
129
|
capability_directories: nil,
|
|
130
|
+
# Replacement desktop configuration, or null to disable the desktop.
|
|
131
|
+
desktop: nil,
|
|
125
132
|
# Replacement confidential environment values.
|
|
126
133
|
env: nil,
|
|
127
134
|
# Replacement file configuration materialized for each new session.
|
|
@@ -10,6 +10,14 @@ module OpenAI
|
|
|
10
10
|
class Sessions
|
|
11
11
|
|
|
12
12
|
class Artifacts
|
|
13
|
+
# Beta result-scoped downloads.
|
|
14
|
+
sig {
|
|
15
|
+
params(result: OpenAI::Helpers::Beta::Agents::TurnResult).returns(
|
|
16
|
+
OpenAI::Helpers::Beta::Agents::ResultArtifacts
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
def for_result(result)
|
|
20
|
+
end
|
|
13
21
|
|
|
14
22
|
# Retrieves immutable metadata for one durable session artifact. See
|
|
15
23
|
# [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).
|
|
@@ -11,17 +11,19 @@ module OpenAI
|
|
|
11
11
|
|
|
12
12
|
class Events
|
|
13
13
|
|
|
14
|
-
# Submits message, cancellation,
|
|
15
|
-
# Cancellation can recover a still-open turn
|
|
16
|
-
# marking it cancelled and abandoning
|
|
17
|
-
# published files, and existing terminal
|
|
18
|
-
# acceptance, not durable completion.
|
|
14
|
+
# Submits message, cancellation, tool-result, or computer-use approval-response
|
|
15
|
+
# events to a managed agent session. Cancellation can recover a still-open turn
|
|
16
|
+
# whose backend execution has ended by marking it cancelled and abandoning
|
|
17
|
+
# unpublished outputs. Saved results, published files, and existing terminal
|
|
18
|
+
# outcomes are preserved. HTTP 202 confirms acceptance, not durable completion.
|
|
19
|
+
# See
|
|
19
20
|
# [session events](https://developers.openai.com/api/docs/guides/agents-api/sessions/events).
|
|
20
21
|
sig {
|
|
21
22
|
params(
|
|
22
23
|
session_id: String,
|
|
23
24
|
events: T::Array[
|
|
24
25
|
T.any(
|
|
26
|
+
OpenAI::Beta::AgentSessionInputParam::AgentSessionInputComputerUseApprovalRequestResult::OrHash,
|
|
25
27
|
OpenAI::Beta::AgentSessionInputParam::AgentSessionInputMessage::OrHash,
|
|
26
28
|
OpenAI::Beta::AgentSessionInputParam::AgentSessionInputCancel::OrHash,
|
|
27
29
|
OpenAI::Beta::AgentSessionInputParam::AgentSessionInputToolResult::OrHash
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module OpenAI
|
|
4
|
+
module Resources
|
|
5
|
+
|
|
6
|
+
class Beta
|
|
7
|
+
|
|
8
|
+
class Agents
|
|
9
|
+
|
|
10
|
+
class Sessions
|
|
11
|
+
|
|
12
|
+
class Traces
|
|
13
|
+
|
|
14
|
+
# Lists published root-turn traces as OTLP JSON, ordered by turn creation time and
|
|
15
|
+
# ID. Unpublished traces are skipped. Each page returns data available when read;
|
|
16
|
+
# it does not wait for late traces. Trace reads and the JSON response are limited
|
|
17
|
+
# to 16 MiB per request. If the limit is exceeded, request fewer traces.
|
|
18
|
+
sig {
|
|
19
|
+
params(
|
|
20
|
+
session_id: String,
|
|
21
|
+
after: String,
|
|
22
|
+
limit: Integer,
|
|
23
|
+
order: OpenAI::Beta::Agents::Sessions::TraceListParams::Order::OrSymbol,
|
|
24
|
+
request_options: OpenAI::RequestOptions::OrHash
|
|
25
|
+
)
|
|
26
|
+
.returns(OpenAI::Internal::CursorPage[OpenAI::Beta::Agents::Sessions::SessionTrace])
|
|
27
|
+
}
|
|
28
|
+
def list(
|
|
29
|
+
# The ID of the session.
|
|
30
|
+
session_id,
|
|
31
|
+
# Return resources after this resource ID in the selected order.
|
|
32
|
+
after: nil,
|
|
33
|
+
# The maximum number of resources to return, between 1 and 100. Defaults to 20.
|
|
34
|
+
limit: nil,
|
|
35
|
+
# The order in which resources are returned. Defaults to `desc`.
|
|
36
|
+
order: nil,
|
|
37
|
+
request_options: {}
|
|
38
|
+
)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# @api private
|
|
42
|
+
sig { params(client: OpenAI::Client).returns(T.attached_class) }
|
|
43
|
+
def self.new(client:)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -21,6 +21,9 @@ module OpenAI
|
|
|
21
21
|
sig { returns(OpenAI::Resources::Beta::Agents::Sessions::Events) }
|
|
22
22
|
attr_reader :events
|
|
23
23
|
|
|
24
|
+
sig { returns(OpenAI::Resources::Beta::Agents::Sessions::Traces) }
|
|
25
|
+
attr_reader :traces
|
|
26
|
+
|
|
24
27
|
sig { returns(OpenAI::Resources::Beta::Agents::Sessions::Turns) }
|
|
25
28
|
attr_reader :turns
|
|
26
29
|
|
|
@@ -88,13 +91,14 @@ module OpenAI
|
|
|
88
91
|
),
|
|
89
92
|
agent: OpenAI::Beta::Agents::SessionCreateParams::Agent::OrHash,
|
|
90
93
|
agent_id: String,
|
|
94
|
+
output_type: T.nilable(T.class_of(OpenAI::Helpers::StructuredOutput::BaseModel)),
|
|
91
95
|
input: T.nilable(OpenAI::Beta::Agents::SessionCreateParams::Input::Variants),
|
|
92
96
|
metadata: T.nilable(T::Hash[Symbol, String]),
|
|
93
97
|
vault_ids: T.nilable(T::Array[String]),
|
|
94
98
|
stream: T.noreturn,
|
|
95
99
|
request_options: OpenAI::RequestOptions::OrHash
|
|
96
100
|
)
|
|
97
|
-
.returns(OpenAI::
|
|
101
|
+
.returns(OpenAI::Helpers::Beta::Agents::CreationStream)
|
|
98
102
|
}
|
|
99
103
|
def create_streaming(
|
|
100
104
|
# An inline execution environment or a reference to an environment template.
|
|
@@ -105,6 +109,7 @@ module OpenAI
|
|
|
105
109
|
# The ID of a saved reusable agent. Omit `agent` to use its configuration
|
|
106
110
|
# unchanged.
|
|
107
111
|
agent_id: nil,
|
|
112
|
+
output_type: nil,
|
|
108
113
|
# Initial input to submit when the session is created. A string is shorthand for a
|
|
109
114
|
# single user message. Required when `environment.type` is `none`, or when
|
|
110
115
|
# `stream` is `true` for an environment that is not `self_hosted`; optional for
|
|
@@ -35,7 +35,8 @@ module OpenAI
|
|
|
35
35
|
OpenAI::Beta::PersistedAgentToolParam::ToolSearch::OrHash,
|
|
36
36
|
OpenAI::Beta::PersistedAgentToolParam::ProgrammaticToolCalling::OrHash,
|
|
37
37
|
OpenAI::Beta::PersistedAgentToolParam::Mcp::OrHash,
|
|
38
|
-
OpenAI::Beta::PersistedAgentToolParam::WebSearch::OrHash
|
|
38
|
+
OpenAI::Beta::PersistedAgentToolParam::WebSearch::OrHash,
|
|
39
|
+
OpenAI::Beta::PersistedAgentToolParam::ComputerUse::OrHash
|
|
39
40
|
)
|
|
40
41
|
]
|
|
41
42
|
),
|
|
@@ -100,7 +101,8 @@ module OpenAI
|
|
|
100
101
|
OpenAI::Beta::PersistedAgentToolParam::ToolSearch::OrHash,
|
|
101
102
|
OpenAI::Beta::PersistedAgentToolParam::ProgrammaticToolCalling::OrHash,
|
|
102
103
|
OpenAI::Beta::PersistedAgentToolParam::Mcp::OrHash,
|
|
103
|
-
OpenAI::Beta::PersistedAgentToolParam::WebSearch::OrHash
|
|
104
|
+
OpenAI::Beta::PersistedAgentToolParam::WebSearch::OrHash,
|
|
105
|
+
OpenAI::Beta::PersistedAgentToolParam::ComputerUse::OrHash
|
|
104
106
|
)
|
|
105
107
|
]
|
|
106
108
|
),
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module OpenAI
|
|
4
|
+
module Resources
|
|
5
|
+
|
|
6
|
+
class Realtime
|
|
7
|
+
|
|
8
|
+
class Translations
|
|
9
|
+
|
|
10
|
+
class ClientSecrets
|
|
11
|
+
|
|
12
|
+
# Create a Realtime translation client secret with an associated translation
|
|
13
|
+
# session configuration.
|
|
14
|
+
#
|
|
15
|
+
# Client secrets are short-lived tokens that can be passed to a client app, such
|
|
16
|
+
# as a web frontend or mobile client, which grants access to the Realtime
|
|
17
|
+
# Translation API without leaking your main API key. You can configure a custom
|
|
18
|
+
# TTL for each client secret.
|
|
19
|
+
#
|
|
20
|
+
# Returns the created client secret and the effective translation session object.
|
|
21
|
+
# The client secret is a string that looks like `ek_1234`.
|
|
22
|
+
sig {
|
|
23
|
+
params(
|
|
24
|
+
session: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::OrHash,
|
|
25
|
+
expires_after: OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::OrHash,
|
|
26
|
+
request_options: OpenAI::RequestOptions::OrHash
|
|
27
|
+
)
|
|
28
|
+
.returns(OpenAI::Realtime::RealtimeTranslationClientSecretCreateResponse)
|
|
29
|
+
}
|
|
30
|
+
def create(
|
|
31
|
+
# Realtime translation session configuration. Translation sessions stream source
|
|
32
|
+
# audio in and translated audio plus transcript deltas out continuously.
|
|
33
|
+
session:,
|
|
34
|
+
# Configuration for the client secret expiration. Expiration refers to the time
|
|
35
|
+
# after which a client secret will no longer be valid for creating sessions. The
|
|
36
|
+
# session itself may continue after that time once started. A secret can be used
|
|
37
|
+
# to create multiple sessions until it expires.
|
|
38
|
+
expires_after: nil,
|
|
39
|
+
request_options: {}
|
|
40
|
+
)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# @api private
|
|
44
|
+
sig { params(client: OpenAI::Client).returns(T.attached_class) }
|
|
45
|
+
def self.new(client:)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module OpenAI
|
|
4
|
+
module Resources
|
|
5
|
+
|
|
6
|
+
class Realtime
|
|
7
|
+
|
|
8
|
+
class Translations
|
|
9
|
+
|
|
10
|
+
sig { returns(OpenAI::Resources::Realtime::Translations::ClientSecrets) }
|
|
11
|
+
attr_reader :client_secrets
|
|
12
|
+
|
|
13
|
+
# @api private
|
|
14
|
+
sig { params(client: OpenAI::Client).returns(T.attached_class) }
|
|
15
|
+
def self.new(client:)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -11,6 +11,9 @@ module OpenAI
|
|
|
11
11
|
sig { returns(OpenAI::Resources::Realtime::Calls) }
|
|
12
12
|
attr_reader :calls
|
|
13
13
|
|
|
14
|
+
sig { returns(OpenAI::Resources::Realtime::Translations) }
|
|
15
|
+
attr_reader :translations
|
|
16
|
+
|
|
14
17
|
# @api private
|
|
15
18
|
sig { params(client: OpenAI::Client).returns(T.attached_class) }
|
|
16
19
|
def self.new(client:)
|
|
@@ -16,6 +16,12 @@ module OpenAI
|
|
|
16
16
|
| -> Enumerator[OpenAI::Models::Beta::agent_session_event, self]
|
|
17
17
|
def close: -> void
|
|
18
18
|
def until_done: -> self
|
|
19
|
+
|
|
20
|
+
# @beta
|
|
21
|
+
def get_final_result: -> OpenAI::Helpers::Beta::Agents::TurnResult
|
|
22
|
+
|
|
23
|
+
# @beta
|
|
24
|
+
def with_result_collection: -> self
|
|
19
25
|
end
|
|
20
26
|
end
|
|
21
27
|
end
|
|
@@ -30,6 +36,7 @@ module OpenAI
|
|
|
30
36
|
| Hash[Symbol, untyped]],
|
|
31
37
|
?tool_handlers: Hash[String, OpenAI::Helpers::Agents::tool_handler],
|
|
32
38
|
?idempotency_key: String?,
|
|
39
|
+
?output_type: singleton(OpenAI::Helpers::StructuredOutput::BaseModel)?,
|
|
33
40
|
?request_options: OpenAI::RequestOptions
|
|
34
41
|
| Hash[Symbol, untyped]
|
|
35
42
|
| nil
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module OpenAI
|
|
2
|
+
module Helpers
|
|
3
|
+
module Beta
|
|
4
|
+
module Agents
|
|
5
|
+
class ResultArtifacts
|
|
6
|
+
def initialize: (
|
|
7
|
+
artifacts: OpenAI::Resources::Beta::Agents::Sessions::Artifacts,
|
|
8
|
+
client: OpenAI::Client,
|
|
9
|
+
result: TurnResult
|
|
10
|
+
) -> void
|
|
11
|
+
def download: (
|
|
12
|
+
path: String,
|
|
13
|
+
to: untyped,
|
|
14
|
+
?request_options: OpenAI::request_opts
|
|
15
|
+
) -> OpenAI::Models::Beta::Agents::Sessions::SessionArtifact
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
module OpenAI
|
|
2
|
+
module Helpers
|
|
3
|
+
module Beta
|
|
4
|
+
module Agents
|
|
5
|
+
class PreparedFiles
|
|
6
|
+
attr_reader files: Array[OpenAI::Models::Beta::HostedEnvironmentFileParam::FileID]
|
|
7
|
+
attr_reader upload_ids: Array[String]
|
|
8
|
+
def initialize: (Array[Hash[Symbol, untyped]] files) -> void
|
|
9
|
+
end
|
|
10
|
+
class FilePreparationError < OpenAI::Errors::Error
|
|
11
|
+
attr_reader prepared: PreparedFiles
|
|
12
|
+
def initialize: (prepared: PreparedFiles) -> void
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# @api private
|
|
16
|
+
class FilePreparation
|
|
17
|
+
def initialize: (
|
|
18
|
+
client: OpenAI::Client,
|
|
19
|
+
environment_files: OpenAI::Resources::Beta::Agents::Environments::Files
|
|
20
|
+
) -> void
|
|
21
|
+
def prepare: (
|
|
22
|
+
Hash[String, String | Pathname] files,
|
|
23
|
+
?request_options: OpenAI::request_opts
|
|
24
|
+
) -> PreparedFiles
|
|
25
|
+
def prepare_directory: (
|
|
26
|
+
String | Pathname directory,
|
|
27
|
+
destination: String,
|
|
28
|
+
include: Array[String],
|
|
29
|
+
?request_options: OpenAI::request_opts
|
|
30
|
+
) -> PreparedFiles
|
|
31
|
+
def upload: (
|
|
32
|
+
String environment_id,
|
|
33
|
+
file: String | Pathname,
|
|
34
|
+
path: String,
|
|
35
|
+
?request_options: OpenAI::request_opts
|
|
36
|
+
) -> PreparedFiles
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module OpenAI
|
|
2
|
+
module Helpers
|
|
3
|
+
module Beta
|
|
4
|
+
module Agents
|
|
5
|
+
class FunctionTool
|
|
6
|
+
attr_reader name: String
|
|
7
|
+
|
|
8
|
+
def initialize: (
|
|
9
|
+
name: String,
|
|
10
|
+
arguments: Class,
|
|
11
|
+
?description: String
|
|
12
|
+
) {
|
|
13
|
+
(untyped) -> OpenAI::Helpers::Agents::tool_output
|
|
14
|
+
} -> void
|
|
15
|
+
def definition: -> Hash[Symbol, untyped]
|
|
16
|
+
def handlers: -> Hash[String, OpenAI::Helpers::Agents::tool_handler]
|
|
17
|
+
def call: (
|
|
18
|
+
String | Hash[String | Symbol, untyped]
|
|
19
|
+
) -> OpenAI::Helpers::Agents::tool_output
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module OpenAI
|
|
2
|
+
module Helpers
|
|
3
|
+
module Beta
|
|
4
|
+
module Agents
|
|
5
|
+
module ModelAdapter
|
|
6
|
+
def self.validate!: (untyped model, parameter: String) -> void
|
|
7
|
+
def self.coerce: (
|
|
8
|
+
singleton(OpenAI::BaseModel) model,
|
|
9
|
+
untyped value,
|
|
10
|
+
?memoize: bool
|
|
11
|
+
) -> OpenAI::BaseModel?
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
module OpenAI
|
|
2
|
+
module Helpers
|
|
3
|
+
module Beta
|
|
4
|
+
module Agents
|
|
5
|
+
class TurnResult
|
|
6
|
+
attr_reader turn: OpenAI::Models::Beta::Agents::Sessions::Turn
|
|
7
|
+
attr_reader messages: Array[OpenAI::Models::Beta::AgentSessionMessage]
|
|
8
|
+
def session_id: -> String
|
|
9
|
+
def turn_id: -> String
|
|
10
|
+
def output_text: -> String
|
|
11
|
+
def output_parsed: -> untyped
|
|
12
|
+
def parse: (
|
|
13
|
+
output_type: singleton(OpenAI::Helpers::StructuredOutput::BaseModel)
|
|
14
|
+
) -> ParsedTurnResult
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class ResultError < OpenAI::Errors::Error
|
|
18
|
+
attr_reader reason: Symbol
|
|
19
|
+
attr_reader session_id: String?
|
|
20
|
+
attr_reader turn: OpenAI::Models::Beta::Agents::Sessions::Turn?
|
|
21
|
+
attr_reader messages: Array[OpenAI::Models::Beta::AgentSessionMessage]
|
|
22
|
+
attr_reader required_actions: Array[OpenAI::Models::Beta::AgentSession::required_action
|
|
23
|
+
| Hash[Symbol, untyped]]
|
|
24
|
+
def turn_id: -> String?
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# @api private
|
|
28
|
+
class ResultCollector
|
|
29
|
+
def initialize: (
|
|
30
|
+
?session_id: String?,
|
|
31
|
+
?handler_names: Array[String]
|
|
32
|
+
) -> void
|
|
33
|
+
def enable: -> void
|
|
34
|
+
def observe: (
|
|
35
|
+
OpenAI::Models::Beta::agent_session_event
|
|
36
|
+
| Hash[Symbol, untyped] event
|
|
37
|
+
) -> void
|
|
38
|
+
def stopped?: -> bool?
|
|
39
|
+
def observe_error: (StandardError error) -> void
|
|
40
|
+
def result: -> TurnResult
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
class ParsedTurnResult < TurnResult
|
|
44
|
+
attr_reader raw_result: TurnResult
|
|
45
|
+
attr_reader output_parsed: untyped
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
class OutputParseError < OpenAI::Errors::Error
|
|
49
|
+
attr_reader raw_result: TurnResult
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# @api private
|
|
53
|
+
class OutputParser
|
|
54
|
+
def initialize: (
|
|
55
|
+
singleton(OpenAI::Helpers::StructuredOutput::BaseModel) model
|
|
56
|
+
) -> void
|
|
57
|
+
def prepare_request: (Hash[Symbol, untyped] params) -> void
|
|
58
|
+
def parse: (TurnResult result) -> ParsedTurnResult
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
class CreationStream < OpenAI::Internal::Stream[OpenAI::Models::Beta::agent_session_event]
|
|
62
|
+
def get_final_result: -> TurnResult
|
|
63
|
+
def with_result_collection: -> self
|
|
64
|
+
|
|
65
|
+
# @api private
|
|
66
|
+
def configure_output_parser: (OutputParser? parser) -> self
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module OpenAI
|
|
2
|
+
module Helpers
|
|
3
|
+
module StructuredOutput
|
|
4
|
+
class BaseModel < OpenAI::Internal::Type::BaseModel
|
|
5
|
+
def self.optional: -> bot
|
|
6
|
+
def self.to_json_schema: -> Hash[Symbol, untyped]
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
class BaseModel = OpenAI::Helpers::StructuredOutput::BaseModel
|
|
12
|
+
end
|