openai 0.105.0 → 0.107.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.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +67 -0
  3. data/README.md +1 -1
  4. data/lib/openai/helpers/live/websocket.rb +12 -141
  5. data/lib/openai/helpers/local_audio/process.rb +13 -3
  6. data/lib/openai/helpers/models/embedding.rb +42 -0
  7. data/lib/openai/helpers/realtime/connection.rb +22 -5
  8. data/lib/openai/helpers/realtime/recovery.rb +11 -5
  9. data/lib/openai/helpers/realtime/translation.rb +37 -169
  10. data/lib/openai/helpers/realtime/unknown_server_event.rb +5 -12
  11. data/lib/openai/helpers/responses_websocket/connection.rb +56 -35
  12. data/lib/openai/helpers/responses_websocket/unknown_server_event.rb +2 -14
  13. data/lib/openai/helpers/websocket/async_websocket_transport.rb +8 -6
  14. data/lib/openai/helpers/websocket/client_request.rb +1 -1
  15. data/lib/openai/helpers/websocket/connection.rb +21 -10
  16. data/lib/openai/helpers/websocket/connection_manager.rb +2 -1
  17. data/lib/openai/helpers/websocket/protocol.rb +160 -0
  18. data/lib/openai/helpers/websocket/typed_connection.rb +22 -16
  19. data/lib/openai/helpers/websocket/typed_resource.rb +15 -0
  20. data/lib/openai/internal/transport/base_client.rb +1 -1
  21. data/lib/openai/models/admin/organization/external_storage_configuration.rb +1 -0
  22. data/lib/openai/models/admin/organization/usage_audio_speeches_response.rb +12 -1
  23. data/lib/openai/models/admin/organization/usage_audio_transcriptions_response.rb +12 -1
  24. data/lib/openai/models/admin/organization/usage_code_interpreter_sessions_response.rb +12 -1
  25. data/lib/openai/models/admin/organization/usage_completions_response.rb +12 -1
  26. data/lib/openai/models/admin/organization/usage_costs_response.rb +12 -1
  27. data/lib/openai/models/admin/organization/usage_decisions_response.rb +12 -1
  28. data/lib/openai/models/admin/organization/usage_embeddings_response.rb +12 -1
  29. data/lib/openai/models/admin/organization/usage_file_search_calls_response.rb +12 -1
  30. data/lib/openai/models/admin/organization/usage_images_response.rb +12 -1
  31. data/lib/openai/models/admin/organization/usage_moderations_response.rb +12 -1
  32. data/lib/openai/models/admin/organization/usage_vector_stores_response.rb +12 -1
  33. data/lib/openai/models/admin/organization/usage_web_search_calls_response.rb +12 -1
  34. data/lib/openai/models/beta/agent_create_params.rb +3 -0
  35. data/lib/openai/models/beta/agent_update_params.rb +3 -0
  36. data/lib/openai/models/beta/agents/session_create_params.rb +3 -0
  37. data/lib/openai/models/beta/agents/session_update_params.rb +3 -0
  38. data/lib/openai/models/beta/assistant_update_params.rb +12 -0
  39. data/lib/openai/models/beta/beta_response.rb +12 -0
  40. data/lib/openai/models/beta/beta_response_input_item.rb +10 -1
  41. data/lib/openai/models/beta/beta_responses_client_event.rb +12 -0
  42. data/lib/openai/models/beta/response_compact_params.rb +12 -0
  43. data/lib/openai/models/beta/response_create_params.rb +12 -0
  44. data/lib/openai/models/chat_model.rb +12 -0
  45. data/lib/openai/models/decision_create_params.rb +112 -1
  46. data/lib/openai/models/decision_input_image.rb +14 -1
  47. data/lib/openai/models/decision_input_text.rb +15 -1
  48. data/lib/openai/models/decision_prompt_cache_breakpoint.rb +21 -0
  49. data/lib/openai/models/live/sideband_server_event.rb +243 -3
  50. data/lib/openai/models/responses/response_compact_params.rb +12 -0
  51. data/lib/openai/models/responses/response_input_item.rb +10 -1
  52. data/lib/openai/models.rb +2 -0
  53. data/lib/openai/resources/beta/responses.rb +19 -0
  54. data/lib/openai/resources/decisions.rb +15 -1
  55. data/lib/openai/version.rb +1 -1
  56. data/lib/openai.rb +2 -0
  57. data/rbi/openai/client.rbi +1 -8
  58. data/rbi/openai/helpers/realtime/translation.rbi +0 -5
  59. data/rbi/openai/helpers/realtime/unknown_server_event.rbi +6 -0
  60. data/rbi/openai/helpers/websocket.rbi +44 -6
  61. data/rbi/openai/internal/transport/base_client.rbi +2 -6
  62. data/rbi/openai/models/admin/organization/external_storage_configuration.rbi +1 -0
  63. data/rbi/openai/models/admin/organization/usage_audio_speeches_response.rbi +12 -0
  64. data/rbi/openai/models/admin/organization/usage_audio_transcriptions_response.rbi +12 -0
  65. data/rbi/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbi +12 -0
  66. data/rbi/openai/models/admin/organization/usage_completions_response.rbi +12 -0
  67. data/rbi/openai/models/admin/organization/usage_costs_response.rbi +12 -0
  68. data/rbi/openai/models/admin/organization/usage_decisions_response.rbi +12 -0
  69. data/rbi/openai/models/admin/organization/usage_embeddings_response.rbi +12 -0
  70. data/rbi/openai/models/admin/organization/usage_file_search_calls_response.rbi +12 -0
  71. data/rbi/openai/models/admin/organization/usage_images_response.rbi +12 -0
  72. data/rbi/openai/models/admin/organization/usage_moderations_response.rbi +12 -0
  73. data/rbi/openai/models/admin/organization/usage_vector_stores_response.rbi +12 -0
  74. data/rbi/openai/models/admin/organization/usage_web_search_calls_response.rbi +12 -0
  75. data/rbi/openai/models/beta/agent_create_params.rbi +3 -0
  76. data/rbi/openai/models/beta/agent_update_params.rbi +3 -0
  77. data/rbi/openai/models/beta/agents/session_create_params.rbi +3 -0
  78. data/rbi/openai/models/beta/agents/session_update_params.rbi +3 -0
  79. data/rbi/openai/models/beta/beta_response_input_item.rbi +14 -1
  80. data/rbi/openai/models/decision_create_params.rbi +146 -0
  81. data/rbi/openai/models/decision_input_image.rbi +22 -1
  82. data/rbi/openai/models/decision_input_text.rbi +21 -1
  83. data/rbi/openai/models/decision_prompt_cache_breakpoint.rbi +48 -0
  84. data/rbi/openai/models/live/output_audio_delta_event.rbi +1 -1
  85. data/rbi/openai/models/live/sideband_server_event.rbi +406 -3
  86. data/rbi/openai/models/responses/response_input_item.rbi +10 -1
  87. data/rbi/openai/models.rbi +2 -0
  88. data/rbi/openai/resources/beta/responses.rbi +17 -0
  89. data/rbi/openai/resources/decisions.rbi +14 -0
  90. data/realtime.md +22 -3
  91. data/sig/openai/client.rbs +1 -1
  92. data/sig/openai/helpers/realtime/translation.rbs +0 -2
  93. data/sig/openai/helpers/realtime/unknown_server_event.rbs +2 -0
  94. data/sig/openai/helpers/websocket.rbs +23 -6
  95. data/sig/openai/models/admin/organization/external_storage_configuration.rbs +2 -1
  96. data/sig/openai/models/admin/organization/usage_audio_speeches_response.rbs +10 -0
  97. data/sig/openai/models/admin/organization/usage_audio_transcriptions_response.rbs +10 -0
  98. data/sig/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbs +10 -0
  99. data/sig/openai/models/admin/organization/usage_completions_response.rbs +10 -0
  100. data/sig/openai/models/admin/organization/usage_costs_response.rbs +10 -0
  101. data/sig/openai/models/admin/organization/usage_decisions_response.rbs +10 -0
  102. data/sig/openai/models/admin/organization/usage_embeddings_response.rbs +10 -0
  103. data/sig/openai/models/admin/organization/usage_file_search_calls_response.rbs +10 -0
  104. data/sig/openai/models/admin/organization/usage_images_response.rbs +10 -0
  105. data/sig/openai/models/admin/organization/usage_moderations_response.rbs +10 -0
  106. data/sig/openai/models/admin/organization/usage_vector_stores_response.rbs +10 -0
  107. data/sig/openai/models/admin/organization/usage_web_search_calls_response.rbs +10 -0
  108. data/sig/openai/models/beta/agent_create_params.rbs +5 -1
  109. data/sig/openai/models/beta/agent_update_params.rbs +5 -1
  110. data/sig/openai/models/beta/agents/session_create_params.rbs +5 -1
  111. data/sig/openai/models/beta/agents/session_update_params.rbs +5 -1
  112. data/sig/openai/models/beta/beta_response_input_item.rbs +8 -0
  113. data/sig/openai/models/decision_create_params.rbs +106 -0
  114. data/sig/openai/models/decision_input_image.rbs +18 -2
  115. data/sig/openai/models/decision_input_text.rbs +29 -3
  116. data/sig/openai/models/decision_prompt_cache_breakpoint.rbs +16 -0
  117. data/sig/openai/models/live/sideband_server_event.rbs +225 -0
  118. data/sig/openai/models/responses/response_input_item.rbs +8 -3
  119. data/sig/openai/models.rbs +2 -0
  120. data/sig/openai/resources/beta/responses.rbs +7 -0
  121. data/sig/openai/resources/decisions.rbs +3 -0
  122. metadata +6 -1
