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
@@ -976,9 +976,10 @@ module OpenAI
976
976
  sig { params(background: OpenAI::Beta::BetaTool::ImageGeneration::Background::OrSymbol).void }
977
977
  attr_writer :background
978
978
 
979
- # Controls fidelity to the original input image(s). This parameter is supported
980
- # for GPT image models that support input fidelity. `gpt-image-2` and
981
- # `gpt-image-2-2026-04-21` ignore this parameter.
979
+ # Control how much effort the model will exert to match the style and features,
980
+ # especially facial features, of input images. Supports `high` and `low` on
981
+ # `gpt-image-1` and `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For
982
+ # `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.
982
983
  sig { returns(T.nilable(OpenAI::Beta::BetaTool::ImageGeneration::InputFidelity::OrSymbol)) }
983
984
  attr_accessor :input_fidelity
984
985
 
@@ -1050,9 +1051,7 @@ module OpenAI
1050
1051
  # the maximum supported resolution is `3840x2160`. The requested size must also
1051
1052
  # satisfy the model's current pixel and edge limits. The standard sizes
1052
1053
  # `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models;
1053
- # `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use
1054
- # one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of
1055
- # `1024x1024`, `1792x1024`, or `1024x1792`.
1054
+ # `auto` is supported for models that allow automatic sizing.
1056
1055
  sig { returns(T.nilable(T.any(String, OpenAI::Beta::BetaTool::ImageGeneration::Size::OrSymbol))) }
1057
1056
  attr_reader :size
1058
1057
 
@@ -1105,9 +1104,10 @@ module OpenAI
1105
1104
  # set the output format to `png` or `webp`.
1106
1105
  background: nil,
1107
1106
 
1108
- # Controls fidelity to the original input image(s). This parameter is supported
1109
- # for GPT image models that support input fidelity. `gpt-image-2` and
1110
- # `gpt-image-2-2026-04-21` ignore this parameter.
1107
+ # Control how much effort the model will exert to match the style and features,
1108
+ # especially facial features, of input images. Supports `high` and `low` on
1109
+ # `gpt-image-1` and `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For
1110
+ # `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.
1111
1111
  input_fidelity: nil,
1112
1112
 
1113
1113
  # Optional mask for inpainting. Contains `image_url` (string, optional) and
@@ -1150,9 +1150,7 @@ module OpenAI
1150
1150
  # the maximum supported resolution is `3840x2160`. The requested size must also
1151
1151
  # satisfy the model's current pixel and edge limits. The standard sizes
1152
1152
  # `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models;
1153
- # `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use
1154
- # one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of
1155
- # `1024x1024`, `1792x1024`, or `1024x1792`.
1153
+ # `auto` is supported for models that allow automatic sizing.
1156
1154
  size: nil,
1157
1155
 
1158
1156
  # The type of the image generation tool. Always `image_generation`.
@@ -1222,9 +1220,10 @@ module OpenAI
1222
1220
  end
1223
1221
  end
1224
1222
 
1225
- # Controls fidelity to the original input image(s). This parameter is supported
1226
- # for GPT image models that support input fidelity. `gpt-image-2` and
1227
- # `gpt-image-2-2026-04-21` ignore this parameter.
1223
+ # Control how much effort the model will exert to match the style and features,
1224
+ # especially facial features, of input images. Supports `high` and `low` on
1225
+ # `gpt-image-1` and `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For
1226
+ # `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.
1228
1227
  module InputFidelity
1229
1228
  extend OpenAI::Internal::Type::Enum
1230
1229
 
@@ -1407,9 +1406,7 @@ module OpenAI
1407
1406
  # the maximum supported resolution is `3840x2160`. The requested size must also
1408
1407
  # satisfy the model's current pixel and edge limits. The standard sizes
1409
1408
  # `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models;
1410
- # `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use
1411
- # one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of
1412
- # `1024x1024`, `1792x1024`, or `1024x1792`.
1409
+ # `auto` is supported for models that allow automatic sizing.
1413
1410
  module Size
1414
1411
  extend OpenAI::Internal::Type::Union
1415
1412
 
@@ -114,8 +114,8 @@ module OpenAI
114
114
  }
115
115
  attr_accessor :files
116
116
 
