openai 0.90.0 → 0.91.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 +19 -0
- data/README.md +1 -1
- data/examples/realtime/README.md +8 -0
- data/examples/realtime/browser/README.md +167 -0
- data/examples/realtime/browser/index.html +19 -0
- data/examples/realtime/browser/page.js +21 -0
- data/examples/realtime/browser/peer.js +180 -0
- data/examples/realtime/browser/server.rb +281 -0
- data/examples/responses/websocket_workflows.rb +66 -6
- data/lib/openai/auth/workload_identity.rb +5 -1
- data/lib/openai/auth/workload_identity_auth.rb +2 -2
- data/lib/openai/auth/x509_token_exchange.rb +1 -1
- data/lib/openai/helpers/local_audio/process.rb +1 -1
- data/lib/openai/helpers/responses_websocket/connection.rb +2 -1
- data/lib/openai/helpers/responses_websocket/session.rb +551 -0
- data/lib/openai/helpers/responses_websocket.rb +1 -0
- data/lib/openai/helpers/sorbet.rb +1 -1
- data/lib/openai/helpers/websocket/async_websocket_transport.rb +6 -1
- data/lib/openai/internal/poller.rb +2 -2
- data/lib/openai/internal/transport/base_client.rb +1 -1
- data/lib/openai/internal/util.rb +1 -1
- data/lib/openai/models/beta/agents/session_update_params.rb +108 -1
- data/lib/openai/models/beta/beta_response.rb +9 -3
- data/lib/openai/models/beta/beta_response_compaction_compacting_event.rb +75 -0
- data/lib/openai/models/beta/beta_response_stream_event.rb +4 -1
- data/lib/openai/models/beta/beta_responses_client_event.rb +25 -4
- data/lib/openai/models/beta/beta_responses_server_event.rb +39 -1
- data/lib/openai/models/beta/response_compact_params.rb +9 -3
- data/lib/openai/models/beta/response_create_params.rb +21 -4
- data/lib/openai/models/beta/session_turn_error.rb +3 -0
- data/lib/openai/models/chat_model.rb +3 -1
- data/lib/openai/models/responses/response_compact_params.rb +9 -3
- data/lib/openai/models/responses/response_compaction_compacting_event.rb +49 -0
- data/lib/openai/models/responses/response_create_params.rb +12 -1
- data/lib/openai/models/responses/response_stream_event.rb +4 -1
- data/lib/openai/models/responses/responses_client_event.rb +12 -1
- data/lib/openai/models/responses/responses_server_event.rb +36 -1
- data/lib/openai/models/webhooks/realtime_call_incoming_webhook_event.rb +6 -8
- data/lib/openai/resources/beta/agents/sessions.rb +6 -2
- data/lib/openai/resources/beta/responses.rb +2 -2
- data/lib/openai/resources/responses.rb +2 -2
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +2 -0
- data/rbi/openai/helpers/responses_websocket/connection.rbi +5 -0
- data/rbi/openai/helpers/responses_websocket/session.rbi +206 -0
- data/rbi/openai/models/beta/agents/session_update_params.rbi +178 -0
- data/rbi/openai/models/beta/beta_response.rbi +6 -1
- data/rbi/openai/models/beta/beta_response_compaction_compacting_event.rbi +136 -0
- data/rbi/openai/models/beta/beta_response_stream_event.rbi +1 -0
- data/rbi/openai/models/beta/beta_responses_client_event.rbi +27 -4
- data/rbi/openai/models/beta/beta_responses_server_event.rbi +77 -0
- data/rbi/openai/models/beta/response_compact_params.rbi +6 -1
- data/rbi/openai/models/beta/response_create_params.rbi +21 -1
- data/rbi/openai/models/beta/session_turn_error.rbi +6 -0
- data/rbi/openai/models/chat_model.rbi +3 -1
- data/rbi/openai/models/responses/response_compact_params.rbi +6 -1
- data/rbi/openai/models/responses/response_compaction_compacting_event.rbi +78 -0
- data/rbi/openai/models/responses/response_create_params.rbi +15 -0
- data/rbi/openai/models/responses/response_stream_event.rbi +1 -0
- data/rbi/openai/models/responses/responses_client_event.rbi +15 -0
- data/rbi/openai/models/responses/responses_server_event.rbi +71 -0
- data/rbi/openai/models/webhooks/realtime_call_incoming_webhook_event.rbi +6 -8
- data/rbi/openai/resources/beta/agents/sessions.rbi +5 -1
- data/responses-websocket.md +117 -10
- data/sig/openai/helpers/responses_websocket/connection.rbs +5 -0
- data/sig/openai/helpers/responses_websocket/session.rbs +123 -0
- data/sig/openai/models/beta/agents/session_update_params.rbs +99 -0
- data/sig/openai/models/beta/beta_response.rbs +6 -2
- data/sig/openai/models/beta/beta_response_compaction_compacting_event.rbs +58 -0
- data/sig/openai/models/beta/beta_response_stream_event.rbs +1 -0
- data/sig/openai/models/beta/beta_responses_client_event.rbs +13 -2
- data/sig/openai/models/beta/beta_responses_server_event.rbs +35 -0
- data/sig/openai/models/beta/response_compact_params.rbs +6 -2
- data/sig/openai/models/beta/response_create_params.rbs +13 -2
- data/sig/openai/models/beta/session_turn_error.rbs +4 -0
- data/sig/openai/models/chat_model.rbs +6 -2
- data/sig/openai/models/responses/response_compact_params.rbs +6 -2
- data/sig/openai/models/responses/response_compaction_compacting_event.rbs +37 -0
- data/sig/openai/models/responses/response_create_params.rbs +7 -0
- data/sig/openai/models/responses/response_stream_event.rbs +1 -0
- data/sig/openai/models/responses/responses_client_event.rbs +7 -0
- data/sig/openai/models/responses/responses_server_event.rbs +32 -0
- data/sig/openai/resources/beta/agents/sessions.rbs +1 -0
- metadata +16 -2
data/responses-websocket.md
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
# Responses WebSocket workflows
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Install `openai` and the optional `async-websocket` gem. The `multiplex` workflow
|
|
4
|
+
uses `OpenAI::Responses::Session`; versions with only `client.responses.connect`
|
|
5
|
+
can use the raw connection patterns below.
|
|
4
6
|
|
|
5
7
|
```ruby
|
|
6
|
-
gem "openai"
|
|
8
|
+
gem "openai"
|
|
7
9
|
gem "async-websocket"
|
|
8
10
|
```
|
|
9
11
|
|
|
@@ -58,6 +60,73 @@ event types arrive as `OpenAI::Responses::UnknownServerEvent`. Preserve or handl
|
|
|
58
60
|
them explicitly where your application needs them. Do not assume every event
|
|
59
61
|
has a response, text delta, or lane ID.
|
|
60
62
|
|
|
63
|
+
## Managed sessions
|
|
64
|
+
|
|
65
|
+
`OpenAI::Responses::Session.open` adds routed lanes and final-response collection
|
|
66
|
+
using the same authentication, custom headers, and connection options as
|
|
67
|
+
`client.responses.connect`. With `OPENAI_API_KEY` set, this complete example
|
|
68
|
+
opens a session and closes its reader and transport when the block exits:
|
|
69
|
+
|
|
70
|
+
```ruby
|
|
71
|
+
require "openai"
|
|
72
|
+
|
|
73
|
+
limits = OpenAI::Responses::SessionLimits.new(
|
|
74
|
+
max_lanes: 8,
|
|
75
|
+
max_events_per_lane: 128,
|
|
76
|
+
max_events: 512,
|
|
77
|
+
max_bytes_per_lane: 16 * 1024 * 1024,
|
|
78
|
+
max_bytes: 32 * 1024 * 1024,
|
|
79
|
+
max_response_bytes: 64 * 1024 * 1024
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
OpenAI::Responses::Session.open(
|
|
83
|
+
client: OpenAI::Client.new,
|
|
84
|
+
limits: limits,
|
|
85
|
+
request_options: {extra_headers: {"X-Application-Request" => "example"}}
|
|
86
|
+
) do |session|
|
|
87
|
+
lane = session.lane("conversation")
|
|
88
|
+
lane.send_event(type: "response.create", model: "gpt-5.2", input: "Say hello.")
|
|
89
|
+
response = lane.get_final_response
|
|
90
|
+
puts response.status
|
|
91
|
+
# Supply previous_response_id: response.id explicitly for continuation.
|
|
92
|
+
end
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
These required budgets are application choices, not service limits or changes
|
|
96
|
+
to raw connection defaults. The default and all detached lane IDs count toward `max_lanes` until reconnect. Queue
|
|
97
|
+
budgets apply per lane and across the session; byte counts measure serialized
|
|
98
|
+
event data, not total process memory. `max_response_bytes` bounds cumulative
|
|
99
|
+
compatible event bytes retained for collection. Choose budgets for legitimate
|
|
100
|
+
large output, including images and tool results. Queue overflow closes the
|
|
101
|
+
session's connection; collection overflow leaves raw events and other lanes usable.
|
|
102
|
+
|
|
103
|
+
Register lanes before sending and consume each response before creating another
|
|
104
|
+
on that lane. One Async task reads the physical connection; each lane has one
|
|
105
|
+
consumer, and all session operations use the owning Ruby thread. `lane.receive`
|
|
106
|
+
returns original typed or unknown events. `lane.get_final_response` consumes
|
|
107
|
+
remaining events and returns the current completed, failed, or incomplete response;
|
|
108
|
+
inspect its status. Collect a parent's final response before receiving its successor's
|
|
109
|
+
`response.created`, which starts accumulation for the successor. The helper does not
|
|
110
|
+
retain a history of completed responses; callers can retain the raw terminal events. Protocol errors raise `OpenAI::Responses::RequestError` with the
|
|
111
|
+
original event in `error.event`. Raw commands other than `response.create` leave
|
|
112
|
+
subsequent unsequenced, unscoped errors uncorrelated until explicit reconnect. Consuming
|
|
113
|
+
such an error during an active default response fails that lane; named lanes remain
|
|
114
|
+
usable. Errors received before the first raw submission retain ordinary create-retry
|
|
115
|
+
behavior, regardless of later commands sent before consuming them. Observe `session.default` for connection-level
|
|
116
|
+
errors and events with no registered lane. Closing a named lane discards its
|
|
117
|
+
queue and routes future events for that ID to the default lane. Closing a lane
|
|
118
|
+
does not cancel its server work. Its ID remains reserved until reconnect,
|
|
119
|
+
including after terminal events: steering can create automatic successors.
|
|
120
|
+
Continue using the same open lane for sequential responses. Closing the default
|
|
121
|
+
lane opts out of unclaimed events; it cannot be replaced before reconnect.
|
|
122
|
+
|
|
123
|
+
Recovery is explicit: `session.reconnect(client: fresh_client,
|
|
124
|
+
request_options: fresh_options, restore: callback)` re-evaluates authentication
|
|
125
|
+
and custom headers. Old lane handles raise `StateLostError`; the callback
|
|
126
|
+
registers fresh lanes and sends application-selected restoration state. No
|
|
127
|
+
previous create is replayed. Choose stored IDs or full history as described in
|
|
128
|
+
[reconnect guidance](#reconnect-without-replaying-uncertain-work).
|
|
129
|
+
|
|
61
130
|
## Sequential tool turns
|
|
62
131
|
|
|
63
132
|
The `tools` workflow forces a call to one known, harmless application function.
|
|
@@ -87,14 +156,45 @@ route a lane-scoped error to just that lane, while treating a connection-scoped
|
|
|
87
156
|
error as affecting the connection. Track separate response IDs when multiple
|
|
88
157
|
requests are outstanding within a lane; a lane alone is not a request ID.
|
|
89
158
|
|
|
90
|
-
The server executes same-lane requests in FIFO order
|
|
91
|
-
|
|
92
|
-
|
|
159
|
+
The server executes same-lane requests in FIFO order without overlap. Named IDs
|
|
160
|
+
contain 1–256 ASCII letters, digits, underscores, hyphens or periods; an empty string
|
|
161
|
+
is invalid. The raw connection forwards IDs without enforcing this grammar.
|
|
162
|
+
The optional [session helper](#managed-sessions)
|
|
163
|
+
routes events into local queues and allows one consumed response at a time per
|
|
164
|
+
lane; it does not schedule server work. Named-lane terminal events and request
|
|
165
|
+
errors echo the ID; default-lane events omit it.
|
|
166
|
+
|
|
167
|
+
The service allows 16 active responses and queues additional creates. It accepts
|
|
168
|
+
32 distinct named IDs per connection; the default lane does not count. These
|
|
169
|
+
are separate from the session's application budgets. Detaching a local lane
|
|
170
|
+
does not reset the server's distinct-ID count.
|
|
93
171
|
|
|
94
|
-
To fork, send an existing response ID on a different lane. With `store=false
|
|
172
|
+
To fork, send an existing response ID on a different lane. With `store=false` or ZDR,
|
|
95
173
|
wait for the fork's `response.in_progress` before advancing the source lane so
|
|
96
174
|
its parent remains available in the connection-local cache.
|
|
97
175
|
|
|
176
|
+
The server keeps recent response state in a connection-local cache. With
|
|
177
|
+
`store=true`, an older response may be loaded from persisted state. With
|
|
178
|
+
`store=false` or ZDR, an uncached ID returns `previous_response_not_found`.
|
|
179
|
+
A same-lane continuation returning a 4xx or 5xx evicts its referenced cached
|
|
180
|
+
parent; an errored cross-lane fork preserves the shared parent for the source
|
|
181
|
+
lane. Do not blindly retry the same parent after a cache miss; use the explicit
|
|
182
|
+
context-restoration approach below when needed.
|
|
183
|
+
|
|
184
|
+
## Warmup and compaction
|
|
185
|
+
|
|
186
|
+
For optional warmup, send `connection.response.create(..., generate: false)`,
|
|
187
|
+
consume the terminal response, and save its ID. A later create can use that ID
|
|
188
|
+
as `previous_response_id` with new input. Warmup prepares state without model
|
|
189
|
+
output; the existing create helper forwards `generate` as an extra field.
|
|
190
|
+
|
|
191
|
+
With automatic compaction configured through `context_management`, continue
|
|
192
|
+
using the latest response ID and only new input items. Standalone
|
|
193
|
+
`client.responses.compact(...)` instead returns a compacted input window. Send
|
|
194
|
+
its complete `output` as input to a new WebSocket chain, omitting or nulling
|
|
195
|
+
`previous_response_id`; do not use the compaction object's ID as a response ID
|
|
196
|
+
or prune items from its output.
|
|
197
|
+
|
|
98
198
|
## Reconnect without replaying uncertain work
|
|
99
199
|
|
|
100
200
|
Both reconnect examples intentionally close a healthy connection **after** a
|
|
@@ -154,15 +254,22 @@ acknowledgment, and it does not guarantee that a response stopped executing.
|
|
|
154
254
|
event. Stop using that connection; do not automatically resend it.
|
|
155
255
|
- A transport read failure poisons the connection. A server `error` event is
|
|
156
256
|
delivered as an event and does not by itself poison it.
|
|
257
|
+
Handle `previous_response_not_found`, `invalid_stream_id`,
|
|
258
|
+
`websocket_stream_limit_reached`, and `websocket_connection_limit_reached`
|
|
259
|
+
through the original error event. Observe `session.default` when using named
|
|
260
|
+
session lanes so connection-scoped errors are not left unread.
|
|
157
261
|
- Malformed JSON raises `ResponsesProtocolError` without exposing the payload;
|
|
158
262
|
the connection permits later reads. Decide whether continuing is appropriate
|
|
159
263
|
for your application.
|
|
160
264
|
- Raw `send_event` supports generated client models or hashes, including
|
|
161
265
|
`response.steer`. There is no `connection.response.steer` convenience method.
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
`
|
|
266
|
+
Steering accepts only `type`, `previous_response_id`, and `input`, without
|
|
267
|
+
`stream_id`. Accepted input is committed at the successor's `response.created`.
|
|
268
|
+
If `response.steer.pending` requires tool output or approval, fill its
|
|
269
|
+
`required_input` stubs and send one create on the parent's lane with that
|
|
270
|
+
parent ID. Reuse saved results; do not rerun tools or resend accepted input.
|
|
271
|
+
- Follow the platform contract; do not send HTTP-only `stream` or `background`
|
|
272
|
+
flags just because generated models expose them.
|
|
166
273
|
- X.509 workload identity and provider runtimes are not supported by this
|
|
167
274
|
entry point. A nonempty `request_options.extra_query` or nonzero
|
|
168
275
|
`request_options.max_retries` is rejected. Supported workload identity has a
|
|
@@ -31,6 +31,11 @@ module OpenAI
|
|
|
31
31
|
OpenAI::Models::Responses::connection_client_event event
|
|
32
32
|
) -> nil
|
|
33
33
|
|
|
34
|
+
# @api private
|
|
35
|
+
def encode_client_event: (
|
|
36
|
+
OpenAI::Models::Responses::connection_client_event event
|
|
37
|
+
) -> ::Hash[Symbol, untyped]
|
|
38
|
+
|
|
34
39
|
# @api private
|
|
35
40
|
def send_raw: (String data) -> nil
|
|
36
41
|
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
module OpenAI
|
|
2
|
+
module Models
|
|
3
|
+
module Responses
|
|
4
|
+
class SessionError < OpenAI::Errors::Error
|
|
5
|
+
def cause: -> nil
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
class BufferError < SessionError
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
class StateLostError < SessionError
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class RequestError < SessionError
|
|
15
|
+
attr_reader event: connection_server_event
|
|
16
|
+
|
|
17
|
+
# @api private
|
|
18
|
+
def initialize: (connection_server_event event) -> void
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class SessionLimits
|
|
22
|
+
attr_reader max_lanes: Integer
|
|
23
|
+
attr_reader max_events_per_lane: Integer
|
|
24
|
+
attr_reader max_events: Integer
|
|
25
|
+
attr_reader max_bytes_per_lane: Integer
|
|
26
|
+
attr_reader max_bytes: Integer
|
|
27
|
+
attr_reader max_response_bytes: Integer
|
|
28
|
+
def initialize: (
|
|
29
|
+
max_lanes: Integer,
|
|
30
|
+
max_events_per_lane: Integer,
|
|
31
|
+
max_events: Integer,
|
|
32
|
+
max_bytes_per_lane: Integer,
|
|
33
|
+
max_bytes: Integer,
|
|
34
|
+
max_response_bytes: Integer
|
|
35
|
+
) -> void
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
class SessionLane
|
|
39
|
+
attr_reader stream_id: String?
|
|
40
|
+
def send_event: (connection_client_event event) -> void
|
|
41
|
+
def receive: -> connection_server_event
|
|
42
|
+
def get_final_response: -> OpenAI::Responses::Response
|
|
43
|
+
def close: -> void
|
|
44
|
+
|
|
45
|
+
# @api private
|
|
46
|
+
def initialize: (
|
|
47
|
+
Session session,
|
|
48
|
+
String? stream_id,
|
|
49
|
+
Hash[String, untyped] pending_steers
|
|
50
|
+
) -> void
|
|
51
|
+
|
|
52
|
+
# @api private
|
|
53
|
+
def enqueue: (
|
|
54
|
+
connection_server_event event,
|
|
55
|
+
Integer bytes,
|
|
56
|
+
?bool raw_command_sent
|
|
57
|
+
) -> bool?
|
|
58
|
+
|
|
59
|
+
# @api private
|
|
60
|
+
def discard: (?Exception? error) -> void
|
|
61
|
+
|
|
62
|
+
# @api private
|
|
63
|
+
def wake: -> void
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
class Session
|
|
67
|
+
attr_reader limits: SessionLimits
|
|
68
|
+
attr_reader default: SessionLane
|
|
69
|
+
def self.open: [Result] (
|
|
70
|
+
client: OpenAI::Client,
|
|
71
|
+
limits: SessionLimits,
|
|
72
|
+
?request_options: OpenAI::request_opts?,
|
|
73
|
+
?websocket_base_url: String?,
|
|
74
|
+
?transport: top,
|
|
75
|
+
?transport_options: ::Hash[Symbol, top]
|
|
76
|
+
) {
|
|
77
|
+
(Session session) -> Result
|
|
78
|
+
} -> Result
|
|
79
|
+
def lane: (String? stream_id) -> SessionLane
|
|
80
|
+
def reconnect: (
|
|
81
|
+
restore: ^(Session) -> top,
|
|
82
|
+
?client: OpenAI::Client,
|
|
83
|
+
?request_options: OpenAI::request_opts?
|
|
84
|
+
) -> self
|
|
85
|
+
def close: -> void
|
|
86
|
+
|
|
87
|
+
# @api private
|
|
88
|
+
def initialize: (
|
|
89
|
+
task: untyped,
|
|
90
|
+
client: OpenAI::Client,
|
|
91
|
+
limits: SessionLimits,
|
|
92
|
+
request_options: OpenAI::request_opts?,
|
|
93
|
+
websocket_base_url: String?,
|
|
94
|
+
transport: top,
|
|
95
|
+
transport_options: ::Hash[Symbol, top]
|
|
96
|
+
) -> void
|
|
97
|
+
|
|
98
|
+
# @api private
|
|
99
|
+
def start: -> void
|
|
100
|
+
|
|
101
|
+
# @api private
|
|
102
|
+
def encode_client_event: (
|
|
103
|
+
connection_client_event event
|
|
104
|
+
) -> ::Hash[Symbol, untyped]
|
|
105
|
+
|
|
106
|
+
# @api private
|
|
107
|
+
def send_event: (connection_client_event event) -> void
|
|
108
|
+
|
|
109
|
+
# @api private
|
|
110
|
+
def check_reader!: -> void
|
|
111
|
+
|
|
112
|
+
# @api private
|
|
113
|
+
def assert_owner!: -> void
|
|
114
|
+
|
|
115
|
+
# @api private
|
|
116
|
+
def consumed: (Integer bytes) -> void
|
|
117
|
+
|
|
118
|
+
# @api private
|
|
119
|
+
def detach: (SessionLane value) -> void
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
@@ -5,6 +5,7 @@ module OpenAI
|
|
|
5
5
|
type session_update_params =
|
|
6
6
|
{
|
|
7
7
|
session_id: String,
|
|
8
|
+
?agent: OpenAI::Beta::Agents::SessionUpdateParams::Agent,
|
|
8
9
|
?metadata: ::Hash[Symbol, String]?,
|
|
9
10
|
?request_options: OpenAI::request_opts
|
|
10
11
|
}
|
|
@@ -15,19 +16,117 @@ module OpenAI
|
|
|
15
16
|
|
|
16
17
|
attr_accessor session_id: String
|
|
17
18
|
|
|
19
|
+
attr_reader agent: OpenAI::Beta::Agents::SessionUpdateParams::Agent?
|
|
20
|
+
|
|
21
|
+
def agent=: (
|
|
22
|
+
OpenAI::Beta::Agents::SessionUpdateParams::Agent
|
|
23
|
+
) -> OpenAI::Beta::Agents::SessionUpdateParams::Agent
|
|
24
|
+
|
|
18
25
|
attr_accessor metadata: ::Hash[Symbol, String]?
|
|
19
26
|
|
|
20
27
|
def initialize: (
|
|
21
28
|
session_id: String,
|
|
29
|
+
?agent: OpenAI::Beta::Agents::SessionUpdateParams::Agent,
|
|
22
30
|
?metadata: ::Hash[Symbol, String]?,
|
|
23
31
|
?request_options: OpenAI::request_opts
|
|
24
32
|
) -> void
|
|
25
33
|
|
|
26
34
|
def to_hash: -> {
|
|
27
35
|
session_id: String,
|
|
36
|
+
?agent: OpenAI::Beta::Agents::SessionUpdateParams::Agent,
|
|
28
37
|
?metadata: ::Hash[Symbol, String]?,
|
|
29
38
|
?request_options: OpenAI::RequestOptions
|
|
30
39
|
}
|
|
40
|
+
|
|
41
|
+
type agent =
|
|
42
|
+
{
|
|
43
|
+
?model: String,
|
|
44
|
+
?reasoning: OpenAI::Beta::Agents::SessionUpdateParams::Agent::Reasoning,
|
|
45
|
+
?service_tier: OpenAI::Models::Beta::Agents::SessionUpdateParams::Agent::service_tier?
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
class Agent < OpenAI::Internal::Type::BaseModel
|
|
49
|
+
attr_reader model: String?
|
|
50
|
+
|
|
51
|
+
def model=: (String) -> String
|
|
52
|
+
|
|
53
|
+
attr_reader reasoning: OpenAI::Beta::Agents::SessionUpdateParams::Agent::Reasoning?
|
|
54
|
+
|
|
55
|
+
def reasoning=: (
|
|
56
|
+
OpenAI::Beta::Agents::SessionUpdateParams::Agent::Reasoning
|
|
57
|
+
) -> OpenAI::Beta::Agents::SessionUpdateParams::Agent::Reasoning
|
|
58
|
+
|
|
59
|
+
attr_accessor service_tier: OpenAI::Models::Beta::Agents::SessionUpdateParams::Agent::service_tier?
|
|
60
|
+
|
|
61
|
+
def initialize: (
|
|
62
|
+
?model: String,
|
|
63
|
+
?reasoning: OpenAI::Beta::Agents::SessionUpdateParams::Agent::Reasoning,
|
|
64
|
+
?service_tier: OpenAI::Models::Beta::Agents::SessionUpdateParams::Agent::service_tier?
|
|
65
|
+
) -> void
|
|
66
|
+
|
|
67
|
+
def to_hash: -> {
|
|
68
|
+
?model: String,
|
|
69
|
+
?reasoning: OpenAI::Beta::Agents::SessionUpdateParams::Agent::Reasoning,
|
|
70
|
+
?service_tier: OpenAI::Models::Beta::Agents::SessionUpdateParams::Agent::service_tier?
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
type reasoning =
|
|
74
|
+
{
|
|
75
|
+
?effort: OpenAI::Models::Beta::Agents::SessionUpdateParams::Agent::Reasoning::effort?
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
class Reasoning < OpenAI::Internal::Type::BaseModel
|
|
79
|
+
attr_accessor effort: OpenAI::Models::Beta::Agents::SessionUpdateParams::Agent::Reasoning::effort?
|
|
80
|
+
|
|
81
|
+
def initialize: (
|
|
82
|
+
?effort: OpenAI::Models::Beta::Agents::SessionUpdateParams::Agent::Reasoning::effort?
|
|
83
|
+
) -> void
|
|
84
|
+
|
|
85
|
+
def to_hash: -> {
|
|
86
|
+
?effort: OpenAI::Models::Beta::Agents::SessionUpdateParams::Agent::Reasoning::effort?
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
type effort =
|
|
90
|
+
:none | :minimal | :low | :medium | :high | :xhigh | :max
|
|
91
|
+
|
|
92
|
+
module Effort
|
|
93
|
+
extend OpenAI::Internal::Type::Enum
|
|
94
|
+
|
|
95
|
+
NONE: :none
|
|
96
|
+
MINIMAL: :minimal
|
|
97
|
+
LOW: :low
|
|
98
|
+
MEDIUM: :medium
|
|
99
|
+
HIGH: :high
|
|
100
|
+
XHIGH: :xhigh
|
|
101
|
+
MAX: :max
|
|
102
|
+
|
|
103
|
+
def self?.values: -> ::Array[OpenAI::Models::Beta::Agents::SessionUpdateParams::Agent::Reasoning::effort]
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
type service_tier = :auto | :default | :flex | :priority | :fast
|
|
108
|
+
|
|
109
|
+
module ServiceTier
|
|
110
|
+
extend OpenAI::Internal::Type::Enum
|
|
111
|
+
|
|
112
|
+
# Selects the service tier automatically.
|
|
113
|
+
AUTO: :auto
|
|
114
|
+
|
|
115
|
+
# Uses the default service tier.
|
|
116
|
+
DEFAULT: :default
|
|
117
|
+
|
|
118
|
+
# Uses the flex service tier.
|
|
119
|
+
FLEX: :flex
|
|
120
|
+
|
|
121
|
+
# Uses the priority service tier.
|
|
122
|
+
PRIORITY: :priority
|
|
123
|
+
|
|
124
|
+
# Uses the fast service tier.
|
|
125
|
+
FAST: :fast
|
|
126
|
+
|
|
127
|
+
def self?.values: -> ::Array[OpenAI::Models::Beta::Agents::SessionUpdateParams::Agent::service_tier]
|
|
128
|
+
end
|
|
129
|
+
end
|
|
31
130
|
end
|
|
32
131
|
end
|
|
33
132
|
end
|
|
@@ -278,7 +278,6 @@ module OpenAI
|
|
|
278
278
|
| :"gpt-5.1"
|
|
279
279
|
| :"gpt-5.1-2025-11-13"
|
|
280
280
|
| :"gpt-5.1-codex"
|
|
281
|
-
| :"gpt-5.1-mini"
|
|
282
281
|
| :"gpt-5.1-chat-latest"
|
|
283
282
|
| :"gpt-5"
|
|
284
283
|
| :"gpt-5-mini"
|
|
@@ -309,6 +308,8 @@ module OpenAI
|
|
|
309
308
|
| :"gpt-4o-2024-11-20"
|
|
310
309
|
| :"gpt-4o-2024-08-06"
|
|
311
310
|
| :"gpt-4o-2024-05-13"
|
|
311
|
+
| :"gpt-audio-mini"
|
|
312
|
+
| :"gpt-audio-mini-2025-12-15"
|
|
312
313
|
| :"gpt-4o-audio-preview"
|
|
313
314
|
| :"gpt-4o-audio-preview-2024-10-01"
|
|
314
315
|
| :"gpt-4o-audio-preview-2024-12-17"
|
|
@@ -342,6 +343,7 @@ module OpenAI
|
|
|
342
343
|
| :"gpt-3.5-turbo-1106"
|
|
343
344
|
| :"gpt-3.5-turbo-0125"
|
|
344
345
|
| :"gpt-3.5-turbo-16k-0613"
|
|
346
|
+
| :"gpt-5.1-mini"
|
|
345
347
|
| :"o1-pro"
|
|
346
348
|
| :"o1-pro-2025-03-19"
|
|
347
349
|
| :"o3-pro"
|
|
@@ -388,7 +390,6 @@ module OpenAI
|
|
|
388
390
|
GPT_5_1: :"gpt-5.1"
|
|
389
391
|
GPT_5_1_2025_11_13: :"gpt-5.1-2025-11-13"
|
|
390
392
|
GPT_5_1_CODEX: :"gpt-5.1-codex"
|
|
391
|
-
GPT_5_1_MINI: :"gpt-5.1-mini"
|
|
392
393
|
GPT_5_1_CHAT_LATEST: :"gpt-5.1-chat-latest"
|
|
393
394
|
GPT_5: :"gpt-5"
|
|
394
395
|
GPT_5_MINI: :"gpt-5-mini"
|
|
@@ -419,6 +420,8 @@ module OpenAI
|
|
|
419
420
|
GPT_4O_2024_11_20: :"gpt-4o-2024-11-20"
|
|
420
421
|
GPT_4O_2024_08_06: :"gpt-4o-2024-08-06"
|
|
421
422
|
GPT_4O_2024_05_13: :"gpt-4o-2024-05-13"
|
|
423
|
+
GPT_AUDIO_MINI: :"gpt-audio-mini"
|
|
424
|
+
GPT_AUDIO_MINI_2025_12_15: :"gpt-audio-mini-2025-12-15"
|
|
422
425
|
GPT_4O_AUDIO_PREVIEW: :"gpt-4o-audio-preview"
|
|
423
426
|
GPT_4O_AUDIO_PREVIEW_2024_10_01: :"gpt-4o-audio-preview-2024-10-01"
|
|
424
427
|
GPT_4O_AUDIO_PREVIEW_2024_12_17: :"gpt-4o-audio-preview-2024-12-17"
|
|
@@ -452,6 +455,7 @@ module OpenAI
|
|
|
452
455
|
GPT_3_5_TURBO_1106: :"gpt-3.5-turbo-1106"
|
|
453
456
|
GPT_3_5_TURBO_0125: :"gpt-3.5-turbo-0125"
|
|
454
457
|
GPT_3_5_TURBO_16K_0613: :"gpt-3.5-turbo-16k-0613"
|
|
458
|
+
GPT_5_1_MINI: :"gpt-5.1-mini"
|
|
455
459
|
O1_PRO: :"o1-pro"
|
|
456
460
|
O1_PRO_2025_03_19: :"o1-pro-2025-03-19"
|
|
457
461
|
O3_PRO: :"o3-pro"
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
module OpenAI
|
|
2
|
+
module Models
|
|
3
|
+
class BetaResponseCompactionCompactingEvent = Beta::BetaResponseCompactionCompactingEvent
|
|
4
|
+
|
|
5
|
+
module Beta
|
|
6
|
+
type beta_response_compaction_compacting_event =
|
|
7
|
+
{
|
|
8
|
+
item_id: String,
|
|
9
|
+
output_index: Integer,
|
|
10
|
+
sequence_number: Integer,
|
|
11
|
+
?type: :"response.compaction.compacting",
|
|
12
|
+
?agent: OpenAI::Beta::BetaResponseCompactionCompactingEvent::Agent
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
class BetaResponseCompactionCompactingEvent < OpenAI::Internal::Type::BaseModel
|
|
16
|
+
attr_accessor item_id: String
|
|
17
|
+
|
|
18
|
+
attr_accessor output_index: Integer
|
|
19
|
+
|
|
20
|
+
attr_accessor sequence_number: Integer
|
|
21
|
+
|
|
22
|
+
attr_accessor type: :"response.compaction.compacting"
|
|
23
|
+
|
|
24
|
+
attr_reader agent: OpenAI::Beta::BetaResponseCompactionCompactingEvent::Agent?
|
|
25
|
+
|
|
26
|
+
def agent=: (
|
|
27
|
+
OpenAI::Beta::BetaResponseCompactionCompactingEvent::Agent
|
|
28
|
+
) -> OpenAI::Beta::BetaResponseCompactionCompactingEvent::Agent
|
|
29
|
+
|
|
30
|
+
def initialize: (
|
|
31
|
+
item_id: String,
|
|
32
|
+
output_index: Integer,
|
|
33
|
+
sequence_number: Integer,
|
|
34
|
+
?agent: OpenAI::Beta::BetaResponseCompactionCompactingEvent::Agent,
|
|
35
|
+
?type: :"response.compaction.compacting"
|
|
36
|
+
) -> void
|
|
37
|
+
|
|
38
|
+
def to_hash: -> {
|
|
39
|
+
item_id: String,
|
|
40
|
+
output_index: Integer,
|
|
41
|
+
sequence_number: Integer,
|
|
42
|
+
?type: :"response.compaction.compacting",
|
|
43
|
+
?agent: OpenAI::Beta::BetaResponseCompactionCompactingEvent::Agent
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
type agent = { agent_name: String }
|
|
47
|
+
|
|
48
|
+
class Agent < OpenAI::Internal::Type::BaseModel
|
|
49
|
+
attr_accessor agent_name: String
|
|
50
|
+
|
|
51
|
+
def initialize: (agent_name: String) -> void
|
|
52
|
+
|
|
53
|
+
def to_hash: -> { agent_name: String }
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -13,6 +13,7 @@ module OpenAI
|
|
|
13
13
|
| OpenAI::Beta::BetaResponseCodeInterpreterCallCompletedEvent
|
|
14
14
|
| OpenAI::Beta::BetaResponseCodeInterpreterCallInProgressEvent
|
|
15
15
|
| OpenAI::Beta::BetaResponseCodeInterpreterCallInterpretingEvent
|
|
16
|
+
| OpenAI::Beta::BetaResponseCompactionCompactingEvent
|
|
16
17
|
| OpenAI::Beta::BetaResponseCompletedEvent
|
|
17
18
|
| OpenAI::Beta::BetaResponseContentPartAddedEvent
|
|
18
19
|
| OpenAI::Beta::BetaResponseContentPartDoneEvent
|
|
@@ -271,7 +271,6 @@ module OpenAI
|
|
|
271
271
|
| :"gpt-5.1"
|
|
272
272
|
| :"gpt-5.1-2025-11-13"
|
|
273
273
|
| :"gpt-5.1-codex"
|
|
274
|
-
| :"gpt-5.1-mini"
|
|
275
274
|
| :"gpt-5.1-chat-latest"
|
|
276
275
|
| :"gpt-5"
|
|
277
276
|
| :"gpt-5-mini"
|
|
@@ -302,6 +301,8 @@ module OpenAI
|
|
|
302
301
|
| :"gpt-4o-2024-11-20"
|
|
303
302
|
| :"gpt-4o-2024-08-06"
|
|
304
303
|
| :"gpt-4o-2024-05-13"
|
|
304
|
+
| :"gpt-audio-mini"
|
|
305
|
+
| :"gpt-audio-mini-2025-12-15"
|
|
305
306
|
| :"gpt-4o-audio-preview"
|
|
306
307
|
| :"gpt-4o-audio-preview-2024-10-01"
|
|
307
308
|
| :"gpt-4o-audio-preview-2024-12-17"
|
|
@@ -335,6 +336,7 @@ module OpenAI
|
|
|
335
336
|
| :"gpt-3.5-turbo-1106"
|
|
336
337
|
| :"gpt-3.5-turbo-0125"
|
|
337
338
|
| :"gpt-3.5-turbo-16k-0613"
|
|
339
|
+
| :"gpt-5.1-mini"
|
|
338
340
|
| :"o1-pro"
|
|
339
341
|
| :"o1-pro-2025-03-19"
|
|
340
342
|
| :"o3-pro"
|
|
@@ -381,7 +383,6 @@ module OpenAI
|
|
|
381
383
|
GPT_5_1: :"gpt-5.1"
|
|
382
384
|
GPT_5_1_2025_11_13: :"gpt-5.1-2025-11-13"
|
|
383
385
|
GPT_5_1_CODEX: :"gpt-5.1-codex"
|
|
384
|
-
GPT_5_1_MINI: :"gpt-5.1-mini"
|
|
385
386
|
GPT_5_1_CHAT_LATEST: :"gpt-5.1-chat-latest"
|
|
386
387
|
GPT_5: :"gpt-5"
|
|
387
388
|
GPT_5_MINI: :"gpt-5-mini"
|
|
@@ -412,6 +413,8 @@ module OpenAI
|
|
|
412
413
|
GPT_4O_2024_11_20: :"gpt-4o-2024-11-20"
|
|
413
414
|
GPT_4O_2024_08_06: :"gpt-4o-2024-08-06"
|
|
414
415
|
GPT_4O_2024_05_13: :"gpt-4o-2024-05-13"
|
|
416
|
+
GPT_AUDIO_MINI: :"gpt-audio-mini"
|
|
417
|
+
GPT_AUDIO_MINI_2025_12_15: :"gpt-audio-mini-2025-12-15"
|
|
415
418
|
GPT_4O_AUDIO_PREVIEW: :"gpt-4o-audio-preview"
|
|
416
419
|
GPT_4O_AUDIO_PREVIEW_2024_10_01: :"gpt-4o-audio-preview-2024-10-01"
|
|
417
420
|
GPT_4O_AUDIO_PREVIEW_2024_12_17: :"gpt-4o-audio-preview-2024-12-17"
|
|
@@ -445,6 +448,7 @@ module OpenAI
|
|
|
445
448
|
GPT_3_5_TURBO_1106: :"gpt-3.5-turbo-1106"
|
|
446
449
|
GPT_3_5_TURBO_0125: :"gpt-3.5-turbo-0125"
|
|
447
450
|
GPT_3_5_TURBO_16K_0613: :"gpt-3.5-turbo-16k-0613"
|
|
451
|
+
GPT_5_1_MINI: :"gpt-5.1-mini"
|
|
448
452
|
O1_PRO: :"o1-pro"
|
|
449
453
|
O1_PRO_2025_03_19: :"o1-pro-2025-03-19"
|
|
450
454
|
O3_PRO: :"o3-pro"
|
|
@@ -591,6 +595,7 @@ module OpenAI
|
|
|
591
595
|
{
|
|
592
596
|
?comparison_response_id: String?,
|
|
593
597
|
?mode: OpenAI::Models::Beta::BetaResponsesClientEvent::ResponseCreate::PromptCacheOptions::mode,
|
|
598
|
+
?prewarm: bool,
|
|
594
599
|
?ttl: OpenAI::Models::Beta::BetaResponsesClientEvent::ResponseCreate::PromptCacheOptions::ttl
|
|
595
600
|
}
|
|
596
601
|
|
|
@@ -603,6 +608,10 @@ module OpenAI
|
|
|
603
608
|
OpenAI::Models::Beta::BetaResponsesClientEvent::ResponseCreate::PromptCacheOptions::mode
|
|
604
609
|
) -> OpenAI::Models::Beta::BetaResponsesClientEvent::ResponseCreate::PromptCacheOptions::mode
|
|
605
610
|
|
|
611
|
+
attr_reader prewarm: bool?
|
|
612
|
+
|
|
613
|
+
def prewarm=: (bool) -> bool
|
|
614
|
+
|
|
606
615
|
attr_reader ttl: OpenAI::Models::Beta::BetaResponsesClientEvent::ResponseCreate::PromptCacheOptions::ttl?
|
|
607
616
|
|
|
608
617
|
def ttl=: (
|
|
@@ -612,12 +621,14 @@ module OpenAI
|
|
|
612
621
|
def initialize: (
|
|
613
622
|
?comparison_response_id: String?,
|
|
614
623
|
?mode: OpenAI::Models::Beta::BetaResponsesClientEvent::ResponseCreate::PromptCacheOptions::mode,
|
|
624
|
+
?prewarm: bool,
|
|
615
625
|
?ttl: OpenAI::Models::Beta::BetaResponsesClientEvent::ResponseCreate::PromptCacheOptions::ttl
|
|
616
626
|
) -> void
|
|
617
627
|
|
|
618
628
|
def to_hash: -> {
|
|
619
629
|
?comparison_response_id: String?,
|
|
620
630
|
?mode: OpenAI::Models::Beta::BetaResponsesClientEvent::ResponseCreate::PromptCacheOptions::mode,
|
|
631
|
+
?prewarm: bool,
|
|
621
632
|
?ttl: OpenAI::Models::Beta::BetaResponsesClientEvent::ResponseCreate::PromptCacheOptions::ttl
|
|
622
633
|
}
|
|
623
634
|
|
|
@@ -19,6 +19,7 @@ module OpenAI
|
|
|
19
19
|
| OpenAI::Beta::BetaResponsesServerEvent::BetaResponseCodeInterpreterCallWsCompleted
|
|
20
20
|
| OpenAI::Beta::BetaResponsesServerEvent::BetaResponseCodeInterpreterCallInWsProgress
|
|
21
21
|
| OpenAI::Beta::BetaResponsesServerEvent::BetaResponseCodeInterpreterCallWsInterpreting
|
|
22
|
+
| OpenAI::Beta::BetaResponsesServerEvent::BetaResponseCompactionWsCompacting
|
|
22
23
|
| OpenAI::Beta::BetaResponsesServerEvent::BetaResponseWsCompleted
|
|
23
24
|
| OpenAI::Beta::BetaResponsesServerEvent::BetaResponseContentPartWsAdded
|
|
24
25
|
| OpenAI::Beta::BetaResponsesServerEvent::BetaResponseContentPartWsDone
|
|
@@ -365,6 +366,40 @@ module OpenAI
|
|
|
365
366
|
}
|
|
366
367
|
end
|
|
367
368
|
|
|
369
|
+
type beta_response_compaction_ws_compacting =
|
|
370
|
+
{
|
|
371
|
+
item_id: String,
|
|
372
|
+
output_index: Integer,
|
|
373
|
+
sequence_number: Integer,
|
|
374
|
+
?type: :"response.compaction.compacting",
|
|
375
|
+
?agent: OpenAI::Beta::BetaResponseCompactionCompactingEvent::Agent,
|
|
376
|
+
?stream_id: String
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
class BetaResponseCompactionWsCompacting < OpenAI::Models::Beta::BetaResponseCompactionCompactingEvent
|
|
380
|
+
def stream_id: -> String?
|
|
381
|
+
|
|
382
|
+
def stream_id=: (String _) -> String
|
|
383
|
+
|
|
384
|
+
def initialize: (
|
|
385
|
+
item_id: String,
|
|
386
|
+
output_index: Integer,
|
|
387
|
+
sequence_number: Integer,
|
|
388
|
+
?agent: OpenAI::Beta::BetaResponseCompactionCompactingEvent::Agent,
|
|
389
|
+
?stream_id: String,
|
|
390
|
+
?type: :"response.compaction.compacting"
|
|
391
|
+
) -> void
|
|
392
|
+
|
|
393
|
+
def to_hash: -> {
|
|
394
|
+
item_id: String,
|
|
395
|
+
output_index: Integer,
|
|
396
|
+
sequence_number: Integer,
|
|
397
|
+
?type: :"response.compaction.compacting",
|
|
398
|
+
?agent: OpenAI::Beta::BetaResponseCompactionCompactingEvent::Agent,
|
|
399
|
+
?stream_id: String
|
|
400
|
+
}
|
|
401
|
+
end
|
|
402
|
+
|
|
368
403
|
type beta_response_ws_completed =
|
|
369
404
|
{
|
|
370
405
|
response: OpenAI::Beta::BetaResponse,
|