@@ -91,6 +91,7 @@ module OpenAI
91
91
  ?batch: bool?,
92
92
  ?input_audio_tokens: Integer,
93
93
  ?:input_cache_write_12h_tokens => Integer,
94
+ ?:input_cache_write_30m_tokens => Integer?,
94
95
  ?input_cache_write_tokens: Integer,
95
96
  ?input_cached_audio_tokens: Integer,
96
97
  ?input_cached_image_tokens: Integer,
@@ -152,6 +153,10 @@ module OpenAI
152
153
  # retention period.
153
154
  def input_cache_write_12h_tokens=: (Integer) -> Integer
154
155
 
156
+ # The aggregated number of input tokens written to the cache with a 30-minute
157
+ # retention period. May be absent or null for older responses.
158
+ attr_accessor input_cache_write_30m_tokens: Integer?
159
+
155
160
  # The aggregated number of input tokens written to the cache with a 30-minute
156
161
  # retention period.
157
162
  attr_reader input_cache_write_tokens: Integer?
@@ -268,6 +273,9 @@ module OpenAI
268
273
  # @param input_cache_write_12h_tokens
269
274
  # The aggregated number of input tokens written to the cache with a 12-hour
270
275
  # retention period.
276
+ # @param input_cache_write_30m_tokens
277
+ # The aggregated number of input tokens written to the cache with a 30-minute
278
+ # retention period. May be absent or null for older responses.
271
279
  # @param input_cache_write_tokens
