openai 0.97.0 → 0.99.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 (244) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -0
  3. data/README.md +76 -1
  4. data/lib/openai/helpers/agents/session_stream.rb +60 -3
  5. data/lib/openai/helpers/beta/agents/artifacts.rb +72 -0
  6. data/lib/openai/helpers/beta/agents/creation_stream.rb +69 -0
  7. data/lib/openai/helpers/beta/agents/files.rb +236 -0
  8. data/lib/openai/helpers/beta/agents/function_tool.rb +65 -0
  9. data/lib/openai/helpers/beta/agents/model_adapter.rb +27 -0
  10. data/lib/openai/helpers/beta/agents/result.rb +170 -0
  11. data/lib/openai/helpers/beta/agents/typed_output.rb +191 -0
  12. data/lib/openai/helpers/live/websocket.rb +7 -1
  13. data/lib/openai/helpers/realtime/conversation_item_variant_resolver.rb +1 -1
  14. data/lib/openai/helpers/responses_websocket/connection.rb +7 -1
  15. data/lib/openai/helpers/responses_websocket/session.rb +5 -1
  16. data/lib/openai/helpers/responses_websocket/transports/async_websocket.rb +12 -2
  17. data/lib/openai/internal/transport/base_client.rb +18 -0
  18. data/lib/openai/internal/type/array_of.rb +1 -1
  19. data/lib/openai/internal/type/base_model.rb +6 -3
  20. data/lib/openai/internal/type/converter.rb +50 -3
  21. data/lib/openai/internal/type/hash_of.rb +1 -1
  22. data/lib/openai/internal/type/union.rb +6 -6
  23. data/lib/openai/models/admin/organization/usage_audio_speeches_response.rb +16 -3
  24. data/lib/openai/models/admin/organization/usage_audio_transcriptions_response.rb +16 -3
  25. data/lib/openai/models/admin/organization/usage_code_interpreter_sessions_response.rb +16 -3
  26. data/lib/openai/models/admin/organization/usage_completions_response.rb +16 -3
  27. data/lib/openai/models/admin/organization/usage_costs_response.rb +16 -3
  28. data/lib/openai/models/admin/organization/usage_embeddings_response.rb +16 -3
  29. data/lib/openai/models/admin/organization/usage_file_search_calls_response.rb +16 -3
  30. data/lib/openai/models/admin/organization/usage_images_response.rb +16 -3
  31. data/lib/openai/models/admin/organization/usage_moderations_response.rb +16 -3
  32. data/lib/openai/models/admin/organization/usage_vector_stores_response.rb +16 -3
  33. data/lib/openai/models/admin/organization/usage_web_search_calls_response.rb +16 -3
  34. data/lib/openai/models/all_models.rb +42 -0
  35. data/lib/openai/models/audio/speech_create_params.rb +6 -0
  36. data/lib/openai/models/audio/voice.rb +75 -0
  37. data/lib/openai/models/audio/voice_create_params.rb +217 -0
  38. data/lib/openai/models/beta/agent_create_params.rb +0 -3
  39. data/lib/openai/models/beta/agent_update_params.rb +0 -3
  40. data/lib/openai/models/beta/agents/session_create_params.rb +0 -3
  41. data/lib/openai/models/beta/agents/session_update_params.rb +0 -3
  42. data/lib/openai/models/beta/agents/sessions/session_trace.rb +64 -0
  43. data/lib/openai/models/beta/agents/sessions/trace_list_params.rb +68 -0
  44. data/lib/openai/models/beta/agents/vaults/credential.rb +8 -4
  45. data/lib/openai/models/beta/beta_response.rb +220 -0
  46. data/lib/openai/models/beta/beta_response_output_text.rb +2 -2
  47. data/lib/openai/models/beta/beta_response_output_text_annotation_added_event.rb +2 -2
  48. data/lib/openai/models/beta/beta_responses_client_event.rb +220 -0
  49. data/lib/openai/models/beta/beta_tool.rb +3 -9
  50. data/lib/openai/models/beta/environment.rb +33 -1
  51. data/lib/openai/models/beta/environment_param.rb +24 -1
  52. data/lib/openai/models/beta/response_compact_params.rb +220 -0
  53. data/lib/openai/models/beta/response_create_params.rb +220 -0
  54. data/lib/openai/models/beta/session_turn_error.rb +3 -0
  55. data/lib/openai/models/chat/chat_completion_audio_param.rb +6 -3
  56. data/lib/openai/models/chat/chat_completion_content_part_image.rb +1 -0
  57. data/lib/openai/models/chat_model.rb +178 -0
  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 +76 -87
  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/live/fork_server_event.rb +14 -3
  64. data/lib/openai/models/live/server_event.rb +14 -3
  65. data/lib/openai/models/realtime/realtime_audio_config_output.rb +9 -6
  66. data/lib/openai/models/realtime/realtime_response_create_audio_output.rb +9 -6
  67. data/lib/openai/models/realtime/translations/client_secret_create_params.rb +28 -0
  68. data/lib/openai/models/responses/response_compact_params.rb +220 -0
  69. data/lib/openai/models/responses/response_output_text.rb +2 -2
  70. data/lib/openai/models/responses/response_output_text_annotation_added_event.rb +2 -2
  71. data/lib/openai/models/responses/tool.rb +3 -9
  72. data/lib/openai/models/responses_model.rb +42 -0
  73. data/lib/openai/models/webhooks/agent_session_action_required_webhook_event.rb +109 -0
  74. data/lib/openai/models/webhooks/agent_session_created_webhook_event.rb +106 -0
  75. data/lib/openai/models/webhooks/agent_session_failed_webhook_event.rb +86 -0
  76. data/lib/openai/models/webhooks/agent_session_idle_webhook_event.rb +86 -0
  77. data/lib/openai/models/webhooks/agent_session_in_progress_webhook_event.rb +86 -0
  78. data/lib/openai/models/webhooks/unwrap_webhook_event.rb +18 -2
  79. data/lib/openai/models/webhooks/webhook_create_params.rb +5 -0
  80. data/lib/openai/models/webhooks/webhook_test_params.rb +5 -0
  81. data/lib/openai/models/webhooks/webhook_update_params.rb +5 -0
  82. data/lib/openai/resources/audio/speech.rb +2 -0
  83. data/lib/openai/resources/audio/voices.rb +53 -0
  84. data/lib/openai/resources/audio.rb +5 -0
  85. data/lib/openai/resources/beta/agents/environments/files.rb +31 -0
  86. data/lib/openai/resources/beta/agents/sessions/artifacts.rb +8 -0
  87. data/lib/openai/resources/beta/agents/sessions/events.rb +6 -5
  88. data/lib/openai/resources/beta/agents/sessions/traces.rb +58 -0
  89. data/lib/openai/resources/beta/agents/sessions.rb +18 -5
  90. data/lib/openai/resources/evals/runs.rb +1 -1
  91. data/lib/openai/resources/images.rb +71 -103
  92. data/lib/openai/resources/realtime/translations/client_secrets.rb +58 -0
  93. data/lib/openai/resources/realtime/translations.rb +20 -0
  94. data/lib/openai/resources/realtime.rb +4 -0
  95. data/lib/openai/resources/webhooks.rb +1 -1
  96. data/lib/openai/version.rb +1 -1
  97. data/lib/openai.rb +17 -1
  98. data/rbi/openai/helpers/agents.rbi +20 -1
  99. data/rbi/openai/helpers/beta/agents/artifacts.rbi +29 -0
  100. data/rbi/openai/helpers/beta/agents/files.rbi +65 -0
  101. data/rbi/openai/helpers/beta/agents/function_tool.rbi +40 -0
  102. data/rbi/openai/helpers/beta/agents/model_adapter.rbi +22 -0
  103. data/rbi/openai/helpers/beta/agents.rbi +146 -0
  104. data/rbi/openai/internal/transport/base_client.rbi +12 -0
  105. data/rbi/openai/internal/type/base_model.rbi +2 -2
  106. data/rbi/openai/internal/type/converter.rbi +21 -3
  107. data/rbi/openai/internal/type/union.rbi +6 -2
  108. data/rbi/openai/models/admin/organization/usage_audio_speeches_response.rbi +19 -2
  109. data/rbi/openai/models/admin/organization/usage_audio_transcriptions_response.rbi +19 -2
  110. data/rbi/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbi +19 -2
  111. data/rbi/openai/models/admin/organization/usage_completions_response.rbi +19 -2
  112. data/rbi/openai/models/admin/organization/usage_costs_response.rbi +19 -2
  113. data/rbi/openai/models/admin/organization/usage_embeddings_response.rbi +19 -2
  114. data/rbi/openai/models/admin/organization/usage_file_search_calls_response.rbi +19 -2
  115. data/rbi/openai/models/admin/organization/usage_images_response.rbi +19 -2
  116. data/rbi/openai/models/admin/organization/usage_moderations_response.rbi +19 -2
  117. data/rbi/openai/models/admin/organization/usage_vector_stores_response.rbi +19 -2
  118. data/rbi/openai/models/admin/organization/usage_web_search_calls_response.rbi +19 -2
  119. data/rbi/openai/models/audio/speech_create_params.rbi +6 -0
  120. data/rbi/openai/models/audio/voice.rbi +111 -0
  121. data/rbi/openai/models/audio/voice_create_params.rbi +321 -0
  122. data/rbi/openai/models/beta/agent_create_params.rbi +0 -3
  123. data/rbi/openai/models/beta/agent_update_params.rbi +0 -3
  124. data/rbi/openai/models/beta/agents/session_create_params.rbi +0 -3
  125. data/rbi/openai/models/beta/agents/session_update_params.rbi +0 -3
  126. data/rbi/openai/models/beta/agents/sessions/session_trace.rbi +97 -0
  127. data/rbi/openai/models/beta/agents/sessions/trace_list_params.rbi +121 -0
  128. data/rbi/openai/models/beta/agents/vaults/credential.rbi +5 -5
  129. data/rbi/openai/models/beta/beta_response_output_text.rbi +2 -2
  130. data/rbi/openai/models/beta/beta_response_output_text_annotation_added_event.rbi +2 -2
  131. data/rbi/openai/models/beta/beta_tool.rbi +3 -9
  132. data/rbi/openai/models/beta/environment.rbi +29 -0
  133. data/rbi/openai/models/beta/environment_param.rbi +31 -0
  134. data/rbi/openai/models/beta/session_turn_error.rbi +3 -0
  135. data/rbi/openai/models/chat/chat_completion_audio_param.rbi +6 -3
  136. data/rbi/openai/models/chat/chat_completion_content_part_image.rbi +1 -0
  137. data/rbi/openai/models/image.rbi +14 -14
  138. data/rbi/openai/models/image_create_variation_params.rbi +6 -6
  139. data/rbi/openai/models/image_edit_params.rbi +61 -82
  140. data/rbi/openai/models/image_generate_params.rbi +30 -61
  141. data/rbi/openai/models/image_model.rbi +3 -3
  142. data/rbi/openai/models/live/fork_server_event.rbi +14 -2
  143. data/rbi/openai/models/live/server_event.rbi +14 -2
  144. data/rbi/openai/models/realtime/realtime_audio_config_output.rbi +9 -6
  145. data/rbi/openai/models/realtime/realtime_response_create_audio_output.rbi +9 -6
  146. data/rbi/openai/models/realtime/translations/client_secret_create_params.rbi +68 -0
  147. data/rbi/openai/models/responses/response_output_text.rbi +2 -2
  148. data/rbi/openai/models/responses/response_output_text_annotation_added_event.rbi +2 -2
  149. data/rbi/openai/models/responses/tool.rbi +3 -9
  150. data/rbi/openai/models/webhooks/agent_session_action_required_webhook_event.rbi +222 -0
  151. data/rbi/openai/models/webhooks/agent_session_created_webhook_event.rbi +202 -0
  152. data/rbi/openai/models/webhooks/agent_session_failed_webhook_event.rbi +151 -0
  153. data/rbi/openai/models/webhooks/agent_session_idle_webhook_event.rbi +151 -0
  154. data/rbi/openai/models/webhooks/agent_session_in_progress_webhook_event.rbi +151 -0
  155. data/rbi/openai/models/webhooks/unwrap_webhook_event.rbi +7 -1
  156. data/rbi/openai/models/webhooks/webhook_create_params.rbi +20 -0
  157. data/rbi/openai/models/webhooks/webhook_test_params.rbi +20 -0
  158. data/rbi/openai/models/webhooks/webhook_update_params.rbi +20 -0
  159. data/rbi/openai/resources/audio/speech.rbi +2 -0
  160. data/rbi/openai/resources/audio/voices.rbi +49 -0
  161. data/rbi/openai/resources/audio.rbi +4 -0
  162. data/rbi/openai/resources/beta/agents/environments/files.rbi +31 -0
  163. data/rbi/openai/resources/beta/agents/sessions/artifacts.rbi +8 -0
  164. data/rbi/openai/resources/beta/agents/sessions/events.rbi +6 -5
  165. data/rbi/openai/resources/beta/agents/sessions/traces.rbi +54 -0
  166. data/rbi/openai/resources/beta/agents/sessions.rbi +6 -1
  167. data/rbi/openai/resources/images.rbi +69 -103
  168. data/rbi/openai/resources/realtime/translations/client_secrets.rbi +54 -0
  169. data/rbi/openai/resources/realtime/translations.rbi +22 -0
  170. data/rbi/openai/resources/realtime.rbi +3 -0
  171. data/rbi/openai/resources/webhooks.rbi +5 -0
  172. data/sig/openai/helpers/agents.rbs +7 -0
  173. data/sig/openai/helpers/beta/agents/artifacts.rbs +20 -0
  174. data/sig/openai/helpers/beta/agents/files.rbs +41 -0
  175. data/sig/openai/helpers/beta/agents/function_tool.rbs +24 -0
  176. data/sig/openai/helpers/beta/agents/model_adapter.rbs +16 -0
  177. data/sig/openai/helpers/beta/agents.rbs +71 -0
  178. data/sig/openai/helpers/structured_output.rbs +12 -0
  179. data/sig/openai/internal/transport/base_client.rbs +8 -0
  180. data/sig/openai/internal/type/base_model.rbs +3 -1
  181. data/sig/openai/internal/type/converter.rbs +16 -2
  182. data/sig/openai/internal/type/union.rbs +2 -1
  183. data/sig/openai/models/admin/organization/usage_audio_speeches_response.rbs +20 -3
  184. data/sig/openai/models/admin/organization/usage_audio_transcriptions_response.rbs +20 -3
  185. data/sig/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbs +20 -3
  186. data/sig/openai/models/admin/organization/usage_completions_response.rbs +20 -3
  187. data/sig/openai/models/admin/organization/usage_costs_response.rbs +20 -3
  188. data/sig/openai/models/admin/organization/usage_embeddings_response.rbs +20 -3
  189. data/sig/openai/models/admin/organization/usage_file_search_calls_response.rbs +20 -3
  190. data/sig/openai/models/admin/organization/usage_images_response.rbs +20 -3
  191. data/sig/openai/models/admin/organization/usage_moderations_response.rbs +20 -3
  192. data/sig/openai/models/admin/organization/usage_vector_stores_response.rbs +20 -3
  193. data/sig/openai/models/admin/organization/usage_web_search_calls_response.rbs +20 -3
  194. data/sig/openai/models/audio/speech_create_params.rbs +4 -0
  195. data/sig/openai/models/audio/voice.rbs +70 -0
  196. data/sig/openai/models/audio/voice_create_params.rbs +203 -0
  197. data/sig/openai/models/beta/agent_create_params.rbs +1 -5
  198. data/sig/openai/models/beta/agent_update_params.rbs +1 -5
  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/session_trace.rbs +65 -0
  202. data/sig/openai/models/beta/agents/sessions/trace_list_params.rbs +81 -0
  203. data/sig/openai/models/beta/agents/vaults/credential.rbs +5 -5
  204. data/sig/openai/models/beta/beta_response_output_text.rbs +2 -2
  205. data/sig/openai/models/beta/beta_response_output_text_annotation_added_event.rbs +2 -2
  206. data/sig/openai/models/beta/beta_tool.rbs +3 -9
  207. data/sig/openai/models/beta/environment.rbs +22 -0
  208. data/sig/openai/models/beta/environment_param.rbs +25 -0
  209. data/sig/openai/models/beta/session_turn_error.rbs +4 -0
  210. data/sig/openai/models/chat/chat_completion_audio_param.rbs +4 -2
  211. data/sig/openai/models/chat/chat_completion_content_part_image.rbs +2 -1
  212. data/sig/openai/models/image.rbs +21 -21
  213. data/sig/openai/models/image_create_variation_params.rbs +4 -4
  214. data/sig/openai/models/image_edit_params.rbs +46 -60
  215. data/sig/openai/models/image_generate_params.rbs +23 -45
  216. data/sig/openai/models/image_model.rbs +6 -6
  217. data/sig/openai/models/live/fork_server_event.rbs +17 -2
  218. data/sig/openai/models/live/server_event.rbs +17 -2
  219. data/sig/openai/models/realtime/realtime_audio_config_output.rbs +9 -6
  220. data/sig/openai/models/realtime/realtime_response_create_audio_output.rbs +9 -6
  221. data/sig/openai/models/realtime/translations/client_secret_create_params.rbs +39 -0
  222. data/sig/openai/models/responses/response_output_text.rbs +2 -2
  223. data/sig/openai/models/responses/response_output_text_annotation_added_event.rbs +2 -2
  224. data/sig/openai/models/responses/tool.rbs +3 -9
  225. data/sig/openai/models/webhooks/agent_session_action_required_webhook_event.rbs +114 -0
  226. data/sig/openai/models/webhooks/agent_session_created_webhook_event.rbs +115 -0
  227. data/sig/openai/models/webhooks/agent_session_failed_webhook_event.rbs +89 -0
  228. data/sig/openai/models/webhooks/agent_session_idle_webhook_event.rbs +89 -0
  229. data/sig/openai/models/webhooks/agent_session_in_progress_webhook_event.rbs +89 -0
  230. data/sig/openai/models/webhooks/unwrap_webhook_event.rbs +6 -1
  231. data/sig/openai/models/webhooks/webhook_create_params.rbs +10 -0
  232. data/sig/openai/models/webhooks/webhook_test_params.rbs +10 -0
  233. data/sig/openai/models/webhooks/webhook_update_params.rbs +10 -0
  234. data/sig/openai/resources/audio/voices.rbs +14 -0
  235. data/sig/openai/resources/audio.rbs +2 -0
  236. data/sig/openai/resources/beta/agents/environments/files.rbs +17 -0
  237. data/sig/openai/resources/beta/agents/sessions/artifacts.rbs +4 -0
  238. data/sig/openai/resources/beta/agents/sessions/traces.rbs +21 -0
  239. data/sig/openai/resources/beta/agents/sessions.rbs +4 -1
  240. data/sig/openai/resources/realtime/translations/client_secrets.rbs +17 -0
  241. data/sig/openai/resources/realtime/translations.rbs +11 -0
  242. data/sig/openai/resources/realtime.rbs +2 -0
  243. data/sig/openai/resources/webhooks.rbs +6 -1
  244. metadata +61 -1
