openai 0.98.0 → 0.100.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 (245) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/README.md +1 -1
  4. data/bedrock.md +17 -1
  5. data/lib/openai/client.rb +9 -0
  6. data/lib/openai/helpers/agents/session_stream.rb +11 -36
  7. data/lib/openai/helpers/agents/tools.rb +34 -4
  8. data/lib/openai/helpers/beta/agents/creation_stream.rb +26 -0
  9. data/lib/openai/helpers/beta/agents/function_tool.rb +11 -4
  10. data/lib/openai/helpers/beta/agents/tool_dispatcher.rb +74 -0
  11. data/lib/openai/helpers/beta/agents/tool_error.rb +28 -0
  12. data/lib/openai/models/admin/organization/usage_audio_speeches_response.rb +140 -5
  13. data/lib/openai/models/admin/organization/usage_audio_transcriptions_response.rb +140 -5
  14. data/lib/openai/models/admin/organization/usage_code_interpreter_sessions_response.rb +140 -5
  15. data/lib/openai/models/admin/organization/usage_completions_params.rb +9 -4
  16. data/lib/openai/models/admin/organization/usage_completions_response.rb +140 -5
  17. data/lib/openai/models/admin/organization/usage_costs_params.rb +16 -4
  18. data/lib/openai/models/admin/organization/usage_costs_response.rb +140 -5
  19. data/lib/openai/models/admin/organization/usage_embeddings_response.rb +140 -5
  20. data/lib/openai/models/admin/organization/usage_file_search_calls_response.rb +140 -5
  21. data/lib/openai/models/admin/organization/usage_images_response.rb +140 -5
  22. data/lib/openai/models/admin/organization/usage_moderations_response.rb +140 -5
  23. data/lib/openai/models/admin/organization/usage_vector_stores_response.rb +140 -5
  24. data/lib/openai/models/admin/organization/usage_web_search_calls_params.rb +9 -4
  25. data/lib/openai/models/admin/organization/usage_web_search_calls_response.rb +140 -5
  26. data/lib/openai/models/all_models.rb +42 -0
  27. data/lib/openai/models/audio/speech_create_params.rb +6 -0
  28. data/lib/openai/models/audio/voice.rb +75 -0
  29. data/lib/openai/models/audio/voice_create_params.rb +217 -0
  30. data/lib/openai/models/beta/agent_create_params.rb +0 -3
  31. data/lib/openai/models/beta/agent_update_params.rb +0 -3
  32. data/lib/openai/models/beta/agents/environments/template_create_params.rb +6 -6
  33. data/lib/openai/models/beta/agents/environments/template_update_params.rb +3 -6
  34. data/lib/openai/models/beta/agents/session_create_params.rb +0 -3
  35. data/lib/openai/models/beta/agents/session_update_params.rb +0 -3
  36. data/lib/openai/models/beta/agents/sessions/turns/item_list_params.rb +79 -0
  37. data/lib/openai/models/beta/beta_response.rb +220 -0
  38. data/lib/openai/models/beta/beta_response_computer_tool_call_output_item.rb +2 -2
  39. data/lib/openai/models/beta/beta_response_error.rb +12 -1
  40. data/lib/openai/models/beta/beta_responses_client_event.rb +220 -0
  41. data/lib/openai/models/beta/beta_responses_server_event.rb +12 -1
  42. data/lib/openai/models/beta/beta_tool.rb +15 -18
  43. data/lib/openai/models/beta/environment_param.rb +6 -6
  44. data/lib/openai/models/beta/response_compact_params.rb +220 -0
  45. data/lib/openai/models/beta/response_create_params.rb +220 -0
  46. data/lib/openai/models/beta/session_turn_error.rb +9 -0
  47. data/lib/openai/models/chat/chat_completion_audio_param.rb +6 -3
  48. data/lib/openai/models/chat/chat_completion_chunk.rb +85 -18
  49. data/lib/openai/models/chat_model.rb +178 -0
  50. data/lib/openai/models/error_object.rb +12 -1
  51. data/lib/openai/models/eval_create_params.rb +1 -1
  52. data/lib/openai/models/eval_create_response.rb +1 -1
  53. data/lib/openai/models/eval_list_response.rb +1 -1
  54. data/lib/openai/models/eval_retrieve_response.rb +1 -1
  55. data/lib/openai/models/eval_update_response.rb +1 -1
  56. data/lib/openai/models/fine_tuning/job_list_params.rb +14 -4
  57. data/lib/openai/models/graders/score_model_grader.rb +2 -2
  58. data/lib/openai/models/image.rb +14 -14
  59. data/lib/openai/models/image_create_variation_params.rb +7 -7
  60. data/lib/openai/models/image_edit_params.rb +88 -96
  61. data/lib/openai/models/image_generate_params.rb +51 -62
  62. data/lib/openai/models/image_model.rb +5 -3
  63. data/lib/openai/models/realtime/realtime_audio_config_output.rb +9 -6
  64. data/lib/openai/models/realtime/realtime_client_event.rb +9 -0
  65. data/lib/openai/models/realtime/realtime_response_create_audio_output.rb +9 -6
  66. data/lib/openai/models/realtime/session_update_event.rb +16 -0
  67. data/lib/openai/models/responses/response_compact_params.rb +220 -0
  68. data/lib/openai/models/responses/response_computer_tool_call_output_item.rb +2 -2
  69. data/lib/openai/models/responses/response_error.rb +12 -1
  70. data/lib/openai/models/responses/responses_server_event.rb +12 -1
  71. data/lib/openai/models/responses/tool.rb +15 -18
  72. data/lib/openai/models/responses_model.rb +42 -0
  73. data/lib/openai/models/video_create_error.rb +12 -1
  74. data/lib/openai/models/webhooks/agent_session_action_required_webhook_event.rb +109 -0
  75. data/lib/openai/models/webhooks/agent_session_created_webhook_event.rb +106 -0
  76. data/lib/openai/models/webhooks/agent_session_failed_webhook_event.rb +86 -0
  77. data/lib/openai/models/webhooks/agent_session_idle_webhook_event.rb +86 -0
  78. data/lib/openai/models/webhooks/agent_session_in_progress_webhook_event.rb +86 -0
  79. data/lib/openai/models/webhooks/unwrap_webhook_event.rb +18 -2
  80. data/lib/openai/models/webhooks/webhook_create_params.rb +5 -0
  81. data/lib/openai/models/webhooks/webhook_test_params.rb +5 -0
  82. data/lib/openai/models/webhooks/webhook_update_params.rb +5 -0
  83. data/lib/openai/providers/bedrock.rb +20 -1
  84. data/lib/openai/resources/admin/organization/usage.rb +15 -6
  85. data/lib/openai/resources/audio/speech.rb +2 -0
  86. data/lib/openai/resources/audio/voices.rb +53 -0
  87. data/lib/openai/resources/audio.rb +5 -0
  88. data/lib/openai/resources/beta/agents/environments/templates.rb +3 -4
  89. data/lib/openai/resources/beta/agents/sessions/turns/items.rb +68 -0
  90. data/lib/openai/resources/beta/agents/sessions/turns.rb +4 -0
  91. data/lib/openai/resources/beta/agents/sessions.rb +22 -2
  92. data/lib/openai/resources/fine_tuning/jobs.rb +7 -2
  93. data/lib/openai/resources/images.rb +79 -109
  94. data/lib/openai/resources/webhooks.rb +1 -1
  95. data/lib/openai/version.rb +1 -1
  96. data/lib/openai.rb +10 -0
  97. data/rbi/openai/helpers/agents.rbi +2 -0
  98. data/rbi/openai/helpers/beta/agents/function_tool.rbi +8 -3
  99. data/rbi/openai/helpers/beta/agents/tool_error.rbi +19 -0
  100. data/rbi/openai/helpers/beta/agents.rbi +12 -0
  101. data/rbi/openai/models/admin/organization/usage_audio_speeches_response.rbi +213 -3
  102. data/rbi/openai/models/admin/organization/usage_audio_transcriptions_response.rbi +213 -3
  103. data/rbi/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbi +213 -3
  104. data/rbi/openai/models/admin/organization/usage_completions_params.rbi +9 -4
  105. data/rbi/openai/models/admin/organization/usage_completions_response.rbi +213 -3
  106. data/rbi/openai/models/admin/organization/usage_costs_params.rbi +16 -4
  107. data/rbi/openai/models/admin/organization/usage_costs_response.rbi +213 -3
  108. data/rbi/openai/models/admin/organization/usage_embeddings_response.rbi +213 -3
  109. data/rbi/openai/models/admin/organization/usage_file_search_calls_response.rbi +213 -3
  110. data/rbi/openai/models/admin/organization/usage_images_response.rbi +213 -3
  111. data/rbi/openai/models/admin/organization/usage_moderations_response.rbi +213 -3
  112. data/rbi/openai/models/admin/organization/usage_vector_stores_response.rbi +213 -3
  113. data/rbi/openai/models/admin/organization/usage_web_search_calls_params.rbi +12 -4
  114. data/rbi/openai/models/admin/organization/usage_web_search_calls_response.rbi +213 -3
  115. data/rbi/openai/models/audio/speech_create_params.rbi +6 -0
  116. data/rbi/openai/models/audio/voice.rbi +111 -0
  117. data/rbi/openai/models/audio/voice_create_params.rbi +321 -0
  118. data/rbi/openai/models/beta/agent_create_params.rbi +0 -3
  119. data/rbi/openai/models/beta/agent_update_params.rbi +0 -3
  120. data/rbi/openai/models/beta/agents/environments/template_create_params.rbi +6 -6
  121. data/rbi/openai/models/beta/agents/environments/template_update_params.rbi +3 -6
  122. data/rbi/openai/models/beta/agents/session_create_params.rbi +0 -3
  123. data/rbi/openai/models/beta/agents/session_update_params.rbi +0 -3
  124. data/rbi/openai/models/beta/agents/sessions/turns/item_list_params.rbi +139 -0
  125. data/rbi/openai/models/beta/beta_response_computer_tool_call_output_item.rbi +2 -2
  126. data/rbi/openai/models/beta/beta_response_error.rbi +12 -0
  127. data/rbi/openai/models/beta/beta_responses_server_event.rbi +12 -0
  128. data/rbi/openai/models/beta/beta_tool.rbi +15 -18
  129. data/rbi/openai/models/beta/environment_param.rbi +6 -6
  130. data/rbi/openai/models/beta/session_turn_error.rbi +18 -0
  131. data/rbi/openai/models/chat/chat_completion_audio_param.rbi +6 -3
  132. data/rbi/openai/models/chat/chat_completion_chunk.rbi +123 -17
  133. data/rbi/openai/models/error_object.rbi +12 -0
  134. data/rbi/openai/models/eval_create_params.rbi +1 -1
  135. data/rbi/openai/models/eval_create_response.rbi +1 -1
  136. data/rbi/openai/models/eval_list_response.rbi +1 -1
  137. data/rbi/openai/models/eval_retrieve_response.rbi +1 -1
  138. data/rbi/openai/models/eval_update_response.rbi +1 -1
  139. data/rbi/openai/models/fine_tuning/job_list_params.rbi +14 -4
  140. data/rbi/openai/models/graders/score_model_grader.rbi +2 -2
  141. data/rbi/openai/models/image.rbi +14 -14
  142. data/rbi/openai/models/image_create_variation_params.rbi +6 -6
  143. data/rbi/openai/models/image_edit_params.rbi +73 -91
  144. data/rbi/openai/models/image_generate_params.rbi +30 -61
  145. data/rbi/openai/models/image_model.rbi +3 -3
  146. data/rbi/openai/models/realtime/realtime_audio_config_output.rbi +9 -6
  147. data/rbi/openai/models/realtime/realtime_response_create_audio_output.rbi +9 -6
  148. data/rbi/openai/models/realtime/session_update_event.rbi +16 -0
  149. data/rbi/openai/models/responses/response_computer_tool_call_output_item.rbi +2 -2
  150. data/rbi/openai/models/responses/response_error.rbi +12 -0
  151. data/rbi/openai/models/responses/responses_server_event.rbi +12 -0
  152. data/rbi/openai/models/responses/tool.rbi +15 -18
  153. data/rbi/openai/models/video_create_error.rbi +12 -0
  154. data/rbi/openai/models/webhooks/agent_session_action_required_webhook_event.rbi +222 -0
  155. data/rbi/openai/models/webhooks/agent_session_created_webhook_event.rbi +202 -0
  156. data/rbi/openai/models/webhooks/agent_session_failed_webhook_event.rbi +151 -0
  157. data/rbi/openai/models/webhooks/agent_session_idle_webhook_event.rbi +151 -0
  158. data/rbi/openai/models/webhooks/agent_session_in_progress_webhook_event.rbi +151 -0
  159. data/rbi/openai/models/webhooks/unwrap_webhook_event.rbi +7 -1
  160. data/rbi/openai/models/webhooks/webhook_create_params.rbi +20 -0
  161. data/rbi/openai/models/webhooks/webhook_test_params.rbi +20 -0
  162. data/rbi/openai/models/webhooks/webhook_update_params.rbi +20 -0
  163. data/rbi/openai/resources/admin/organization/usage.rbi +15 -6
  164. data/rbi/openai/resources/audio/speech.rbi +2 -0
  165. data/rbi/openai/resources/audio/voices.rbi +49 -0
  166. data/rbi/openai/resources/audio.rbi +4 -0
  167. data/rbi/openai/resources/beta/agents/environments/templates.rbi +3 -4
  168. data/rbi/openai/resources/beta/agents/sessions/turns/items.rbi +62 -0
  169. data/rbi/openai/resources/beta/agents/sessions/turns.rbi +3 -0
  170. data/rbi/openai/resources/beta/agents/sessions.rbi +2 -0
  171. data/rbi/openai/resources/fine_tuning/jobs.rbi +7 -2
  172. data/rbi/openai/resources/images.rbi +77 -109
  173. data/rbi/openai/resources/webhooks.rbi +5 -0
  174. data/sig/openai/helpers/agents.rbs +3 -0
  175. data/sig/openai/helpers/beta/agents/function_tool.rbs +5 -2
  176. data/sig/openai/helpers/beta/agents/tool_error.rbs +17 -0
  177. data/sig/openai/helpers/beta/agents.rbs +5 -0
  178. data/sig/openai/models/admin/organization/usage_audio_speeches_response.rbs +107 -5
  179. data/sig/openai/models/admin/organization/usage_audio_transcriptions_response.rbs +107 -5
  180. data/sig/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbs +107 -5
  181. data/sig/openai/models/admin/organization/usage_completions_params.rbs +14 -6
  182. data/sig/openai/models/admin/organization/usage_completions_response.rbs +107 -5
  183. data/sig/openai/models/admin/organization/usage_costs_params.rbs +25 -7
  184. data/sig/openai/models/admin/organization/usage_costs_response.rbs +107 -5
  185. data/sig/openai/models/admin/organization/usage_embeddings_response.rbs +107 -5
  186. data/sig/openai/models/admin/organization/usage_file_search_calls_response.rbs +107 -5
  187. data/sig/openai/models/admin/organization/usage_images_response.rbs +107 -5
  188. data/sig/openai/models/admin/organization/usage_moderations_response.rbs +107 -5
  189. data/sig/openai/models/admin/organization/usage_vector_stores_response.rbs +107 -5
  190. data/sig/openai/models/admin/organization/usage_web_search_calls_params.rbs +19 -7
  191. data/sig/openai/models/admin/organization/usage_web_search_calls_response.rbs +107 -5
  192. data/sig/openai/models/audio/speech_create_params.rbs +4 -0
  193. data/sig/openai/models/audio/voice.rbs +70 -0
  194. data/sig/openai/models/audio/voice_create_params.rbs +203 -0
  195. data/sig/openai/models/beta/agent_create_params.rbs +1 -5
  196. data/sig/openai/models/beta/agent_update_params.rbs +1 -5
  197. data/sig/openai/models/beta/agents/environments/template_create_params.rbs +4 -4
  198. data/sig/openai/models/beta/agents/environments/template_update_params.rbs +2 -4
  199. data/sig/openai/models/beta/agents/session_create_params.rbs +1 -5
  200. data/sig/openai/models/beta/agents/session_update_params.rbs +1 -5
  201. data/sig/openai/models/beta/agents/sessions/turns/item_list_params.rbs +91 -0
  202. data/sig/openai/models/beta/beta_response_computer_tool_call_output_item.rbs +2 -2
  203. data/sig/openai/models/beta/beta_response_error.rbs +10 -0
  204. data/sig/openai/models/beta/beta_responses_server_event.rbs +10 -0
  205. data/sig/openai/models/beta/beta_tool.rbs +11 -15
  206. data/sig/openai/models/beta/environment_param.rbs +4 -4
  207. data/sig/openai/models/beta/session_turn_error.rbs +12 -0
  208. data/sig/openai/models/chat/chat_completion_audio_param.rbs +4 -2
  209. data/sig/openai/models/chat/chat_completion_chunk.rbs +96 -12
  210. data/sig/openai/models/error_object.rbs +10 -0
  211. data/sig/openai/models/eval_create_params.rbs +1 -1
  212. data/sig/openai/models/eval_create_response.rbs +1 -1
  213. data/sig/openai/models/eval_list_response.rbs +1 -1
  214. data/sig/openai/models/eval_retrieve_response.rbs +1 -1
  215. data/sig/openai/models/eval_update_response.rbs +1 -1
  216. data/sig/openai/models/fine_tuning/job_list_params.rbs +14 -4
  217. data/sig/openai/models/graders/score_model_grader.rbs +3 -3
  218. data/sig/openai/models/image.rbs +21 -21
  219. data/sig/openai/models/image_create_variation_params.rbs +4 -4
  220. data/sig/openai/models/image_edit_params.rbs +54 -66
  221. data/sig/openai/models/image_generate_params.rbs +23 -45
  222. data/sig/openai/models/image_model.rbs +6 -6
  223. data/sig/openai/models/realtime/realtime_audio_config_output.rbs +9 -6
  224. data/sig/openai/models/realtime/realtime_response_create_audio_output.rbs +9 -6
  225. data/sig/openai/models/responses/response_computer_tool_call_output_item.rbs +2 -2
  226. data/sig/openai/models/responses/response_error.rbs +10 -0
  227. data/sig/openai/models/responses/responses_server_event.rbs +10 -0
  228. data/sig/openai/models/responses/tool.rbs +11 -15
  229. data/sig/openai/models/video_create_error.rbs +10 -0
  230. data/sig/openai/models/webhooks/agent_session_action_required_webhook_event.rbs +114 -0
  231. data/sig/openai/models/webhooks/agent_session_created_webhook_event.rbs +115 -0
  232. data/sig/openai/models/webhooks/agent_session_failed_webhook_event.rbs +89 -0
  233. data/sig/openai/models/webhooks/agent_session_idle_webhook_event.rbs +89 -0
  234. data/sig/openai/models/webhooks/agent_session_in_progress_webhook_event.rbs +89 -0
  235. data/sig/openai/models/webhooks/unwrap_webhook_event.rbs +6 -1
  236. data/sig/openai/models/webhooks/webhook_create_params.rbs +10 -0
  237. data/sig/openai/models/webhooks/webhook_test_params.rbs +10 -0
  238. data/sig/openai/models/webhooks/webhook_update_params.rbs +10 -0
  239. data/sig/openai/resources/audio/voices.rbs +14 -0
  240. data/sig/openai/resources/audio.rbs +2 -0
  241. data/sig/openai/resources/beta/agents/sessions/turns/items.rbs +24 -0
  242. data/sig/openai/resources/beta/agents/sessions/turns.rbs +2 -0
  243. data/sig/openai/resources/beta/agents/sessions.rbs +1 -0
  244. data/sig/openai/resources/webhooks.rbs +6 -1
  245. metadata +35 -1