272
280
  # The aggregated number of input tokens written to the cache with a 30-minute
273
281
  # retention period.
@@ -315,6 +323,7 @@ module OpenAI
315
323
  ?batch: bool?,
316
324
  ?input_audio_tokens: Integer,
317
325
  ?input_cache_write_12h_tokens: Integer,
326
+ ?input_cache_write_30m_tokens: Integer?,
318
327
  ?input_cache_write_tokens: Integer,
319
328
  ?input_cached_audio_tokens: Integer,
320
329
  ?input_cached_image_tokens: Integer,
@@ -343,6 +352,7 @@ module OpenAI
343
352
  ?batch: bool?,
344
353
  ?input_audio_tokens: Integer,
345
354
  ?:input_cache_write_12h_tokens => Integer,
355
+ ?:input_cache_write_30m_tokens => Integer?,
346
356
  ?input_cache_write_tokens: Integer,
347
357
  ?input_cached_audio_tokens: Integer,
348
358
  ?input_cached_image_tokens: Integer,
@@ -100,7 +100,8 @@ module OpenAI
100
100
  ?request_options: OpenAI::RequestOptions
101
101
  }
102
102
 
103
- type service_tier = :auto | :default | :flex | :priority | :fast
103
+ type service_tier =
104
+ :auto | :default | :flex | :priority | :fast | :ultrafast
104
105
 
105
106
  module ServiceTier
106
107
  extend OpenAI::Internal::Type::Enum
@@ -120,6 +121,9 @@ module OpenAI
120
121
  # Uses the fast service tier.
121
122
  FAST: :fast
122
123
 
124
+ # Uses the ultrafast service tier.
125
+ ULTRAFAST: :ultrafast
126
+
123
127
  def self?.values: -> ::Array[OpenAI::Models::Beta::AgentCreateParams::service_tier]
124
128
  end
125
129
  end
@@ -108,7 +108,8 @@ module OpenAI
108
108
  ?request_options: OpenAI::RequestOptions
109
109
  }
110
110
 
111
- type service_tier = :auto | :default | :flex | :priority | :fast
111
+ type service_tier =
112
+ :auto | :default | :flex | :priority | :fast | :ultrafast
112
113
 
113
114
  module ServiceTier
114
115
  extend OpenAI::Internal::Type::Enum
@@ -128,6 +129,9 @@ module OpenAI
128
129
  # Uses the fast service tier.
129
130
  FAST: :fast
130
131
 
132
+ # Uses the ultrafast service tier.
133
+ ULTRAFAST: :ultrafast
134
+
131
135
  def self?.values: -> ::Array[OpenAI::Models::Beta::AgentUpdateParams::service_tier]
132
136
  end
133
137
  end
@@ -177,7 +177,8 @@ module OpenAI
177
177
  ?tools: ::Array[OpenAI::Models::Beta::agent_tool_param]?
178
178
  }
179
179
 
180
- type service_tier = :auto | :default | :flex | :priority | :fast
180
+ type service_tier =
181
+ :auto | :default | :flex | :priority | :fast | :ultrafast
181
182
 
182
183
  module ServiceTier
183
184
  extend OpenAI::Internal::Type::Enum
@@ -197,6 +198,9 @@ module OpenAI
197
198
  # Uses the fast service tier.
198
199
  FAST: :fast
199
200
 
201
+ # Uses the ultrafast service tier.
202
+ ULTRAFAST: :ultrafast
203
+
200
204
  def self?.values: -> ::Array[OpenAI::Models::Beta::Agents::SessionCreateParams::Agent::service_tier]
201
205
  end
202
206
  end