117
- # Network access policy for the environment. Defaults to disabled for GA requests
118
- # and enabled for beta requests.
117
+ # Network access policy for the environment. If omitted, the API version
118
+ # determines whether network access is enabled or disabled.
119
119
  sig { returns(T.nilable(OpenAI::Beta::EnvironmentParam::OpenAIHosted::Network)) }
120
120
  attr_reader :network
121
121
 
@@ -216,8 +216,8 @@ module OpenAI
216
216
  # Files available before the agent starts. Defaults to an empty list.
217
217
  files: nil,
218
218
 
219
- # Network access policy for the environment. Defaults to disabled for GA requests
220
- # and enabled for beta requests.
219
+ # Network access policy for the environment. If omitted, the API version
220
+ # determines whether network access is enabled or disabled.
221
221
  network: nil,
222
222
 
223
223
  # Packages to install in the environment. Defaults to empty package lists.
@@ -350,8 +350,8 @@ module OpenAI
350
350
  sig { returns(T.nilable(T::Array[String])) }
351
351
  attr_accessor :blocked_domains
352
352
 
353
- # Network access policy for the environment. Defaults to disabled for GA requests
354
- # and enabled for beta requests.
353
+ # Network access policy for the environment. If omitted, the API version
354
+ # determines whether network access is enabled or disabled.
355
355
  sig do