@@ -0,0 +1,62 @@
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 Turns
13
+
14
+ class Items
15
+
16
+ # Lists items belonging to one root-agent turn, including its interactions with
17
+ # subagents. See
18
+ # [inspecting agent output](https://developers.openai.com/api/docs/guides/agents-api/observability).
19
+ sig {
20
+ params(
21
+ turn_id: String,
22
+ session_id: String,
23
+ after: String,
24
+ limit: Integer,
25
+ order: OpenAI::Beta::Agents::Sessions::Turns::ItemListParams::Order::OrSymbol,
26
+ request_options: OpenAI::RequestOptions::OrHash
27
+ )
28
+ .returns(OpenAI::Internal::ConversationCursorPage[OpenAI::Beta::AgentSessionItem::Variants])
29
+ }
30
+ def list(
31
+ # Path param: The ID of the turn.
32
+ turn_id,
33
+ # Path param: The ID of the session that owns the turn.
34
+ session_id:,
35
+ # Query param: Return items after this cursor in the selected order. Pass the
36
+ # previous response's last_id, which can differ from the last item's ID.
37
+ after: nil,
38
+ # Query param: The maximum number of resources to return, between 1 and 100.
39
+ # Defaults to 20.
40
+ limit: nil,
41
+ # Query param: The order in which resources are returned. Defaults to `desc`.
42
+ order: nil,
43
+ request_options: {}
44
+ )
45
+ end
46
+
47
+ # @api private
48
+ sig { params(client: OpenAI::Client).returns(T.attached_class) }
49
+ def self.new(client:)
50
+ end
51
+ end
52
+
53
+ end
54
+
55
+ end
56
+
57
+ end
58
+
59
+ end
60
+
61
+ end
62
+ end
@@ -11,6 +11,9 @@ module OpenAI
11
11
 