@@ -139,7 +139,8 @@ module OpenAI
139
139
  end
140
140
  end
141
141
 
142
- type service_tier = :auto | :default | :flex | :priority | :fast
142
+ type service_tier =
143
+ :auto | :default | :flex | :priority | :fast | :ultrafast
143
144
 
144
145
  module ServiceTier
145
146
  extend OpenAI::Internal::Type::Enum
@@ -159,6 +160,9 @@ module OpenAI
159
160
  # Uses the fast service tier.
160
161
  FAST: :fast
161
162
 
163
+ # Uses the ultrafast service tier.
164
+ ULTRAFAST: :ultrafast
165
+
162
166
  def self?.values: -> ::Array[OpenAI::Models::Beta::Agents::SessionUpdateParams::Agent::service_tier]
163
167
  end
164
168
  end
@@ -2756,6 +2756,7 @@ module OpenAI
2756
2756
  type compaction_trigger =
2757
2757
  {
2758
2758
  ?type: :compaction_trigger,
2759
+ ?id: String?,
2759
2760
  ?agent: OpenAI::Beta::BetaResponseInputItem::CompactionTrigger::Agent?
2760
2761
  }
2761
2762
 
@@ -2763,20 +2764,27 @@ module OpenAI
2763
2764
  # The type of the item. Always `compaction_trigger`.
2764
2765
  attr_accessor type: :compaction_trigger
2765
2766
 
2767
+ # The unique ID of this compaction trigger.
2768
+ attr_accessor id: String?
2769
+
2766
2770
  # The agent that produced this item.
2767
2771
  attr_accessor agent: OpenAI::Beta::BetaResponseInputItem::CompactionTrigger::Agent?
2768
2772
 
2773
+ # @param id
2774
+ # The unique ID of this compaction trigger.
2769
2775
  # @param agent
2770
2776
  # The agent that produced this item.
2771
2777
  # @param type
2772
2778
  # The type of the item. Always `compaction_trigger`.
2773
2779
  def initialize: (
2780
+ ?id: String?,
2774
2781
  ?agent: OpenAI::Beta::BetaResponseInputItem::CompactionTrigger::Agent?,
2775
2782
  ?type: :compaction_trigger
2776
2783
  ) -> void
2777
2784
 
2778
2785
  def to_hash: -> {
2779
2786
  ?type: :compaction_trigger,
2787
+ ?id: String?,
2780
2788
  ?agent: OpenAI::Beta::BetaResponseInputItem::CompactionTrigger::Agent?
2781
2789
  }
2782
2790
 
@@ -5,6 +5,9 @@ module OpenAI
5
5
  input: OpenAI::Models::DecisionCreateParams::input,
6
6
  model: String,
7
7
  questions: ::Array[OpenAI::Models::DecisionCreateParams::question],
8
+ ?prompt_cache_key: String?,
9
+ ?prompt_cache_options: (OpenAI::DecisionCreateParams::PromptCacheOptions
10
+ | OpenAI::Models::DecisionCreateParams::prompt_cache_options)?,
8
11
  ?safety_identifier: String?,
9
12
  ?request_options: OpenAI::request_opts
10
13
  }
@@ -26,6 +29,21 @@ module OpenAI
26
29
  # or score. Answers come back in the same order.
27
30
  attr_accessor questions: ::Array[OpenAI::Models::DecisionCreateParams::question]
28
31
 
32
+ # Partition prompt cache reuse by caller-provided key.
33
+ attr_accessor prompt_cache_key: String?
34
+
35
+ # Options for prompt caching. Supported for `gpt-5.6` and later models. By
36
+ # default, OpenAI automatically chooses one implicit cache breakpoint. You can add
37
+ # explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
38
+ # request can write up to four breakpoints. For cache matching, OpenAI considers
39
+ # up to the latest 80 breakpoints in the conversation, without a content-block
40
+ # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
41
+ # `ttl` defaults to `30m`, which is currently the only supported value. See the
42
+ # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
43
+ # for current details.
44
+ attr_accessor prompt_cache_options: (OpenAI::DecisionCreateParams::PromptCacheOptions
45
+ | OpenAI::Models::DecisionCreateParams::prompt_cache_options)?
46
+
29
47
  # Opaque caller-provided end-user identifier, scoped by the verified org. Match
30
48
  # Responses' limit; this is never the authenticated user identity.
31
49
  attr_accessor safety_identifier: String?
@@ -40,6 +58,18 @@ module OpenAI
40
58
  # @param questions
41
59
  # Ask 1–200 questions about the input. Each question can be a predicate, choice,
42
60
  # or score. Answers come back in the same order.
61
+ # @param prompt_cache_key
62
+ # Partition prompt cache reuse by caller-provided key.
63
+ # @param prompt_cache_options
64
+ # Options for prompt caching. Supported for `gpt-5.6` and later models. By
65
+ # default, OpenAI automatically chooses one implicit cache breakpoint. You can add
66
+ # explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
67
+ # request can write up to four breakpoints. For cache matching, OpenAI considers
68
+ # up to the latest 80 breakpoints in the conversation, without a content-block
69
+ # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
70
+ # `ttl` defaults to `30m`, which is currently the only supported value. See the
71
+ # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
72
+ # for current details.
43
73
  # @param safety_identifier