356
356
  params(
357
357
 
@@ -67,6 +67,24 @@ module OpenAI
67
67
  # The organization has reached a usage, plan, or billing limit.
68
68
  USAGE_LIMIT_EXCEEDED = T.let(:usage_limit_exceeded, OpenAI::Beta::SessionTurnError::Code::TaggedSymbol)
69
69
 
70
+ # The project has reached its enforced spend limit.
71
+ PROJECT_SPEND_LIMIT_EXCEEDED = T.let(
72
+ :project_spend_limit_exceeded,
73
+ OpenAI::Beta::SessionTurnError::Code::TaggedSymbol
74
+ )
75
+
76
+ # The organization has reached its enforced spend limit.
77
+ ORGANIZATION_SPEND_LIMIT_EXCEEDED = T.let(
78
+ :organization_spend_limit_exceeded,
79
+ OpenAI::Beta::SessionTurnError::Code::TaggedSymbol
80
+ )
81
+
82
+ # The organization has reached its OpenAI-assigned usage limit.
83
+ ORGANIZATION_USAGE_LIMIT_EXCEEDED = T.let(
84
+ :organization_usage_limit_exceeded,
85
+ OpenAI::Beta::SessionTurnError::Code::TaggedSymbol
86
+ )
87
+
70
88
  # The organization has no API credits remaining.
71
89
  CREDIT_BALANCE_EXHAUSTED = T.let(
72
90
  :credit_balance_exhausted,
@@ -24,7 +24,8 @@ module OpenAI
24
24
  # The voice the model uses to respond. Supported built-in voices are `alloy`,
25
25
  # `ash`, `ballad`, `coral`, `echo`, `fable`, `nova`, `onyx`, `sage`, `shimmer`,
26
26
  # `marin`, and `cedar`. You may also provide a custom voice object with an `id`,
27
- # for example `{ "id": "voice_1234" }`.
27
+ # for example `{ "id": "voice_1234" }`. Custom voices must be created from audio
28
+ # samples. Voices created from text prompts are supported only in Live.
28
29
  sig {
29
30
  returns(
30
31
  T.any(
@@ -61,7 +62,8 @@ module OpenAI
61
62
  # The voice the model uses to respond. Supported built-in voices are `alloy`,
62
63
  # `ash`, `ballad`, `coral`, `echo`, `fable`, `nova`, `onyx`, `sage`, `shimmer`,
63
64
  # `marin`, and `cedar`. You may also provide a custom voice object with an `id`,
64
- # for example `{ "id": "voice_1234" }`.
65
+ # for example `{ "id": "voice_1234" }`. Custom voices must be created from audio
66
+ # samples. Voices created from text prompts are supported only in Live.
65
67
 
66
68
  voice:
67
69
  )
@@ -105,7 +107,8 @@ module OpenAI
105
107
  # The voice the model uses to respond. Supported built-in voices are `alloy`,
106
108
  # `ash`, `ballad`, `coral`, `echo`, `fable`, `nova`, `onyx`, `sage`, `shimmer`,
107
109
  # `marin`, and `cedar`. You may also provide a custom voice object with an `id`,
108
- # for example `{ "id": "voice_1234" }`.
110
+ # for example `{ "id": "voice_1234" }`. Custom voices must be created from audio
111
+ # samples. Voices created from text prompts are supported only in Live.
109
112
  module Voice
110
113
  extend OpenAI::Internal::Type::Union
111
114
 
@@ -228,26 +228,29 @@ module OpenAI
228
228
  )
229
229
  end
230
230
 
231
- # A chat completion delta generated by streamed model responses.
231
+ # A chat completion delta generated by streamed model responses. Streamed audio
232
+ # can arrive in partial updates with an ID, base64 data, or transcript text. The
233
+ # final audio update contains only its expiry timestamp.
232
234
  sig { returns(OpenAI::Chat::ChatCompletionChunk::Choice::Delta) }
233
235
  attr_reader :delta
234
236
 
235
237
  sig { params(delta: OpenAI::Chat::ChatCompletionChunk::Choice::Delta::OrHash).void }
236
238
  attr_writer :delta
237
239
 
240
+ # The index of the choice in the list of choices.
241
+ sig { returns(Integer) }
242
+ attr_accessor :index
243
+
238
244
  # The reason the model stopped generating tokens. This will be `stop` if the model
239
245
  # hit a natural stop point or a provided stop sequence, `length` if the maximum
240
246
  # number of tokens specified in the request was reached, `content_filter` if
241
247
  # content was omitted due to a flag from our content filters, `tool_calls` if the
242
248
  # model called a tool, or `function_call` (deprecated) if the model called a
243
- # function.
249
+ # function. Omitted from the final audio update containing only
250
+ # `delta.audio.expires_at`.
244
251
  sig { returns(T.nilable(OpenAI::Chat::ChatCompletionChunk::Choice::FinishReason::TaggedSymbol)) }
245
252
  attr_accessor :finish_reason
246
253
 
247
- # The index of the choice in the list of choices.
248
- sig { returns(Integer) }
249
- attr_accessor :index
250
-
251
254
  # Log probability information for the choice.
252
255
  sig { returns(T.nilable(OpenAI::Chat::ChatCompletionChunk::Choice::Logprobs)) }
253
256
  attr_reader :logprobs
@@ -260,29 +263,32 @@ module OpenAI
260
263
 
261
264
  delta: OpenAI::Chat::ChatCompletionChunk::Choice::Delta::OrHash,
262
265
 
263
- finish_reason: T.nilable(OpenAI::Chat::ChatCompletionChunk::Choice::FinishReason::OrSymbol),
264
-
265
266
  index: Integer,
266
267
 
268
+ finish_reason: T.nilable(OpenAI::Chat::ChatCompletionChunk::Choice::FinishReason::OrSymbol),
269
+
267
270
  logprobs: T.nilable(OpenAI::Chat::ChatCompletionChunk::Choice::Logprobs::OrHash)
268
271
  )
269
272
  .returns(T.attached_class)
270
273
  end
271
274
  def self.new(
272
275
 
273
- # A chat completion delta generated by streamed model responses.
276
+ # A chat completion delta generated by streamed model responses. Streamed audio
277
+ # can arrive in partial updates with an ID, base64 data, or transcript text. The
278
+ # final audio update contains only its expiry timestamp.
274
279
  delta:,
275
280
 
281
+ # The index of the choice in the list of choices.
282
+ index:,
283
+
276
284
  # The reason the model stopped generating tokens. This will be `stop` if the model
277
285
  # hit a natural stop point or a provided stop sequence, `length` if the maximum
278
286
  # number of tokens specified in the request was reached, `content_filter` if
279
287
  # content was omitted due to a flag from our content filters, `tool_calls` if the
280
288
  # model called a tool, or `function_call` (deprecated) if the model called a
281
- # function.
282
- finish_reason:,
283
-
284
- # The index of the choice in the list of choices.
285
- index:,
289
+ # function. Omitted from the final audio update containing only
290
+ # `delta.audio.expires_at`.
291
+ finish_reason: nil,
286
292
 
287
293
  # Log probability information for the choice.
288
294
 
@@ -294,8 +300,8 @@ module OpenAI
294
300
  override.returns(
295
301
  {
296
302
  delta: OpenAI::Chat::ChatCompletionChunk::Choice::Delta,
297
- finish_reason: T.nilable(OpenAI::Chat::ChatCompletionChunk::Choice::FinishReason::TaggedSymbol),
298
303
  index: Integer,
304
+ finish_reason: T.nilable(OpenAI::Chat::ChatCompletionChunk::Choice::FinishReason::TaggedSymbol),
299
305
  logprobs: T.nilable(OpenAI::Chat::ChatCompletionChunk::Choice::Logprobs)
300
306
  }
301
307
  )
@@ -311,6 +317,14 @@ module OpenAI
311
317
  )
312
318
  end
313
319
 
320
+ # A partial audio response. Audio chunks may carry an ID, base64 data, or
321
+ # transcript text; the final audio update contains only its expiry timestamp.
322
+ sig { returns(T.nilable(OpenAI::Chat::ChatCompletionChunk::Choice::Delta::Audio)) }
323
+ attr_reader :audio
324
+
325
+ sig { params(audio: OpenAI::Chat::ChatCompletionChunk::Choice::Delta::Audio::OrHash).void }
326
+ attr_writer :audio
327
+
314
328
  # The contents of the chunk message.
315
329
  sig { returns(T.nilable(String)) }
316
330
  attr_accessor :content
@@ -342,10 +356,14 @@ module OpenAI
342
356
  }
343
357
  attr_writer :tool_calls
344
358
 
345
- # A chat completion delta generated by streamed model responses.
359
+ # A chat completion delta generated by streamed model responses. Streamed audio
360
+ # can arrive in partial updates with an ID, base64 data, or transcript text. The
361
+ # final audio update contains only its expiry timestamp.
346
362
  sig do
347
363
  params(
348
364
 
365
+ audio: OpenAI::Chat::ChatCompletionChunk::Choice::Delta::Audio::OrHash,
366
+
349
367
  content: T.nilable(String),
350
368
 
351
369
  function_call: OpenAI::Chat::ChatCompletionChunk::Choice::Delta::FunctionCall::OrHash,
@@ -360,6 +378,10 @@ module OpenAI
360
378
  end
361
379
  def self.new(
362
380
 
381
+ # A partial audio response. Audio chunks may carry an ID, base64 data, or
382
+ # transcript text; the final audio update contains only its expiry timestamp.
383
+ audio: nil,
384
+
363
385
  # The contents of the chunk message.
364
386
  content: nil,
365
387
 
@@ -380,6 +402,7 @@ module OpenAI
380
402
  sig do
381
403
  override.returns(
382
404
  {
405
+ audio: OpenAI::Chat::ChatCompletionChunk::Choice::Delta::Audio,
383
406
  content: T.nilable(String),
384
407
  function_call: OpenAI::Chat::ChatCompletionChunk::Choice::Delta::FunctionCall,
385
408
  refusal: T.nilable(String),
@@ -391,6 +414,88 @@ module OpenAI
391
414
  def to_hash
392
415
  end
393
416
 
417
+ class Audio < OpenAI::Internal::Type::BaseModel
418
+ OrHash = T.type_alias do
419
+ T.any(
420
+ OpenAI::Chat::ChatCompletionChunk::Choice::Delta::Audio,
421
+ OpenAI::Internal::AnyHash
422
+ )
423
+ end
424
+
425
+ # Unique identifier for this audio response.
426
+ sig { returns(T.nilable(String)) }
427
+ attr_reader :id
428
+
429
+ sig { params(id: String).void }
430
+ attr_writer :id
431
+
432
+ # Base64 encoded audio bytes generated by the model, in the format specified in
433
+ # the request.
434
+ sig { returns(T.nilable(String)) }
435
+ attr_reader :data
436
+
437
+ sig { params(data: String).void }
438
+ attr_writer :data
439
+
440
+ # The Unix timestamp (in seconds) for when this audio response will no longer be
441
+ # accessible on the server for use in multi-turn conversations.
442
+ sig { returns(T.nilable(Integer)) }
443
+ attr_reader :expires_at
444
+
445
+ sig { params(expires_at: Integer).void }
446
+ attr_writer :expires_at
447
+
448
+ # Transcript text from this audio chunk.
449
+ sig { returns(T.nilable(String)) }
450
+ attr_reader :transcript
451
+
452
+ sig { params(transcript: String).void }
453
+ attr_writer :transcript
454
+
455
+ # A partial audio response. Audio chunks may carry an ID, base64 data, or
456
+ # transcript text; the final audio update contains only its expiry timestamp.
457
+ sig do
458
+ params(
459
+
460
+ id: String,
461
+
462
+ data: String,
463
+
464
+ expires_at: Integer,
465
+
466
+ transcript: String
467
+ )
468
+ .returns(T.attached_class)
469
+ end
470
+ def self.new(
471
+
472
+ # Unique identifier for this audio response.
473
+ id: nil,
474
+
475
+ # Base64 encoded audio bytes generated by the model, in the format specified in
476
+ # the request.
477
+ data: nil,
478
+
479
+ # The Unix timestamp (in seconds) for when this audio response will no longer be
480
+ # accessible on the server for use in multi-turn conversations.
481
+ expires_at: nil,
482
+
483
+ # Transcript text from this audio chunk.
484
+
485
+ transcript: nil
486
+ )
487
+ end
488
+
489
+ sig do
490
+ override.returns(
491
+ {id: String, data: String, expires_at: Integer, transcript: String}
492
+ )
493
+ end
494
+ def to_hash
495
+ end
496
+
497
+ end
498
+
394
499
  class FunctionCall < OpenAI::Internal::Type::BaseModel
395
500
  OrHash = T.type_alias do
396
501
  T.any(
@@ -633,7 +738,8 @@ module OpenAI
633
738
  # number of tokens specified in the request was reached, `content_filter` if
634
739
  # content was omitted due to a flag from our content filters, `tool_calls` if the
635
740
  # model called a tool, or `function_call` (deprecated) if the model called a
636
- # function.
741
+ # function. Omitted from the final audio update containing only
742
+ # `delta.audio.expires_at`.
637
743
  module FinishReason
638
744
  extend OpenAI::Internal::Type::Enum
639
745
 
@@ -95,6 +95,11 @@ module OpenAI
95
95
  sig { params(error_type: T.any(String, OpenAI::ErrorObject::Misalignment::ErrorType::OrSymbol)).void }
96
96
  attr_writer :error_type
97
97
 
98
+ # An opaque target for explicitly continuing this review, or null when
99
+ # unavailable.
100
+ sig { returns(T.nilable(String)) }
101
+ attr_accessor :review_target
102
+
98
103
  # An optional public continuation instruction.
99
104
  sig { returns(T.nilable(OpenAI::ErrorObject::Misalignment::Steer)) }
100
105
  attr_reader :steer
@@ -109,6 +114,8 @@ module OpenAI
109
114
 
110
115
  error_type: T.any(String, OpenAI::ErrorObject::Misalignment::ErrorType::OrSymbol),
111
116
 
117
+ review_target: T.nilable(String),
118
+
112
119
  steer: OpenAI::ErrorObject::Misalignment::Steer::OrHash
113
120
  )
114
121
  .returns(T.attached_class)
@@ -121,6 +128,10 @@ module OpenAI
121
128
  # An optional classification; clients must accept additional values.
122
129
  error_type: nil,
123
130
 
131
+ # An opaque target for explicitly continuing this review, or null when
132
+ # unavailable.
133
+ review_target: nil,
134
+
124
135
  # An optional public continuation instruction.
125
136
 
126
137
  steer: nil
@@ -132,6 +143,7 @@ module OpenAI
132
143
  {
133
144
  detailed_explanation: String,
134
145
  error_type: T.any(String, OpenAI::ErrorObject::Misalignment::ErrorType::OrSymbol),
146
+ review_target: T.nilable(String),
135
147
  steer: OpenAI::ErrorObject::Misalignment::Steer
136
148
  }
137
149
  )
@@ -1021,7 +1021,7 @@ module OpenAI
1021
1021
  # The name of the grader.
1022
1022
  name:,
1023
1023
 
1024
- # The range of the score. Defaults to `[0, 1]`.
1024
+ # The service requires two numbers for the score range. Defaults to `[0, 1]`.
1025
1025
  range: nil,
1026
1026
 
1027
1027
  # The sampling parameters for the model.
@@ -413,7 +413,7 @@ module OpenAI
413
413
  # The name of the grader.
414
414
  name:,
415
415
 
416
- # The range of the score. Defaults to `[0, 1]`.
416
+ # The service requires two numbers for the score range. Defaults to `[0, 1]`.
417
417
  range: nil,
418
418
 
419
419
  # The sampling parameters for the model.
@@ -413,7 +413,7 @@ module OpenAI
413
413
  # The name of the grader.
414
414
  name:,
415
415
 
416
- # The range of the score. Defaults to `[0, 1]`.
416
+ # The service requires two numbers for the score range. Defaults to `[0, 1]`.
417
417
  range: nil,
418
418
 
419
419
  # The sampling parameters for the model.
@@ -413,7 +413,7 @@ module OpenAI
413
413
  # The name of the grader.
414
414
  name:,
415
415
 
416
- # The range of the score. Defaults to `[0, 1]`.
416
+ # The service requires two numbers for the score range. Defaults to `[0, 1]`.
417
417
  range: nil,
418
418
 
419
419
  # The sampling parameters for the model.
@@ -413,7 +413,7 @@ module OpenAI
413
413
  # The name of the grader.
414
414
  name:,
415
415
 
416
- # The range of the score. Defaults to `[0, 1]`.
416
+ # The service requires two numbers for the score range. Defaults to `[0, 1]`.
417
417
  range: nil,
418
418
 
419
419
  # The sampling parameters for the model.
@@ -31,8 +31,13 @@ module OpenAI
31
31
  sig { params(limit: Integer).void }
32
32
  attr_writer :limit
33
33
 
34
- # Optional metadata filter. To filter, use the syntax `metadata[k]=v`.
35
- # Alternatively, set `metadata=null` to indicate no metadata.
34
+ # Optional metadata filter. To filter, use the syntax `metadata[k]=v`. Omitting
35
+ # the parameter or passing an empty object applies no metadata filter. An empty
36
+ # value, such as `metadata[k]=`, filters for that key with an empty string value.
37
+ # To select jobs with null metadata, send the literal query string
38
+ # `metadata=null`. Nullable caller types do not specify how a client serializes
39
+ # null for a deep-object parameter. Use a raw query parameter if the client omits
40
+ # null. Do not combine the two query forms.
36
41
  sig { returns(T.nilable(T::Hash[Symbol, String])) }
37
42
  attr_accessor :metadata
38
43
 
@@ -57,8 +62,13 @@ module OpenAI
57
62
  # Number of fine-tuning jobs to retrieve.
58
63
  limit: nil,
59
64
 
60
- # Optional metadata filter. To filter, use the syntax `metadata[k]=v`.
61
- # Alternatively, set `metadata=null` to indicate no metadata.
65
+ # Optional metadata filter. To filter, use the syntax `metadata[k]=v`. Omitting
66
+ # the parameter or passing an empty object applies no metadata filter. An empty
67
+ # value, such as `metadata[k]=`, filters for that key with an empty string value.
68
+ # To select jobs with null metadata, send the literal query string
69
+ # `metadata=null`. Nullable caller types do not specify how a client serializes
70
+ # null for a deep-object parameter. Use a raw query parameter if the client omits
71
+ # null. Do not combine the two query forms.
62
72
  metadata: nil,
63
73
 
64
74
  request_options: {}
@@ -33,7 +33,7 @@ module OpenAI
33
33
  sig { returns(Symbol) }
34
34
  attr_accessor :type
35
35
 
36
- # The range of the score. Defaults to `[0, 1]`.
36
+ # The service requires two numbers for the score range. Defaults to `[0, 1]`.
37
37
  sig { returns(T.nilable(T::Array[Float])) }
38
38
  attr_reader :range
39
39
 
@@ -77,7 +77,7 @@ module OpenAI
77
77
  # The name of the grader.
78
78
  name:,
79
79
 
80
- # The range of the score. Defaults to `[0, 1]`.
80
+ # The service requires two numbers for the score range. Defaults to `[0, 1]`.
81
81
  range: nil,
82
82
 
83
83
  # The sampling parameters for the model.
@@ -12,25 +12,25 @@ module OpenAI
12
12
  )
13
13
  end
14
14
 
15
- # The base64-encoded JSON of the generated image. Returned by default for the GPT
16
- # image models, and only present if `response_format` is set to `b64_json` for
17
- # `dall-e-2` and `dall-e-3`.
15
+ # The base64-encoded JSON of the generated image. Returned by default for GPT
16
+ # image models, or when `response_format` is set to `b64_json` for models that
17
+ # support that parameter.
18
18
  sig { returns(T.nilable(String)) }
19
19
  attr_reader :b64_json
20
20
 
21
21
  sig { params(b64_json: String).void }
22
22
  attr_writer :b64_json
23
23
 
24
- # For `dall-e-3` only, the revised prompt that was used to generate the image.
24
+ # The revised prompt used to generate the image, for models that support prompt
25
+ # revision. Not returned by GPT image models.
25
26
  sig { returns(T.nilable(String)) }
26
27
  attr_reader :revised_prompt
27
28
 
28
29
  sig { params(revised_prompt: String).void }
29
30
  attr_writer :revised_prompt
30
31
 
31
- # When using `dall-e-2` or `dall-e-3`, the URL of the generated image if
32
- # `response_format` is set to `url` (default value). Unsupported for the GPT image
33
- # models.
32
+ # The URL of the generated image when `response_format` is set to `url` for models
33
+ # that support that parameter. Unsupported for GPT image models.
34
34
  sig { returns(T.nilable(String)) }
35
35
  attr_reader :url
36
36
 
@@ -51,17 +51,17 @@ module OpenAI
51
51
  end
52
52
  def self.new(
53
53
 
54
- # The base64-encoded JSON of the generated image. Returned by default for the GPT
55
- # image models, and only present if `response_format` is set to `b64_json` for
56
- # `dall-e-2` and `dall-e-3`.
54
+ # The base64-encoded JSON of the generated image. Returned by default for GPT
55
+ # image models, or when `response_format` is set to `b64_json` for models that
56
+ # support that parameter.
57
57
  b64_json: nil,
58
58
 
59
- # For `dall-e-3` only, the revised prompt that was used to generate the image.
59
+ # The revised prompt used to generate the image, for models that support prompt
60
+ # revision. Not returned by GPT image models.
60
61
  revised_prompt: nil,
61
62
 
62
- # When using `dall-e-2` or `dall-e-3`, the URL of the generated image if
63
- # `response_format` is set to `url` (default value). Unsupported for the GPT image
64
- # models.
63
+ # The URL of the generated image when `response_format` is set to `url` for models
64
+ # that support that parameter. Unsupported for GPT image models.
65
65
 
66
66
  url: nil
67
67
  )
@@ -24,8 +24,8 @@ module OpenAI
24
24
  sig { returns(OpenAI::Internal::FileInput) }
25
25
  attr_accessor :image
26
26
 
27
- # The model to use for image generation. Only `dall-e-2` is supported at this
28
- # time.
27
+ # The legacy model used by the retired image variations endpoint. This endpoint no
28
+ # longer accepts requests.
29
29
  sig { returns(T.nilable(T.any(String, OpenAI::ImageModel::OrSymbol))) }
30
30
  attr_accessor :model
31
31
 
@@ -82,8 +82,8 @@ module OpenAI
82
82
  # content type.
83
83
  image:,
84
84
 
85
- # The model to use for image generation. Only `dall-e-2` is supported at this
86
- # time.
85
+ # The legacy model used by the retired image variations endpoint. This endpoint no
86
+ # longer accepts requests.
87
87
  model: nil,
88
88
 
89
89
  # The number of images to generate. Must be between 1 and 10.
@@ -123,8 +123,8 @@ module OpenAI
123
123
  def to_hash
124
124
  end
125
125
 
126
- # The model to use for image generation. Only `dall-e-2` is supported at this
127
- # time.
126
+ # The legacy model used by the retired image variations endpoint. This endpoint no
127
+ # longer accepts requests.
128
128
  module Model
129
129
  extend OpenAI::Internal::Type::Union
130
130