12
12
  class Turns
13
13
 
14
+ sig { returns(OpenAI::Resources::Beta::Agents::Sessions::Turns::Items) }
15
+ attr_reader :items
16
+
14
17
  # Retrieves a turn's current status, timestamps, usage, and error. Returns 404 if
15
18
  # the turn does not belong to the session. See
16
19
  # [session turns](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage#inspect-session-turns).
@@ -91,6 +91,7 @@ module OpenAI
91
91
  ),
92
92
  agent: OpenAI::Beta::Agents::SessionCreateParams::Agent::OrHash,
93
93
  agent_id: String,
94
+ tool_handlers: T::Hash[String, OpenAI::Helpers::Agents::ToolHandler],
94
95
  output_type: T.nilable(T.class_of(OpenAI::Helpers::StructuredOutput::BaseModel)),
95
96
  input: T.nilable(OpenAI::Beta::Agents::SessionCreateParams::Input::Variants),
96
97
  metadata: T.nilable(T::Hash[Symbol, String]),
@@ -109,6 +110,7 @@ module OpenAI
109
110
  # The ID of a saved reusable agent. Omit `agent` to use its configuration
110
111
  # unchanged.
111
112
  agent_id: nil,
113
+ tool_handlers: {},
112
114
  output_type: nil,