44
74
  # Opaque caller-provided end-user identifier, scoped by the verified org. Match
45
75
  # Responses' limit; this is never the authenticated user identity.
@@ -47,6 +77,9 @@ module OpenAI
47
77
  input: OpenAI::Models::DecisionCreateParams::input,
48
78
  model: String,
49
79
  questions: ::Array[OpenAI::Models::DecisionCreateParams::question],
80
+ ?prompt_cache_key: String?,
81
+ ?prompt_cache_options: (OpenAI::DecisionCreateParams::PromptCacheOptions
82
+ | OpenAI::Models::DecisionCreateParams::prompt_cache_options)?,
50
83
  ?safety_identifier: String?,
51
84
  ?request_options: OpenAI::request_opts
52
85
  ) -> void
@@ -55,6 +88,9 @@ module OpenAI
55
88
  input: OpenAI::Models::DecisionCreateParams::input,
56
89
  model: String,
57
90
  questions: ::Array[OpenAI::Models::DecisionCreateParams::question],
91
+ ?prompt_cache_key: String?,
92
+ ?prompt_cache_options: (OpenAI::DecisionCreateParams::PromptCacheOptions
93
+ | OpenAI::Models::DecisionCreateParams::prompt_cache_options)?,
58
94
  ?safety_identifier: String?,
59
95
  ?request_options: OpenAI::RequestOptions
60
96
  }
@@ -233,6 +269,76 @@ module OpenAI
233
269
 
234
270
  def self?.variants: -> ::Array[OpenAI::Models::DecisionCreateParams::question]
235
271
  end
272
+
273
+ type prompt_cache_options =
274
+ {
275
+ ?mode: OpenAI::Models::DecisionCreateParams::PromptCacheOptions::mode?,
276
+ ?ttl: OpenAI::Models::DecisionCreateParams::PromptCacheOptions::ttl
277
+ }
278
+
279
+ class PromptCacheOptions < OpenAI::Internal::Type::BaseModel
280
+ # Controls whether OpenAI automatically creates an implicit cache breakpoint.
281
+ # Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint
282
+ # and writes up to the latest three explicit breakpoints in the request. With
283
+ # `explicit`, OpenAI does not create an implicit breakpoint and writes up to the
284
+ # latest four explicit breakpoints. If there are no explicit breakpoints, the
285
+ # request does not use prompt caching.
286
+ attr_accessor mode: OpenAI::Models::DecisionCreateParams::PromptCacheOptions::mode?
287
+
288
+ # The minimum lifetime applied to every implicit and explicit cache breakpoint
289
+ # written by the request. Defaults to `30m`, which is currently the only supported
290
+ # value. The backend may retain cache entries for longer.
291
+ attr_reader ttl: OpenAI::Models::DecisionCreateParams::PromptCacheOptions::ttl?
292
+
293
+ # The minimum lifetime applied to every implicit and explicit cache breakpoint
294
+ # written by the request. Defaults to `30m`, which is currently the only supported
295
+ # value. The backend may retain cache entries for longer.
296
+ def ttl=: (
297
+ OpenAI::Models::DecisionCreateParams::PromptCacheOptions::ttl
298
+ ) -> OpenAI::Models::DecisionCreateParams::PromptCacheOptions::ttl
299
+
300
+ # @param mode
301
+ # Controls whether OpenAI automatically creates an implicit cache breakpoint.
302
+ # Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint
303
+ # and writes up to the latest three explicit breakpoints in the request. With
304
+ # `explicit`, OpenAI does not create an implicit breakpoint and writes up to the
305
+ # latest four explicit breakpoints. If there are no explicit breakpoints, the
306
+ # request does not use prompt caching.
307
+ # @param ttl
308
+ # The minimum lifetime applied to every implicit and explicit cache breakpoint
309
+ # written by the request. Defaults to `30m`, which is currently the only supported
310
+ # value. The backend may retain cache entries for longer.
311
+ def initialize: (
312
+ ?mode: OpenAI::Models::DecisionCreateParams::PromptCacheOptions::mode?,
313
+ ?ttl: OpenAI::Models::DecisionCreateParams::PromptCacheOptions::ttl
314
+ ) -> void
315
+
316
+ def to_hash: -> {
317
+ ?mode: OpenAI::Models::DecisionCreateParams::PromptCacheOptions::mode?,
318
+ ?ttl: OpenAI::Models::DecisionCreateParams::PromptCacheOptions::ttl
319
+ }
320
+
321
+ type mode = :implicit | :explicit
322
+
323
+ module Mode
324
+ extend OpenAI::Internal::Type::Enum
325
+
326
+ IMPLICIT: :implicit
327
+ EXPLICIT: :explicit
328
+
329
+ def self?.values: -> ::Array[OpenAI::Models::DecisionCreateParams::PromptCacheOptions::mode]
330
+ end
331
+
332
+ type ttl = :"30m"
333
+
334
+ module Ttl
335
+ extend OpenAI::Internal::Type::Enum
336
+
337
+ TTL_30M: :"30m"
338
+
339
+ def self?.values: -> ::Array[OpenAI::Models::DecisionCreateParams::PromptCacheOptions::ttl]
340
+ end
341
+ end
236
342
  end