@@ -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,
@@ -115,12 +114,11 @@ module OpenAI
115
114
  # metadata. Use `OpenAI::FilePart` when you need to override the filename or
116
115
  # content type.
117
116
  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`.
117
+ # The GPT image model to use for image editing (`gpt-image-1`, `gpt-image-1-mini`,
118
+ # `gpt-image-1.5`, `gpt-image-2`, `gpt-image-2-2026-04-21`,
119
+ # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
120
+ # `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, or
121
+ # `chatgpt-image-latest`).
124
122
  model: nil,
125
123
  # The number of images to generate. Must be between 1 and 10.
126
124
  n: nil,
@@ -144,23 +142,20 @@ module OpenAI
144
142
  # `gpt-image-2.5-flare`, including their `2026-09-08` snapshots, also support
145
143
  # `xhigh` and `max`. Defaults to `auto`.
146
144
  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.
145
+ # Legacy response format parameter for retired image models. Unsupported for GPT
146
+ # image models, which always return base64-encoded images.
151
147
  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`.
148
+ # The size of the generated images. Defaults to `auto`. For `gpt-image-2`,
149
+ # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
150
+ # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and
151
+ # `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as
152
+ # `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be
153
+ # divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1.
154
+ # Resolutions above `2560x1440` are experimental, and the maximum supported
155
+ # resolution is `3840x2160`. The requested size must also satisfy the model's
156
+ # current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and
157
+ # `1024x1536` are supported by the GPT image models; `auto` is supported for
158
+ # models that allow automatic sizing.
164
159
  size: nil,