113
115
  # Initial input to submit when the session is created. A string is shorthand for a
114
116
  # single user message. Required when `environment.type` is `none`, or when
@@ -130,8 +130,13 @@ module OpenAI
130
130
  after: nil,
131
131
  # Number of fine-tuning jobs to retrieve.
132
132
  limit: nil,
133
- # Optional metadata filter. To filter, use the syntax `metadata[k]=v`.
134
- # Alternatively, set `metadata=null` to indicate no metadata.
133
+ # Optional metadata filter. To filter, use the syntax `metadata[k]=v`. Omitting
134
+ # the parameter or passing an empty object applies no metadata filter. An empty
135
+ # value, such as `metadata[k]=`, filters for that key with an empty string value.
136
+ # To select jobs with null metadata, send the literal query string
137
+ # `metadata=null`. Nullable caller types do not specify how a client serializes
138
+ # null for a deep-object parameter. Use a raw query parameter if the client omits
139
+ # null. Do not combine the two query forms.
135
140
  metadata: nil,
136
141
  request_options: {}
137
142
  )
@@ -6,7 +6,9 @@ module OpenAI
6
6
  # Given a prompt and/or an input image, the model will generate a new image.
7
7
  class Images
8
8
 
9
- # Creates a variation of a given image. This endpoint only supports `dall-e-2`.
9
+ # This endpoint is retired and no longer available. Use the image edits endpoint
10
+ # with a GPT Image model and a prompt to create a variation of an image. The
11
+ # request and response schemas below describe the legacy contract.
10
12
  sig {
11
13
  params(
12
14
  image: OpenAI::Internal::FileInput,
@@ -27,8 +29,8 @@ module OpenAI
27
29
  # metadata. Use `OpenAI::FilePart` when you need to override the filename or
28
30
  # content type.
29
31
  image:,
30
- # The model to use for image generation. Only `dall-e-2` is supported at this
31
- # time.
32
+ # The legacy model used by the retired image variations endpoint. This endpoint no
33
+ # longer accepts requests.
32
34
  model: nil,
33
35
  # The number of images to generate. Must be between 1 and 10.
34
36
  n: nil,
@@ -50,7 +52,7 @@ module OpenAI
50
52
  # See {OpenAI::Resources::Images#edit_stream_raw} for streaming counterpart.
51
53
  #
52
54
  # Creates an edited or extended image given one or more source images and a
53
- # prompt. This endpoint supports GPT Image models and `dall-e-2`.
55
+ # prompt. This endpoint supports GPT Image models.
54
56
  sig {
55
57
  params(
56
58
  image: OpenAI::ImageEditParams::Image::Variants,
@@ -82,15 +84,12 @@ module OpenAI
82
84
  # be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16
83
85
  # images.
84
86
  #
85
- # For `dall-e-2`, you can only provide one image, and it should be a square `png`
86
- # file less than 4MB.
87
- #
88
87
  # `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
89
88
  # metadata. Use `OpenAI::FilePart` when you need to override the filename or
90
89
  # content type.
91
90
  image:,
92
- # A text description of the desired image(s). The maximum length is 1000
93
- # characters for `dall-e-2`, and 32000 characters for the GPT image models.
91
+ # A text description of the desired image(s). The maximum length is 32000
92
+ # characters for the GPT image models.
94
93
  prompt:,
95
94
  # Allows to set transparency for the background of the generated image(s). Must be
96
95
  # one of `transparent`, `opaque`, or `auto` (default value). When `auto` is used,
@@ -102,9 +101,10 @@ module OpenAI
102
101
  # `gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`,
103
102
  # set the output format to `png` or `webp`.
104
103
  background: nil,
105
- # Controls fidelity to the original input image(s). This parameter is supported
106
- # for GPT image models that support input fidelity. `gpt-image-2` and
107
- # `gpt-image-2-2026-04-21` ignore this parameter.
104
+ # Control how much effort the model will exert to match the style and features,
105
+ # especially facial features, of input images. Supports `high` and `low` on
106
+ # `gpt-image-1` and `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For
107
+ # `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.
108
108
  input_fidelity: nil,
109
109
  # An additional image whose fully transparent areas (e.g. where alpha is zero)
110
110
  # indicate where `image` should be edited. If there are multiple images provided,
@@ -115,12 +115,11 @@ module OpenAI
115
115
  # metadata. Use `OpenAI::FilePart` when you need to override the filename or
116
116
  # content type.
117
117
  mask: nil,
118
- # The model to use for image generation. One of `dall-e-2` or a GPT image model
119
- # (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,
120
- # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
121
- # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
122
- # `gpt-image-2.5-flare-2026-09-08`, or `chatgpt-image-latest`). Defaults to
123
- # `gpt-image-1.5`.
118
+ # The GPT image model to use for image editing (`gpt-image-1`, `gpt-image-1-mini`,
119
+ # `gpt-image-1.5`, `gpt-image-2`, `gpt-image-2-2026-04-21`,
120
+ # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
121
+ # `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, or
122
+ # `chatgpt-image-latest`).
124
123
  model: nil,
125
124
  # The number of images to generate. Must be between 1 and 10.
126
125
  n: nil,
@@ -144,23 +143,20 @@ module OpenAI
144
143
  # `gpt-image-2.5-flare`, including their `2026-09-08` snapshots, also support
145
144
  # `xhigh` and `max`. Defaults to `auto`.
146
145
  quality: nil,
147
- # The format in which the generated images are returned. Must be one of `url` or
148
- # `b64_json`. URLs are only valid for 60 minutes after the image has been
149
- # generated. This parameter is only supported for `dall-e-2` (default is `url` for
150
- # `dall-e-2`), as GPT image models always return base64-encoded images.
146
+ # Legacy response format parameter for retired image models. Unsupported for GPT
147
+ # image models, which always return base64-encoded images.
151
148
  response_format: nil,
152
- # The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
153
- # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
154
- # `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary
155
- # resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`.
156
- # Width and height must both be divisible by 16 and the requested aspect ratio
157
- # must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and
158
- # the maximum supported resolution is `3840x2160`. The requested size must also
159
- # satisfy the model's current pixel and edge limits. The standard sizes
160
- # `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models;
161
- # `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use
162
- # one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of
163
- # `1024x1024`, `1792x1024`, or `1024x1792`.
149
+ # The size of the generated images. Defaults to `auto`. For `gpt-image-2`,
150
+ # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
151
+ # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and
152
+ # `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as
153
+ # `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be
154
+ # divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1.
155
+ # Resolutions above `2560x1440` are experimental, and the maximum supported
156
+ # resolution is `3840x2160`. The requested size must also satisfy the model's
157
+ # current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and
158
+ # `1024x1536` are supported by the GPT image models; `auto` is supported for
159
+ # models that allow automatic sizing.
164
160
  size: nil,
165
161
  # A unique identifier representing your end-user, which can help OpenAI to monitor
166
162
  # and detect abuse.
@@ -176,7 +172,7 @@ module OpenAI
176
172
  # See {OpenAI::Resources::Images#edit} for non-streaming counterpart.
177
173
  #
178
174
  # Creates an edited or extended image given one or more source images and a
179
- # prompt. This endpoint supports GPT Image models and `dall-e-2`.
175
+ # prompt. This endpoint supports GPT Image models.
180
176
  sig {
181
177
  params(
182
178
  image: OpenAI::ImageEditParams::Image::Variants,
@@ -208,15 +204,12 @@ module OpenAI
208
204
  # be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16
209
205
  # images.
210
206
  #
211
- # For `dall-e-2`, you can only provide one image, and it should be a square `png`
212
- # file less than 4MB.
213
- #
214
207
  # `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
215
208
  # metadata. Use `OpenAI::FilePart` when you need to override the filename or
216
209
  # content type.
217
210
  image:,
218
- # A text description of the desired image(s). The maximum length is 1000
219
- # characters for `dall-e-2`, and 32000 characters for the GPT image models.
211
+ # A text description of the desired image(s). The maximum length is 32000
212
+ # characters for the GPT image models.
220
213
  prompt:,
221
214
  # Allows to set transparency for the background of the generated image(s). Must be
222
215
  # one of `transparent`, `opaque`, or `auto` (default value). When `auto` is used,
@@ -228,9 +221,10 @@ module OpenAI
228
221
  # `gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`,
229
222
  # set the output format to `png` or `webp`.
230
223
  background: nil,
231
- # Controls fidelity to the original input image(s). This parameter is supported
232
- # for GPT image models that support input fidelity. `gpt-image-2` and
233
- # `gpt-image-2-2026-04-21` ignore this parameter.
224
+ # Control how much effort the model will exert to match the style and features,
225
+ # especially facial features, of input images. Supports `high` and `low` on
226
+ # `gpt-image-1` and `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For
227
+ # `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.
234
228
  input_fidelity: nil,
235
229
  # An additional image whose fully transparent areas (e.g. where alpha is zero)
236
230
  # indicate where `image` should be edited. If there are multiple images provided,
@@ -241,12 +235,11 @@ module OpenAI
241
235
  # metadata. Use `OpenAI::FilePart` when you need to override the filename or
242
236
  # content type.
243
237
  mask: nil,
244
- # The model to use for image generation. One of `dall-e-2` or a GPT image model
245
- # (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,
246
- # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
247
- # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
248
- # `gpt-image-2.5-flare-2026-09-08`, or `chatgpt-image-latest`). Defaults to
249
- # `gpt-image-1.5`.
238
+ # The GPT image model to use for image editing (`gpt-image-1`, `gpt-image-1-mini`,
239
+ # `gpt-image-1.5`, `gpt-image-2`, `gpt-image-2-2026-04-21`,
240
+ # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
241
+ # `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, or
242
+ # `chatgpt-image-latest`).
250
243
  model: nil,
251
244
  # The number of images to generate. Must be between 1 and 10.
252
245
  n: nil,
@@ -270,23 +263,20 @@ module OpenAI
270
263
  # `gpt-image-2.5-flare`, including their `2026-09-08` snapshots, also support
271
264
  # `xhigh` and `max`. Defaults to `auto`.
272
265
  quality: nil,
273
- # The format in which the generated images are returned. Must be one of `url` or
274
- # `b64_json`. URLs are only valid for 60 minutes after the image has been
275
- # generated. This parameter is only supported for `dall-e-2` (default is `url` for
276
- # `dall-e-2`), as GPT image models always return base64-encoded images.
266
+ # Legacy response format parameter for retired image models. Unsupported for GPT
267
+ # image models, which always return base64-encoded images.
277
268
  response_format: nil,
278
- # The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
279
- # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
280
- # `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary
281
- # resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`.
282
- # Width and height must both be divisible by 16 and the requested aspect ratio
283
- # must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and
284
- # the maximum supported resolution is `3840x2160`. The requested size must also
285
- # satisfy the model's current pixel and edge limits. The standard sizes
286
- # `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models;
287
- # `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use
288
- # one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of
289
- # `1024x1024`, `1792x1024`, or `1024x1792`.
269
+ # The size of the generated images. Defaults to `auto`. For `gpt-image-2`,
270
+ # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
271
+ # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and
272
+ # `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as
273
+ # `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be
274
+ # divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1.
275
+ # Resolutions above `2560x1440` are experimental, and the maximum supported
276
+ # resolution is `3840x2160`. The requested size must also satisfy the model's
277
+ # current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and
278
+ # `1024x1536` are supported by the GPT image models; `auto` is supported for
279
+ # models that allow automatic sizing.
290
280
  size: nil,
291
281
  # A unique identifier representing your end-user, which can help OpenAI to monitor
292
282
  # and detect abuse.
@@ -301,7 +291,7 @@ module OpenAI
301
291
 
302
292
  # See {OpenAI::Resources::Images#generate_stream_raw} for streaming counterpart.
303
293
  #
304
- # Creates an image given a prompt.
294
+ # Creates an image given a prompt using a GPT Image model.
305
295
  # [Learn more](https://developers.openai.com/api/docs/guides/images-vision).
306
296
  sig {
307
297
  params(
@@ -325,8 +315,7 @@ module OpenAI
325
315
  }
326
316
  def generate(
327
317
  # A text description of the desired image(s). The maximum length is 32000
328
- # characters for the GPT image models, 1000 characters for `dall-e-2` and 4000
329
- # characters for `dall-e-3`.
318
+ # characters.
330
319
  prompt:,
331
320
  # Allows to set transparency for the background of the generated image(s). Must be
332
321
  # one of `transparent`, `opaque`, or `auto` (default value). When `auto` is used,
@@ -338,19 +327,17 @@ module OpenAI
338
327
  # `gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`,
339
328
  # set the output format to `png` or `webp`.
340
329
  background: nil,
341
- # The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT
342
- # image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,
343
- # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
330
+ # The GPT image model to use for image generation. Specify a model explicitly.
331
+ # Supported models include `gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`,
332
+ # `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
344
333
  # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
345
- # `gpt-image-2.5-flare-2026-09-08`). Defaults to `dall-e-2` unless a parameter
346
- # specific to the GPT image models is used.
334
+ # `gpt-image-2.5-flare-2026-09-08`, and `chatgpt-image-latest`.
347
335
  model: nil,
348
336
  # Control the content-moderation level for images generated by the GPT image
349
337
  # models. Must be either `low` for less restrictive filtering or `auto` (default
350
338
  # value).
351
339
  moderation: nil,
352
- # The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only
353
- # `n=1` is supported.
340
+ # The number of images to generate. Must be between 1 and 10.
354
341
  n: nil,
355
342
  # The compression level (0-100%) for the generated images. This parameter is only
356
343
  # supported for the GPT image models with the `webp` or `jpeg` output formats, and
@@ -373,12 +360,8 @@ module OpenAI
373
360
  # - `high`, `medium` and `low` are supported for the GPT image models.
374
361
  # - `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their
375
362
  # `2026-09-08` snapshots, also support `xhigh` and `max`.
376
- # - `hd` and `standard` are supported for `dall-e-3`.
377
- # - `standard` is the only option for `dall-e-2`.
378
363
  quality: nil,
379
- # The format in which generated images with `dall-e-2` and `dall-e-3` are
380
- # returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes
381
- # after the image has been generated. This parameter isn't supported for the GPT
364
+ # Legacy response format parameter for retired image models. Unsupported for GPT
382
365
  # image models, which always return base64-encoded images.
383
366
  response_format: nil,
384
367
  # The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
@@ -390,14 +373,10 @@ module OpenAI
390
373
  # the maximum supported resolution is `3840x2160`. The requested size must also
391
374
  # satisfy the model's current pixel and edge limits. The standard sizes
392
375
  # `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models;
393
- # `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use
394
- # one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of
395
- # `1024x1024`, `1792x1024`, or `1024x1792`.
376
+ # `auto` is supported for models that allow automatic sizing.
396
377
  size: nil,
397
- # The style of the generated images. This parameter is only supported for
398
- # `dall-e-3`. Must be one of `vivid` or `natural`. Vivid causes the model to lean
399
- # towards generating hyper-real and dramatic images. Natural causes the model to
400
- # produce more natural, less hyper-real looking images.
378
+ # Legacy style parameter for retired image models. Unsupported for GPT image
379
+ # models; describe the desired style in the prompt instead.
401
380
  style: nil,
402
381
  # A unique identifier representing your end-user, which can help OpenAI to monitor
403
382
  # and detect abuse.
@@ -412,7 +391,7 @@ module OpenAI
412
391
 
413
392
  # See {OpenAI::Resources::Images#generate} for non-streaming counterpart.
414
393
  #
415
- # Creates an image given a prompt.
394
+ # Creates an image given a prompt using a GPT Image model.
416
395
  # [Learn more](https://developers.openai.com/api/docs/guides/images-vision).
417
396
  sig {
418
397
  params(
@@ -436,8 +415,7 @@ module OpenAI
436
415
  }
437
416
  def generate_stream_raw(
438
417
  # A text description of the desired image(s). The maximum length is 32000
439
- # characters for the GPT image models, 1000 characters for `dall-e-2` and 4000
440
- # characters for `dall-e-3`.
418
+ # characters.
441
419
  prompt:,
442
420
  # Allows to set transparency for the background of the generated image(s). Must be
443
421
  # one of `transparent`, `opaque`, or `auto` (default value). When `auto` is used,
@@ -449,19 +427,17 @@ module OpenAI
449
427
  # `gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`,
450
428
  # set the output format to `png` or `webp`.
451
429
  background: nil,
452
- # The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT
453
- # image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,
454
- # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
430
+ # The GPT image model to use for image generation. Specify a model explicitly.
431
+ # Supported models include `gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`,
432
+ # `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
455
433
  # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
456
- # `gpt-image-2.5-flare-2026-09-08`). Defaults to `dall-e-2` unless a parameter
457
- # specific to the GPT image models is used.
434
+ # `gpt-image-2.5-flare-2026-09-08`, and `chatgpt-image-latest`.
458
435
  model: nil,
459
436
  # Control the content-moderation level for images generated by the GPT image
460
437
  # models. Must be either `low` for less restrictive filtering or `auto` (default
461
438
  # value).
462
439
  moderation: nil,
463
- # The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only
464
- # `n=1` is supported.
440
+ # The number of images to generate. Must be between 1 and 10.
465
441
  n: nil,
466
442
  # The compression level (0-100%) for the generated images. This parameter is only
467
443
  # supported for the GPT image models with the `webp` or `jpeg` output formats, and
@@ -484,12 +460,8 @@ module OpenAI
484
460
  # - `high`, `medium` and `low` are supported for the GPT image models.
485
461
  # - `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their
486
462
  # `2026-09-08` snapshots, also support `xhigh` and `max`.
487
- # - `hd` and `standard` are supported for `dall-e-3`.
488
- # - `standard` is the only option for `dall-e-2`.
489
463
  quality: nil,
490
- # The format in which generated images with `dall-e-2` and `dall-e-3` are
491
- # returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes
492
- # after the image has been generated. This parameter isn't supported for the GPT
464
+ # Legacy response format parameter for retired image models. Unsupported for GPT
493
465
  # image models, which always return base64-encoded images.
494
466
  response_format: nil,
495
467
  # The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
@@ -501,14 +473,10 @@ module OpenAI
501
473
  # the maximum supported resolution is `3840x2160`. The requested size must also
502
474
  # satisfy the model's current pixel and edge limits. The standard sizes
503
475
  # `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models;
504
- # `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use
505
- # one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of
506
- # `1024x1024`, `1792x1024`, or `1024x1792`.
476
+ # `auto` is supported for models that allow automatic sizing.
507
477
  size: nil,
508
- # The style of the generated images. This parameter is only supported for
509
- # `dall-e-3`. Must be one of `vivid` or `natural`. Vivid causes the model to lean
510
- # towards generating hyper-real and dramatic images. Natural causes the model to
511
- # produce more natural, less hyper-real looking images.
478
+ # Legacy style parameter for retired image models. Unsupported for GPT image
479
+ # models; describe the desired style in the prompt instead.
512
480
  style: nil,
513
481
  # A unique identifier representing your end-user, which can help OpenAI to monitor
514
482
  # and detect abuse.
@@ -140,6 +140,11 @@ module OpenAI
140
140
  )
141
141
  .returns(
142
142
  T.any(
143
+ OpenAI::Webhooks::AgentSessionActionRequiredWebhookEvent,
144
+ OpenAI::Webhooks::AgentSessionCreatedWebhookEvent,
145
+ OpenAI::Webhooks::AgentSessionFailedWebhookEvent,
146
+ OpenAI::Webhooks::AgentSessionIdleWebhookEvent,
147
+ OpenAI::Webhooks::AgentSessionInProgressWebhookEvent,
143
148
  OpenAI::Webhooks::BatchCancelledWebhookEvent,
144
149
  OpenAI::Webhooks::BatchCompletedWebhookEvent,
145
150
  OpenAI::Webhooks::BatchExpiredWebhookEvent,
@@ -35,6 +35,9 @@ module OpenAI
35
35
  | Array[OpenAI::Beta::AgentSessionInputMessageParam
36
36
  | Hash[Symbol, untyped]],
37
37
  ?tool_handlers: Hash[String, OpenAI::Helpers::Agents::tool_handler],
38
+ ?on_tool_error: (^(
39
+ OpenAI::Helpers::Beta::Agents::ToolError
40
+ ) -> void)?,
38
41
  ?idempotency_key: String?,
39
42
  ?output_type: singleton(OpenAI::Helpers::StructuredOutput::BaseModel)?,
40
43
  ?request_options: OpenAI::RequestOptions
@@ -8,7 +8,8 @@ module OpenAI
8
8
  def initialize: (
9
9
  name: String,
10
10
  arguments: Class,
11
- ?description: String
11
+ ?description: String,
12
+ ?defer_loading: bool?
12
13
  ) {
13
14
  (untyped) -> OpenAI::Helpers::Agents::tool_output
14
15
  } -> void
@@ -16,7 +17,9 @@ module OpenAI
16
17
  def handlers: -> Hash[String, OpenAI::Helpers::Agents::tool_handler]
17
18
  def call: (
18
19
  String | Hash[String | Symbol, untyped]
19
- ) -> OpenAI::Helpers::Agents::tool_output
20
+ ) ?{
21
+ (:arguments | :execution) -> void
22
+ } -> OpenAI::Helpers::Agents::tool_output
20
23
  end
21
24
  end
22
25
  end
@@ -0,0 +1,17 @@
1
+ module OpenAI
2
+ module Helpers
3
+ module Beta
4
+ module Agents
5
+ # Beta, local-only tool failure diagnostic.
6
+ class ToolError
7
+ attr_reader error: StandardError
8
+ attr_reader tool_name: String
9
+ attr_reader session_id: String
10
+ attr_reader turn_id: String
11
+ attr_reader call_id: String
12
+ attr_reader stage: :arguments | :execution | :output
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -64,6 +64,11 @@ module OpenAI
64
64
 
65
65
  # @api private
66
66
  def configure_output_parser: (OutputParser? parser) -> self
67
+ def configure_tool_handlers: (
68
+ sessions: OpenAI::Resources::Beta::Agents::Sessions,
69
+ tool_handlers: Hash[String, OpenAI::Helpers::Agents::tool_handler],
70
+ request_options: untyped
71
+ ) -> self
67
72
  end
68
73
  end
69
74
  end