237
343
  end
238
344
  end
@@ -4,7 +4,9 @@ module OpenAI
4
4
  {
5
5
  image_url: String,
6
6
  ?type: :input_image,
7
- ?detail: OpenAI::Models::DecisionInputImage::detail?
7
+ ?detail: OpenAI::Models::DecisionInputImage::detail?,
8
+ ?prompt_cache_breakpoint: (OpenAI::DecisionPromptCacheBreakpoint
9
+ | OpenAI::Models::decision_prompt_cache_breakpoint)?
8
10
  }
9
11
 
10
12
  class DecisionInputImage < OpenAI::Internal::Type::BaseModel
@@ -17,21 +19,35 @@ module OpenAI
17
19
  # auto.
18
20
  attr_accessor detail: OpenAI::Models::DecisionInputImage::detail?
19
21
 
22
+ # Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
23
+ # from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
24
+ # token block.
25
+ attr_accessor prompt_cache_breakpoint: (OpenAI::DecisionPromptCacheBreakpoint
26
+ | OpenAI::Models::decision_prompt_cache_breakpoint)?
27
+
20
28
  # @param image_url
21
29
  # A base64-encoded image in a data URL or a publicly accessible HTTP(S) image URL.
22
30
  # @param detail
23
31
  # The image detail level, using the selected model's image profile. Defaults to
24
32
  # auto.
33
+ # @param prompt_cache_breakpoint
34
+ # Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
35
+ # from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
36
+ # token block.
25
37
  def initialize: (
26
38
  image_url: String,
27
39
  ?detail: OpenAI::Models::DecisionInputImage::detail?,
40
+ ?prompt_cache_breakpoint: (OpenAI::DecisionPromptCacheBreakpoint
41
+ | OpenAI::Models::decision_prompt_cache_breakpoint)?,
28
42
  ?type: :input_image
29
43
  ) -> void
30
44
 
31
45
  def to_hash: -> {
32
46
  image_url: String,
33
47
  ?type: :input_image,
34
- ?detail: OpenAI::Models::DecisionInputImage::detail?
48
+ ?detail: OpenAI::Models::DecisionInputImage::detail?,
49
+ ?prompt_cache_breakpoint: (OpenAI::DecisionPromptCacheBreakpoint
50
+ | OpenAI::Models::decision_prompt_cache_breakpoint)?
35
51
  }
36
52
 
37
53
  type detail = :low | :high | :auto | :original
@@ -1,15 +1,41 @@
1
1
  module OpenAI
2
2
  module Models
3
- type decision_input_text = { text: String, ?type: :input_text }
3
+ type decision_input_text =
4
+ {
5
+ text: String,
6
+ ?type: :input_text,
7
+ ?prompt_cache_breakpoint: (OpenAI::DecisionPromptCacheBreakpoint
8
+ | OpenAI::Models::decision_prompt_cache_breakpoint)?
9
+ }
4
10
 
5
11
  class DecisionInputText < OpenAI::Internal::Type::BaseModel
6
12
  attr_accessor text: String
7
13
 
8
14
  attr_accessor type: :input_text
9
15
 
10
- def initialize: (text: String, ?type: :input_text) -> void
16
+ # Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
17
+ # from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
18
+ # token block.
19
+ attr_accessor prompt_cache_breakpoint: (OpenAI::DecisionPromptCacheBreakpoint
20
+ | OpenAI::Models::decision_prompt_cache_breakpoint)?
11
21
 
12
- def to_hash: -> { text: String, ?type: :input_text }
22
+ # @param prompt_cache_breakpoint
23
+ # Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
24
+ # from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
25
+ # token block.
26
+ def initialize: (
27
+ text: String,
28
+ ?prompt_cache_breakpoint: (OpenAI::DecisionPromptCacheBreakpoint
29
+ | OpenAI::Models::decision_prompt_cache_breakpoint)?,
30
+ ?type: :input_text
31
+ ) -> void
32
+
33
+ def to_hash: -> {
34
+ text: String,
35
+ ?type: :input_text,
36
+ ?prompt_cache_breakpoint: (OpenAI::DecisionPromptCacheBreakpoint
37
+ | OpenAI::Models::decision_prompt_cache_breakpoint)?
38
+ }
13
39
  end
14
40
  end
15
41
  end