165
160
  # A unique identifier representing your end-user, which can help OpenAI to monitor
166
161
  # and detect abuse.
@@ -176,7 +171,7 @@ module OpenAI
176
171
  # See {OpenAI::Resources::Images#edit} for non-streaming counterpart.
177
172
  #
178
173
  # 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`.
174
+ # prompt. This endpoint supports GPT Image models.
180
175
  sig {
181
176
  params(
182
177
  image: OpenAI::ImageEditParams::Image::Variants,
@@ -208,15 +203,12 @@ module OpenAI
208
203
  # be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16
209
204
  # images.
210
205
  #
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
206
  # `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
215
207
  # metadata. Use `OpenAI::FilePart` when you need to override the filename or
216
208
  # content type.
217
209
  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.
210
+ # A text description of the desired image(s). The maximum length is 32000
211
+ # characters for the GPT image models.
220
212
  prompt:,
221
213
  # Allows to set transparency for the background of the generated image(s). Must be
222
214
  # one of `transparent`, `opaque`, or `auto` (default value). When `auto` is used,
@@ -241,12 +233,11 @@ module OpenAI
241
233
  # metadata. Use `OpenAI::FilePart` when you need to override the filename or
242
234
  # content type.
243
235
  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`.
236
+ # The GPT image model to use for image editing (`gpt-image-1`, `gpt-image-1-mini`,
237
+ # `gpt-image-1.5`, `gpt-image-2`, `gpt-image-2-2026-04-21`,
238
+ # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
239
+ # `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, or
240
+ # `chatgpt-image-latest`).
250
241
  model: nil,
251
242
  # The number of images to generate. Must be between 1 and 10.
252
243
  n: nil,
@@ -270,23 +261,20 @@ module OpenAI
270
261
  # `gpt-image-2.5-flare`, including their `2026-09-08` snapshots, also support
271
262
  # `xhigh` and `max`. Defaults to `auto`.
272
263
  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.
264
+ # Legacy response format parameter for retired image models. Unsupported for GPT
265
+ # image models, which always return base64-encoded images.
277
266
  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`.
267
+ # The size of the generated images. Defaults to `auto`. For `gpt-image-2`,
268
+ # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
269
+ # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and
270
+ # `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as
271
+ # `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be
272
+ # divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1.
273
+ # Resolutions above `2560x1440` are experimental, and the maximum supported
274
+ # resolution is `3840x2160`. The requested size must also satisfy the model's
275
+ # current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and
276
+ # `1024x1536` are supported by the GPT image models; `auto` is supported for
277
+ # models that allow automatic sizing.
290
278
  size: nil,
291
279
  # A unique identifier representing your end-user, which can help OpenAI to monitor
292
280
  # and detect abuse.
@@ -301,7 +289,7 @@ module OpenAI
301
289
 
302
290
  # See {OpenAI::Resources::Images#generate_stream_raw} for streaming counterpart.
303
291
  #
304
- # Creates an image given a prompt.
292
+ # Creates an image given a prompt using a GPT Image model.
305
293
  # [Learn more](https://developers.openai.com/api/docs/guides/images-vision).
306
294
  sig {
307
295
  params(
@@ -325,8 +313,7 @@ module OpenAI
325
313
  }
326
314
  def generate(
327
315
  # 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`.
316
+ # characters.
330
317
  prompt:,
331
318
  # Allows to set transparency for the background of the generated image(s). Must be
332
319
  # one of `transparent`, `opaque`, or `auto` (default value). When `auto` is used,
@@ -338,19 +325,17 @@ module OpenAI
338
325
  # `gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`,
339
326
  # set the output format to `png` or `webp`.
340
327
  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`,
328
+ # The GPT image model to use for image generation. Specify a model explicitly.
329
+ # Supported models include `gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`,
330
+ # `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
344
331
  # `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.
332
+ # `gpt-image-2.5-flare-2026-09-08`, and `chatgpt-image-latest`.
347
333
  model: nil,
348
334
  # Control the content-moderation level for images generated by the GPT image
349
335
  # models. Must be either `low` for less restrictive filtering or `auto` (default
350
336
  # value).
351
337
  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.
338
+ # The number of images to generate. Must be between 1 and 10.
354
339
  n: nil,
355
340
  # The compression level (0-100%) for the generated images. This parameter is only
356
341
  # supported for the GPT image models with the `webp` or `jpeg` output formats, and
@@ -373,12 +358,8 @@ module OpenAI
373
358
  # - `high`, `medium` and `low` are supported for the GPT image models.
374
359
  # - `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their
375
360
  # `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
361
  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
362
+ # Legacy response format parameter for retired image models. Unsupported for GPT
382
363
  # image models, which always return base64-encoded images.
383
364
  response_format: nil,
384
365
  # The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
@@ -390,14 +371,10 @@ module OpenAI
390
371
  # the maximum supported resolution is `3840x2160`. The requested size must also
391
372
  # satisfy the model's current pixel and edge limits. The standard sizes
392
373
  # `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`.
374
+ # `auto` is supported for models that allow automatic sizing.
396
375
  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.
376
+ # Legacy style parameter for retired image models. Unsupported for GPT image
377
+ # models; describe the desired style in the prompt instead.
401
378
  style: nil,
402
379
  # A unique identifier representing your end-user, which can help OpenAI to monitor
403
380
  # and detect abuse.
@@ -412,7 +389,7 @@ module OpenAI
412
389
 
413
390
  # See {OpenAI::Resources::Images#generate} for non-streaming counterpart.
414
391
  #
415
- # Creates an image given a prompt.
392
+ # Creates an image given a prompt using a GPT Image model.
416
393
  # [Learn more](https://developers.openai.com/api/docs/guides/images-vision).
417
394
  sig {
418
395
  params(
@@ -436,8 +413,7 @@ module OpenAI
436
413
  }
437
414
  def generate_stream_raw(
438
415
  # 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`.
416
+ # characters.
441
417
  prompt:,
442
418
  # Allows to set transparency for the background of the generated image(s). Must be
443
419
  # one of `transparent`, `opaque`, or `auto` (default value). When `auto` is used,
@@ -449,19 +425,17 @@ module OpenAI
449
425
  # `gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`,
450
426
  # set the output format to `png` or `webp`.
451
427
  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`,
428
+ # The GPT image model to use for image generation. Specify a model explicitly.
429
+ # Supported models include `gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`,
430
+ # `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
455
431
  # `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.
432
+ # `gpt-image-2.5-flare-2026-09-08`, and `chatgpt-image-latest`.
458
433
  model: nil,
459
434
  # Control the content-moderation level for images generated by the GPT image
460
435
  # models. Must be either `low` for less restrictive filtering or `auto` (default
461
436
  # value).
462
437
  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.
438
+ # The number of images to generate. Must be between 1 and 10.
465
439
  n: nil,
466
440
  # The compression level (0-100%) for the generated images. This parameter is only
467
441
  # supported for the GPT image models with the `webp` or `jpeg` output formats, and
@@ -484,12 +458,8 @@ module OpenAI
484
458
  # - `high`, `medium` and `low` are supported for the GPT image models.
485
459
  # - `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their
486
460
  # `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
461
  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
462
+ # Legacy response format parameter for retired image models. Unsupported for GPT
493
463
  # image models, which always return base64-encoded images.
494
464
  response_format: nil,
495
465
  # The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
@@ -501,14 +471,10 @@ module OpenAI
501
471
  # the maximum supported resolution is `3840x2160`. The requested size must also
502
472
  # satisfy the model's current pixel and edge limits. The standard sizes
503
473
  # `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`.
474
+ # `auto` is supported for models that allow automatic sizing.
507
475
  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.
476
+ # Legacy style parameter for retired image models. Unsupported for GPT image
477
+ # models; describe the desired style in the prompt instead.
512
478
  style: nil,
513
479
  # A unique identifier representing your end-user, which can help OpenAI to monitor
514
480
  # and detect abuse.
@@ -0,0 +1,54 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Resources
5
+
6
+ class Realtime
7
+
8
+ class Translations
9
+
10
+ class ClientSecrets
11
+
12
+ # Create a Realtime translation client secret with an associated translation
13
+ # session configuration.
14
+ #
15
+ # Client secrets are short-lived tokens that can be passed to a client app, such
16
+ # as a web frontend or mobile client, which grants access to the Realtime
17
+ # Translation API without leaking your main API key. You can configure a custom
18
+ # TTL for each client secret.
19
+ #
20
+ # Returns the created client secret and the effective translation session object.
21
+ # The client secret is a string that looks like `ek_1234`.
22
+ sig {
23
+ params(
24
+ session: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::OrHash,
25
+ expires_after: OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::OrHash,
26
+ request_options: OpenAI::RequestOptions::OrHash
27
+ )
28
+ .returns(OpenAI::Realtime::RealtimeTranslationClientSecretCreateResponse)
29
+ }
30
+ def create(
31
+ # Realtime translation session configuration. Translation sessions stream source
32
+ # audio in and translated audio plus transcript deltas out continuously.
33
+ session:,
34
+ # Configuration for the client secret expiration. Expiration refers to the time
35
+ # after which a client secret will no longer be valid for creating sessions. The
36
+ # session itself may continue after that time once started. A secret can be used
37
+ # to create multiple sessions until it expires.
38
+ expires_after: nil,
39
+ request_options: {}
40
+ )
41
+ end
42
+
43
+ # @api private
44
+ sig { params(client: OpenAI::Client).returns(T.attached_class) }
45
+ def self.new(client:)
46
+ end
47
+ end
48
+
49
+ end
50
+
51
+ end
52
+
53
+ end
54
+ end
@@ -0,0 +1,22 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Resources
5
+
6
+ class Realtime
7
+
8
+ class Translations
9
+
10
+ sig { returns(OpenAI::Resources::Realtime::Translations::ClientSecrets) }
11
+ attr_reader :client_secrets
12
+
13
+ # @api private
14
+ sig { params(client: OpenAI::Client).returns(T.attached_class) }
15
+ def self.new(client:)
16
+ end
17
+ end
18
+
19
+ end
20
+
21
+ end
22
+ end
@@ -11,6 +11,9 @@ module OpenAI
11
11
  sig { returns(OpenAI::Resources::Realtime::Calls) }
12
12
  attr_reader :calls
13
13
 
14
+ sig { returns(OpenAI::Resources::Realtime::Translations) }
15
+ attr_reader :translations
16
+
14
17
  # @api private
15
18
  sig { params(client: OpenAI::Client).returns(T.attached_class) }
16
19
  def self.new(client:)
@@ -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,
@@ -16,6 +16,12 @@ module OpenAI
16
16
  | -> Enumerator[OpenAI::Models::Beta::agent_session_event, self]
17
17
  def close: -> void
18
18
  def until_done: -> self
19
+
20
+ # @beta
21
+ def get_final_result: -> OpenAI::Helpers::Beta::Agents::TurnResult
22
+
23
+ # @beta
24
+ def with_result_collection: -> self
19
25
  end
20
26
  end
21
27
  end
@@ -30,6 +36,7 @@ module OpenAI
30
36
  | Hash[Symbol, untyped]],
31
37
  ?tool_handlers: Hash[String, OpenAI::Helpers::Agents::tool_handler],
32
38
  ?idempotency_key: String?,
39
+ ?output_type: singleton(OpenAI::Helpers::StructuredOutput::BaseModel)?,
33
40
  ?request_options: OpenAI::RequestOptions
34
41
  | Hash[Symbol, untyped]
35
42
  | nil
@@ -0,0 +1,20 @@
1
+ module OpenAI
2
+ module Helpers
3
+ module Beta
4
+ module Agents
5
+ class ResultArtifacts
6
+ def initialize: (
7
+ artifacts: OpenAI::Resources::Beta::Agents::Sessions::Artifacts,
8
+ client: OpenAI::Client,
9
+ result: TurnResult
10
+ ) -> void
11
+ def download: (
12
+ path: String,
13
+ to: untyped,
14
+ ?request_options: OpenAI::request_opts
15
+ ) -> OpenAI::Models::Beta::Agents::Sessions::SessionArtifact
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,41 @@
1
+ module OpenAI
2
+ module Helpers
3
+ module Beta
4
+ module Agents
5
+ class PreparedFiles
6
+ attr_reader files: Array[OpenAI::Models::Beta::HostedEnvironmentFileParam::FileID]
7
+ attr_reader upload_ids: Array[String]
8
+ def initialize: (Array[Hash[Symbol, untyped]] files) -> void
9
+ end
10
+ class FilePreparationError < OpenAI::Errors::Error
11
+ attr_reader prepared: PreparedFiles
12
+ def initialize: (prepared: PreparedFiles) -> void
13
+ end
14
+
15
+ # @api private
16
+ class FilePreparation
17
+ def initialize: (
18
+ client: OpenAI::Client,
19
+ environment_files: OpenAI::Resources::Beta::Agents::Environments::Files
20
+ ) -> void
21
+ def prepare: (
22
+ Hash[String, String | Pathname] files,
23
+ ?request_options: OpenAI::request_opts
24
+ ) -> PreparedFiles
25
+ def prepare_directory: (
26
+ String | Pathname directory,
27
+ destination: String,
28
+ include: Array[String],
29
+ ?request_options: OpenAI::request_opts
30
+ ) -> PreparedFiles
31
+ def upload: (
32
+ String environment_id,
33
+ file: String | Pathname,
34
+ path: String,
35
+ ?request_options: OpenAI::request_opts
36
+ ) -> PreparedFiles
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,24 @@
1
+ module OpenAI
2
+ module Helpers
3
+ module Beta
4
+ module Agents
5
+ class FunctionTool
6
+ attr_reader name: String
7
+
8
+ def initialize: (
9
+ name: String,
10
+ arguments: Class,
11
+ ?description: String
12
+ ) {
13
+ (untyped) -> OpenAI::Helpers::Agents::tool_output
14
+ } -> void
15
+ def definition: -> Hash[Symbol, untyped]
16
+ def handlers: -> Hash[String, OpenAI::Helpers::Agents::tool_handler]
17
+ def call: (
18
+ String | Hash[String | Symbol, untyped]
19
+ ) -> OpenAI::Helpers::Agents::tool_output
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,16 @@
1
+ module OpenAI
2
+ module Helpers
3
+ module Beta
4
+ module Agents
5
+ module ModelAdapter
6
+ def self.validate!: (untyped model, parameter: String) -> void
7
+ def self.coerce: (
8
+ singleton(OpenAI::BaseModel) model,
9
+ untyped value,
10
+ ?memoize: bool
11
+ ) -> OpenAI::BaseModel?
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,71 @@
1
+ module OpenAI
2
+ module Helpers
3
+ module Beta
4
+ module Agents
5
+ class TurnResult
6
+ attr_reader turn: OpenAI::Models::Beta::Agents::Sessions::Turn
7
+ attr_reader messages: Array[OpenAI::Models::Beta::AgentSessionMessage]
8
+ def session_id: -> String
9
+ def turn_id: -> String
10
+ def output_text: -> String
11
+ def output_parsed: -> untyped
12
+ def parse: (
13
+ output_type: singleton(OpenAI::Helpers::StructuredOutput::BaseModel)
14
+ ) -> ParsedTurnResult
15
+ end
16
+
17
+ class ResultError < OpenAI::Errors::Error
18
+ attr_reader reason: Symbol
19
+ attr_reader session_id: String?
20
+ attr_reader turn: OpenAI::Models::Beta::Agents::Sessions::Turn?
21
+ attr_reader messages: Array[OpenAI::Models::Beta::AgentSessionMessage]
22
+ attr_reader required_actions: Array[OpenAI::Models::Beta::AgentSession::required_action
23
+ | Hash[Symbol, untyped]]
24
+ def turn_id: -> String?
25
+ end
26
+
27
+ # @api private
28
+ class ResultCollector
29
+ def initialize: (
30
+ ?session_id: String?,
31
+ ?handler_names: Array[String]
32
+ ) -> void
33
+ def enable: -> void
34
+ def observe: (
35
+ OpenAI::Models::Beta::agent_session_event
36
+ | Hash[Symbol, untyped] event
37
+ ) -> void
38
+ def stopped?: -> bool?
39
+ def observe_error: (StandardError error) -> void
40
+ def result: -> TurnResult
41
+ end
42
+
43
+ class ParsedTurnResult < TurnResult
44
+ attr_reader raw_result: TurnResult
45
+ attr_reader output_parsed: untyped
46
+ end
47
+
48
+ class OutputParseError < OpenAI::Errors::Error
49
+ attr_reader raw_result: TurnResult
50
+ end
51
+
52
+ # @api private
53
+ class OutputParser
54
+ def initialize: (
55
+ singleton(OpenAI::Helpers::StructuredOutput::BaseModel) model
56
+ ) -> void
57
+ def prepare_request: (Hash[Symbol, untyped] params) -> void
58
+ def parse: (TurnResult result) -> ParsedTurnResult
59
+ end
60
+
61
+ class CreationStream < OpenAI::Internal::Stream[OpenAI::Models::Beta::agent_session_event]
62
+ def get_final_result: -> TurnResult
63
+ def with_result_collection: -> self
64
+
65
+ # @api private
66
+ def configure_output_parser: (OutputParser? parser) -> self
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,12 @@
1
+ module OpenAI
2
+ module Helpers
3
+ module StructuredOutput
4
+ class BaseModel < OpenAI::Internal::Type::BaseModel
5
+ def self.optional: -> bot
6
+ def self.to_json_schema: -> Hash[Symbol, untyped]
7
+ end
8
+ end
9
+ end
10
+
11
+ class BaseModel = OpenAI::Helpers::StructuredOutput::BaseModel
12
+ end