@@ -0,0 +1,16 @@
1
+ module OpenAI
2
+ module Models
3
+ type decision_prompt_cache_breakpoint = { ?mode: :explicit }
4
+
5
+ class DecisionPromptCacheBreakpoint < OpenAI::Internal::Type::BaseModel
6
+ # The breakpoint mode. Always `explicit`.
7
+ attr_accessor mode: :explicit
8
+
9
+ # @param mode
10
+ # The breakpoint mode. Always `explicit`.
11
+ def initialize: (?mode: :explicit) -> void
12
+
13
+ def to_hash: -> { ?mode: :explicit }
14
+ end
15
+ end
16
+ end
@@ -22,10 +22,235 @@ module OpenAI
22
22
  | OpenAI::Live::SessionClosedEvent
23
23
  | OpenAI::Live::ErrorEvent
24
24
  | OpenAI::Live::InfoEvent
25
+ | OpenAI::Live::SidebandServerEvent::SessionInputAudioAppend
26
+ | OpenAI::Live::OutputAudioDeltaEvent
27
+ | OpenAI::Live::SidebandServerEvent::TransportDtmfReceived
28
+ | OpenAI::Live::SidebandServerEvent::TransportDtmfSend
29
+ | OpenAI::Live::SidebandServerEvent::TransportRinging
30
+ | OpenAI::Live::SidebandServerEvent::TransportAnswered
31
+ | OpenAI::Live::SidebandServerEvent::TransportFailed
25
32
 
26
33
  module SidebandServerEvent
27
34
  extend OpenAI::Internal::Type::Union
28
35
 
36
+ type session_input_audio_append =
37
+ { audio: String, ?type: :"session.input_audio.append" }
38
+
39
+ class SessionInputAudioAppend < OpenAI::Internal::Type::BaseModel
40
+ # Base64-encoded raw mono PCM16LE at 24 kHz received from the primary transport,
41
+ # reflected to the sideband before model-input muting. This server event uses the
42
+ # same audio key as the client command, but is not an acknowledgment of it.
43
+ attr_accessor audio: String
44
+
45
+ # The event type, always `session.input_audio.append`.
46
+ attr_accessor type: :"session.input_audio.append"
47
+
48
+ # @param audio
49
+ # Base64-encoded raw mono PCM16LE at 24 kHz received from the primary transport,
50
+ # reflected to the sideband before model-input muting. This server event uses the
51
+ # same audio key as the client command, but is not an acknowledgment of it.
52
+ # @param type
53
+ # The event type, always `session.input_audio.append`.
54
+ def initialize: (
55
+ audio: String,
56
+ ?type: :"session.input_audio.append"
57
+ ) -> void
58
+
59
+ def to_hash: -> {
60
+ audio: String,
61
+ ?type: :"session.input_audio.append"
62
+ }
63
+ end
64
+
65
+ type transport_dtmf_received =
66
+ { event: String, event_id: String, ?type: :"transport.dtmf.received" }
67
+
68
+ class TransportDtmfReceived < OpenAI::Internal::Type::BaseModel
69
+ attr_accessor event: String
70
+
71
+ attr_accessor event_id: String
72
+
73
+ attr_accessor type: :"transport.dtmf.received"
74
+
75
+ def initialize: (
76
+ event: String,
77
+ event_id: String,
78
+ ?type: :"transport.dtmf.received"
79
+ ) -> void
80
+
81
+ def to_hash: -> {
82
+ event: String,
83
+ event_id: String,
84
+ ?type: :"transport.dtmf.received"
85
+ }
86
+ end
87
+
88
+ type transport_dtmf_send =
89
+ {
90
+ event: String,
91
+ event_id: String,
92
+ ?type: :"transport.dtmf.send",
93
+ ?client_event_id: String
94
+ }
95
+
96
+ class TransportDtmfSend < OpenAI::Internal::Type::BaseModel
97
+ attr_accessor event: String
98
+
99
+ attr_accessor event_id: String
100
+
101
+ attr_accessor type: :"transport.dtmf.send"
102
+
103
+ # The event_id of the client command, when supplied.
104
+ attr_reader client_event_id: String?
105
+
106
+ # The event_id of the client command, when supplied.
107
+ def client_event_id=: (String) -> String
108
+
109
+ # @param client_event_id
110
+ # The event_id of the client command, when supplied.
111
+ def initialize: (
112
+ event: String,
113
+ event_id: String,
114
+ ?client_event_id: String,
115
+ ?type: :"transport.dtmf.send"
116
+ ) -> void
117
+
118
+ def to_hash: -> {
119
+ event: String,
120
+ event_id: String,
121
+ ?type: :"transport.dtmf.send",
122
+ ?client_event_id: String
123
+ }
124
+ end
125
+
126
+ type transport_ringing =
127
+ { event_id: String, session_id: String, ?type: :"transport.ringing" }
128
+
129
+ class TransportRinging < OpenAI::Internal::Type::BaseModel
130
+ attr_accessor event_id: String
131
+
132
+ # The canonical Live session ID.
133
+ attr_accessor session_id: String
134
+
135
+ attr_accessor type: :"transport.ringing"
136
+
137
+ # @param session_id
138
+ # The canonical Live session ID.
139
+ def initialize: (
140
+ event_id: String,
141
+ session_id: String,
142
+ ?type: :"transport.ringing"
143
+ ) -> void
144
+
145
+ def to_hash: -> {
146
+ event_id: String,
147
+ session_id: String,
148
+ ?type: :"transport.ringing"
149
+ }
150
+ end
151
+
152
+ type transport_answered =
153
+ { event_id: String, session_id: String, ?type: :"transport.answered" }
154
+
155
+ class TransportAnswered < OpenAI::Internal::Type::BaseModel
156
+ attr_accessor event_id: String
157
+
158
+ # The canonical Live session ID.
159
+ attr_accessor session_id: String
160
+
161
+ attr_accessor type: :"transport.answered"
162
+
163
+ # @param session_id
164
+ # The canonical Live session ID.
165
+ def initialize: (
166
+ event_id: String,
167
+ session_id: String,
168
+ ?type: :"transport.answered"
169
+ ) -> void
170
+
171
+ def to_hash: -> {
172
+ event_id: String,
173
+ session_id: String,
174
+ ?type: :"transport.answered"
175
+ }
176
+ end
177
+
178
+ type transport_failed =
179
+ {
180
+ error: OpenAI::Live::SidebandServerEvent::TransportFailed::Error,
181
+ event_id: String,
182
+ session_id: String,
183
+ ?type: :"transport.failed"
184
+ }
185
+
186
+ class TransportFailed < OpenAI::Internal::Type::BaseModel
187
+ attr_accessor error: OpenAI::Live::SidebandServerEvent::TransportFailed::Error
188
+
189
+ attr_accessor event_id: String
190
+
191
+ # The canonical Live session ID.
192
+ attr_accessor session_id: String
193
+
194
+ attr_accessor type: :"transport.failed"
195
+
196
+ # @param session_id
197
+ # The canonical Live session ID.
198
+ def initialize: (
199
+ error: OpenAI::Live::SidebandServerEvent::TransportFailed::Error,
200
+ event_id: String,
201
+ session_id: String,
202
+ ?type: :"transport.failed"
203
+ ) -> void
204
+
205
+ def to_hash: -> {
206
+ error: OpenAI::Live::SidebandServerEvent::TransportFailed::Error,
207
+ event_id: String,
208
+ session_id: String,
209
+ ?type: :"transport.failed"
210
+ }
211
+
212
+ type error =
213
+ {
214
+ code: String,
215
+ message: String,
216
+ ?type: :call_error,
217
+ ?param: String
218
+ }
219
+
220
+ class Error < OpenAI::Internal::Type::BaseModel
221
+ # The call setup failure code.
222
+ attr_accessor code: String
223
+
224
+ attr_accessor message: String
225
+
226
+ attr_accessor type: :call_error
227
+
228
+ # The parameter related to the error, if any. Empty when no parameter applies.
229
+ attr_reader param: String?
230
+
231
+ # The parameter related to the error, if any. Empty when no parameter applies.
232
+ def param=: (String) -> String
233
+
234
+ # @param code
235
+ # The call setup failure code.
236
+ # @param param
237
+ # The parameter related to the error, if any. Empty when no parameter applies.
238
+ def initialize: (
239
+ code: String,
240
+ message: String,
241
+ ?param: String,
242
+ ?type: :call_error
243
+ ) -> void
244
+
245
+ def to_hash: -> {
246
+ code: String,
247
+ message: String,
248
+ ?type: :call_error,
249
+ ?param: String
250
+ }
251
+ end
252
+ end
253
+
29
254
  def self?.variants: -> ::Array[OpenAI::Models::Live::sideband_server_event]
30
255
  end
31
256
  end
@@ -1907,17 +1907,22 @@ module OpenAI
1907
1907
  end
1908
1908
  end
1909
1909
 
1910
- type compaction_trigger = { ?type: :compaction_trigger }
1910
+ type compaction_trigger = { ?type: :compaction_trigger, ?id: String? }
1911
1911
 
1912
1912
  class CompactionTrigger < OpenAI::Internal::Type::BaseModel
1913
1913
  # The type of the item. Always `compaction_trigger`.
1914
1914
  attr_accessor type: :compaction_trigger
1915
1915
 
1916
+ # The unique ID of this compaction trigger.
1917
+ attr_accessor id: String?
1918
+
1919
+ # @param id
1920
+ # The unique ID of this compaction trigger.
1916
1921
  # @param type
1917
1922
  # The type of the item. Always `compaction_trigger`.
1918
- def initialize: (?type: :compaction_trigger) -> void
1923
+ def initialize: (?id: String?, ?type: :compaction_trigger) -> void
1919
1924
 
1920
- def to_hash: -> { ?type: :compaction_trigger }
1925
+ def to_hash: -> { ?type: :compaction_trigger, ?id: String? }
1921
1926
  end
1922
1927
 
1923
1928
  type item_reference =