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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -0
- data/README.md +1 -1
- data/bedrock.md +17 -1
- data/lib/openai/client.rb +9 -0
- data/lib/openai/helpers/agents/session_stream.rb +11 -36
- data/lib/openai/helpers/agents/tools.rb +34 -4
- data/lib/openai/helpers/beta/agents/creation_stream.rb +26 -0
- data/lib/openai/helpers/beta/agents/function_tool.rb +11 -4
- data/lib/openai/helpers/beta/agents/tool_dispatcher.rb +74 -0
- data/lib/openai/helpers/beta/agents/tool_error.rb +28 -0
- data/lib/openai/models/admin/organization/usage_audio_speeches_response.rb +140 -5
- data/lib/openai/models/admin/organization/usage_audio_transcriptions_response.rb +140 -5
- data/lib/openai/models/admin/organization/usage_code_interpreter_sessions_response.rb +140 -5
- data/lib/openai/models/admin/organization/usage_completions_params.rb +9 -4
- data/lib/openai/models/admin/organization/usage_completions_response.rb +140 -5
- data/lib/openai/models/admin/organization/usage_costs_params.rb +16 -4
- data/lib/openai/models/admin/organization/usage_costs_response.rb +140 -5
- data/lib/openai/models/admin/organization/usage_embeddings_response.rb +140 -5
- data/lib/openai/models/admin/organization/usage_file_search_calls_response.rb +140 -5
- data/lib/openai/models/admin/organization/usage_images_response.rb +140 -5
- data/lib/openai/models/admin/organization/usage_moderations_response.rb +140 -5
- data/lib/openai/models/admin/organization/usage_vector_stores_response.rb +140 -5
- data/lib/openai/models/admin/organization/usage_web_search_calls_params.rb +9 -4
- data/lib/openai/models/admin/organization/usage_web_search_calls_response.rb +140 -5
- data/lib/openai/models/all_models.rb +42 -0
- data/lib/openai/models/audio/speech_create_params.rb +6 -0
- data/lib/openai/models/audio/voice.rb +75 -0
- data/lib/openai/models/audio/voice_create_params.rb +217 -0
- data/lib/openai/models/beta/agent_create_params.rb +0 -3
- data/lib/openai/models/beta/agent_update_params.rb +0 -3
- data/lib/openai/models/beta/agents/environments/template_create_params.rb +6 -6
- data/lib/openai/models/beta/agents/environments/template_update_params.rb +3 -6
- data/lib/openai/models/beta/agents/session_create_params.rb +0 -3
- data/lib/openai/models/beta/agents/session_update_params.rb +0 -3
- data/lib/openai/models/beta/agents/sessions/turns/item_list_params.rb +79 -0
- data/lib/openai/models/beta/beta_response.rb +220 -0
- data/lib/openai/models/beta/beta_response_computer_tool_call_output_item.rb +2 -2
- data/lib/openai/models/beta/beta_response_error.rb +12 -1
- data/lib/openai/models/beta/beta_responses_client_event.rb +220 -0
- data/lib/openai/models/beta/beta_responses_server_event.rb +12 -1
- data/lib/openai/models/beta/beta_tool.rb +15 -18
- data/lib/openai/models/beta/environment_param.rb +6 -6
- data/lib/openai/models/beta/response_compact_params.rb +220 -0
- data/lib/openai/models/beta/response_create_params.rb +220 -0
- data/lib/openai/models/beta/session_turn_error.rb +9 -0
- data/lib/openai/models/chat/chat_completion_audio_param.rb +6 -3
- data/lib/openai/models/chat/chat_completion_chunk.rb +85 -18
- data/lib/openai/models/chat_model.rb +178 -0
- data/lib/openai/models/error_object.rb +12 -1
- data/lib/openai/models/eval_create_params.rb +1 -1
- data/lib/openai/models/eval_create_response.rb +1 -1
- data/lib/openai/models/eval_list_response.rb +1 -1
- data/lib/openai/models/eval_retrieve_response.rb +1 -1
- data/lib/openai/models/eval_update_response.rb +1 -1
- data/lib/openai/models/fine_tuning/job_list_params.rb +14 -4
- data/lib/openai/models/graders/score_model_grader.rb +2 -2
- data/lib/openai/models/image.rb +14 -14
- data/lib/openai/models/image_create_variation_params.rb +7 -7
- data/lib/openai/models/image_edit_params.rb +88 -96
- data/lib/openai/models/image_generate_params.rb +51 -62
- data/lib/openai/models/image_model.rb +5 -3
- data/lib/openai/models/realtime/realtime_audio_config_output.rb +9 -6
- data/lib/openai/models/realtime/realtime_client_event.rb +9 -0
- data/lib/openai/models/realtime/realtime_response_create_audio_output.rb +9 -6
- data/lib/openai/models/realtime/session_update_event.rb +16 -0
- data/lib/openai/models/responses/response_compact_params.rb +220 -0
- data/lib/openai/models/responses/response_computer_tool_call_output_item.rb +2 -2
- data/lib/openai/models/responses/response_error.rb +12 -1
- data/lib/openai/models/responses/responses_server_event.rb +12 -1
- data/lib/openai/models/responses/tool.rb +15 -18
- data/lib/openai/models/responses_model.rb +42 -0
- data/lib/openai/models/video_create_error.rb +12 -1
- data/lib/openai/models/webhooks/agent_session_action_required_webhook_event.rb +109 -0
- data/lib/openai/models/webhooks/agent_session_created_webhook_event.rb +106 -0
- data/lib/openai/models/webhooks/agent_session_failed_webhook_event.rb +86 -0
- data/lib/openai/models/webhooks/agent_session_idle_webhook_event.rb +86 -0
- data/lib/openai/models/webhooks/agent_session_in_progress_webhook_event.rb +86 -0
- data/lib/openai/models/webhooks/unwrap_webhook_event.rb +18 -2
- data/lib/openai/models/webhooks/webhook_create_params.rb +5 -0
- data/lib/openai/models/webhooks/webhook_test_params.rb +5 -0
- data/lib/openai/models/webhooks/webhook_update_params.rb +5 -0
- data/lib/openai/providers/bedrock.rb +20 -1
- data/lib/openai/resources/admin/organization/usage.rb +15 -6
- data/lib/openai/resources/audio/speech.rb +2 -0
- data/lib/openai/resources/audio/voices.rb +53 -0
- data/lib/openai/resources/audio.rb +5 -0
- data/lib/openai/resources/beta/agents/environments/templates.rb +3 -4
- data/lib/openai/resources/beta/agents/sessions/turns/items.rb +68 -0
- data/lib/openai/resources/beta/agents/sessions/turns.rb +4 -0
- data/lib/openai/resources/beta/agents/sessions.rb +22 -2
- data/lib/openai/resources/fine_tuning/jobs.rb +7 -2
- data/lib/openai/resources/images.rb +79 -109
- data/lib/openai/resources/webhooks.rb +1 -1
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +10 -0
- data/rbi/openai/helpers/agents.rbi +2 -0
- data/rbi/openai/helpers/beta/agents/function_tool.rbi +8 -3
- data/rbi/openai/helpers/beta/agents/tool_error.rbi +19 -0
- data/rbi/openai/helpers/beta/agents.rbi +12 -0
- data/rbi/openai/models/admin/organization/usage_audio_speeches_response.rbi +213 -3
- data/rbi/openai/models/admin/organization/usage_audio_transcriptions_response.rbi +213 -3
- data/rbi/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbi +213 -3
- data/rbi/openai/models/admin/organization/usage_completions_params.rbi +9 -4
- data/rbi/openai/models/admin/organization/usage_completions_response.rbi +213 -3
- data/rbi/openai/models/admin/organization/usage_costs_params.rbi +16 -4
- data/rbi/openai/models/admin/organization/usage_costs_response.rbi +213 -3
- data/rbi/openai/models/admin/organization/usage_embeddings_response.rbi +213 -3
- data/rbi/openai/models/admin/organization/usage_file_search_calls_response.rbi +213 -3
- data/rbi/openai/models/admin/organization/usage_images_response.rbi +213 -3
- data/rbi/openai/models/admin/organization/usage_moderations_response.rbi +213 -3
- data/rbi/openai/models/admin/organization/usage_vector_stores_response.rbi +213 -3
- data/rbi/openai/models/admin/organization/usage_web_search_calls_params.rbi +12 -4
- data/rbi/openai/models/admin/organization/usage_web_search_calls_response.rbi +213 -3
- data/rbi/openai/models/audio/speech_create_params.rbi +6 -0
- data/rbi/openai/models/audio/voice.rbi +111 -0
- data/rbi/openai/models/audio/voice_create_params.rbi +321 -0
- data/rbi/openai/models/beta/agent_create_params.rbi +0 -3
- data/rbi/openai/models/beta/agent_update_params.rbi +0 -3
- data/rbi/openai/models/beta/agents/environments/template_create_params.rbi +6 -6
- data/rbi/openai/models/beta/agents/environments/template_update_params.rbi +3 -6
- data/rbi/openai/models/beta/agents/session_create_params.rbi +0 -3
- data/rbi/openai/models/beta/agents/session_update_params.rbi +0 -3
- data/rbi/openai/models/beta/agents/sessions/turns/item_list_params.rbi +139 -0
- data/rbi/openai/models/beta/beta_response_computer_tool_call_output_item.rbi +2 -2
- data/rbi/openai/models/beta/beta_response_error.rbi +12 -0
- data/rbi/openai/models/beta/beta_responses_server_event.rbi +12 -0
- data/rbi/openai/models/beta/beta_tool.rbi +15 -18
- data/rbi/openai/models/beta/environment_param.rbi +6 -6
- data/rbi/openai/models/beta/session_turn_error.rbi +18 -0
- data/rbi/openai/models/chat/chat_completion_audio_param.rbi +6 -3
- data/rbi/openai/models/chat/chat_completion_chunk.rbi +123 -17
- data/rbi/openai/models/error_object.rbi +12 -0
- data/rbi/openai/models/eval_create_params.rbi +1 -1
- data/rbi/openai/models/eval_create_response.rbi +1 -1
- data/rbi/openai/models/eval_list_response.rbi +1 -1
- data/rbi/openai/models/eval_retrieve_response.rbi +1 -1
- data/rbi/openai/models/eval_update_response.rbi +1 -1
- data/rbi/openai/models/fine_tuning/job_list_params.rbi +14 -4
- data/rbi/openai/models/graders/score_model_grader.rbi +2 -2
- data/rbi/openai/models/image.rbi +14 -14
- data/rbi/openai/models/image_create_variation_params.rbi +6 -6
- data/rbi/openai/models/image_edit_params.rbi +73 -91
- data/rbi/openai/models/image_generate_params.rbi +30 -61
- data/rbi/openai/models/image_model.rbi +3 -3
- data/rbi/openai/models/realtime/realtime_audio_config_output.rbi +9 -6
- data/rbi/openai/models/realtime/realtime_response_create_audio_output.rbi +9 -6
- data/rbi/openai/models/realtime/session_update_event.rbi +16 -0
- data/rbi/openai/models/responses/response_computer_tool_call_output_item.rbi +2 -2
- data/rbi/openai/models/responses/response_error.rbi +12 -0
- data/rbi/openai/models/responses/responses_server_event.rbi +12 -0
- data/rbi/openai/models/responses/tool.rbi +15 -18
- data/rbi/openai/models/video_create_error.rbi +12 -0
- data/rbi/openai/models/webhooks/agent_session_action_required_webhook_event.rbi +222 -0
- data/rbi/openai/models/webhooks/agent_session_created_webhook_event.rbi +202 -0
- data/rbi/openai/models/webhooks/agent_session_failed_webhook_event.rbi +151 -0
- data/rbi/openai/models/webhooks/agent_session_idle_webhook_event.rbi +151 -0
- data/rbi/openai/models/webhooks/agent_session_in_progress_webhook_event.rbi +151 -0
- data/rbi/openai/models/webhooks/unwrap_webhook_event.rbi +7 -1
- data/rbi/openai/models/webhooks/webhook_create_params.rbi +20 -0
- data/rbi/openai/models/webhooks/webhook_test_params.rbi +20 -0
- data/rbi/openai/models/webhooks/webhook_update_params.rbi +20 -0
- data/rbi/openai/resources/admin/organization/usage.rbi +15 -6
- data/rbi/openai/resources/audio/speech.rbi +2 -0
- data/rbi/openai/resources/audio/voices.rbi +49 -0
- data/rbi/openai/resources/audio.rbi +4 -0
- data/rbi/openai/resources/beta/agents/environments/templates.rbi +3 -4
- data/rbi/openai/resources/beta/agents/sessions/turns/items.rbi +62 -0
- data/rbi/openai/resources/beta/agents/sessions/turns.rbi +3 -0
- data/rbi/openai/resources/beta/agents/sessions.rbi +2 -0
- data/rbi/openai/resources/fine_tuning/jobs.rbi +7 -2
- data/rbi/openai/resources/images.rbi +77 -109
- data/rbi/openai/resources/webhooks.rbi +5 -0
- data/sig/openai/helpers/agents.rbs +3 -0
- data/sig/openai/helpers/beta/agents/function_tool.rbs +5 -2
- data/sig/openai/helpers/beta/agents/tool_error.rbs +17 -0
- data/sig/openai/helpers/beta/agents.rbs +5 -0
- data/sig/openai/models/admin/organization/usage_audio_speeches_response.rbs +107 -5
- data/sig/openai/models/admin/organization/usage_audio_transcriptions_response.rbs +107 -5
- data/sig/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbs +107 -5
- data/sig/openai/models/admin/organization/usage_completions_params.rbs +14 -6
- data/sig/openai/models/admin/organization/usage_completions_response.rbs +107 -5
- data/sig/openai/models/admin/organization/usage_costs_params.rbs +25 -7
- data/sig/openai/models/admin/organization/usage_costs_response.rbs +107 -5
- data/sig/openai/models/admin/organization/usage_embeddings_response.rbs +107 -5
- data/sig/openai/models/admin/organization/usage_file_search_calls_response.rbs +107 -5
- data/sig/openai/models/admin/organization/usage_images_response.rbs +107 -5
- data/sig/openai/models/admin/organization/usage_moderations_response.rbs +107 -5
- data/sig/openai/models/admin/organization/usage_vector_stores_response.rbs +107 -5
- data/sig/openai/models/admin/organization/usage_web_search_calls_params.rbs +19 -7
- data/sig/openai/models/admin/organization/usage_web_search_calls_response.rbs +107 -5
- data/sig/openai/models/audio/speech_create_params.rbs +4 -0
- data/sig/openai/models/audio/voice.rbs +70 -0
- data/sig/openai/models/audio/voice_create_params.rbs +203 -0
- data/sig/openai/models/beta/agent_create_params.rbs +1 -5
- data/sig/openai/models/beta/agent_update_params.rbs +1 -5
- data/sig/openai/models/beta/agents/environments/template_create_params.rbs +4 -4
- data/sig/openai/models/beta/agents/environments/template_update_params.rbs +2 -4
- data/sig/openai/models/beta/agents/session_create_params.rbs +1 -5
- data/sig/openai/models/beta/agents/session_update_params.rbs +1 -5
- data/sig/openai/models/beta/agents/sessions/turns/item_list_params.rbs +91 -0
- data/sig/openai/models/beta/beta_response_computer_tool_call_output_item.rbs +2 -2
- data/sig/openai/models/beta/beta_response_error.rbs +10 -0
- data/sig/openai/models/beta/beta_responses_server_event.rbs +10 -0
- data/sig/openai/models/beta/beta_tool.rbs +11 -15
- data/sig/openai/models/beta/environment_param.rbs +4 -4
- data/sig/openai/models/beta/session_turn_error.rbs +12 -0
- data/sig/openai/models/chat/chat_completion_audio_param.rbs +4 -2
- data/sig/openai/models/chat/chat_completion_chunk.rbs +96 -12
- data/sig/openai/models/error_object.rbs +10 -0
- data/sig/openai/models/eval_create_params.rbs +1 -1
- data/sig/openai/models/eval_create_response.rbs +1 -1
- data/sig/openai/models/eval_list_response.rbs +1 -1
- data/sig/openai/models/eval_retrieve_response.rbs +1 -1
- data/sig/openai/models/eval_update_response.rbs +1 -1
- data/sig/openai/models/fine_tuning/job_list_params.rbs +14 -4
- data/sig/openai/models/graders/score_model_grader.rbs +3 -3
- data/sig/openai/models/image.rbs +21 -21
- data/sig/openai/models/image_create_variation_params.rbs +4 -4
- data/sig/openai/models/image_edit_params.rbs +54 -66
- data/sig/openai/models/image_generate_params.rbs +23 -45
- data/sig/openai/models/image_model.rbs +6 -6
- data/sig/openai/models/realtime/realtime_audio_config_output.rbs +9 -6
- data/sig/openai/models/realtime/realtime_response_create_audio_output.rbs +9 -6
- data/sig/openai/models/responses/response_computer_tool_call_output_item.rbs +2 -2
- data/sig/openai/models/responses/response_error.rbs +10 -0
- data/sig/openai/models/responses/responses_server_event.rbs +10 -0
- data/sig/openai/models/responses/tool.rbs +11 -15
- data/sig/openai/models/video_create_error.rbs +10 -0
- data/sig/openai/models/webhooks/agent_session_action_required_webhook_event.rbs +114 -0
- data/sig/openai/models/webhooks/agent_session_created_webhook_event.rbs +115 -0
- data/sig/openai/models/webhooks/agent_session_failed_webhook_event.rbs +89 -0
- data/sig/openai/models/webhooks/agent_session_idle_webhook_event.rbs +89 -0
- data/sig/openai/models/webhooks/agent_session_in_progress_webhook_event.rbs +89 -0
- data/sig/openai/models/webhooks/unwrap_webhook_event.rbs +6 -1
- data/sig/openai/models/webhooks/webhook_create_params.rbs +10 -0
- data/sig/openai/models/webhooks/webhook_test_params.rbs +10 -0
- data/sig/openai/models/webhooks/webhook_update_params.rbs +10 -0
- data/sig/openai/resources/audio/voices.rbs +14 -0
- data/sig/openai/resources/audio.rbs +2 -0
- data/sig/openai/resources/beta/agents/sessions/turns/items.rbs +24 -0
- data/sig/openai/resources/beta/agents/sessions/turns.rbs +2 -0
- data/sig/openai/resources/beta/agents/sessions.rbs +1 -0
- data/sig/openai/resources/webhooks.rbs +6 -1
- metadata +35 -1
|
@@ -4,7 +4,11 @@ module OpenAI
|
|
|
4
4
|
module Resources
|
|
5
5
|
# Given a prompt and/or an input image, the model will generate a new image.
|
|
6
6
|
class Images
|
|
7
|
-
#
|
|
7
|
+
# @deprecated
|
|
8
|
+
#
|
|
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.
|
|
8
12
|
#
|
|
9
13
|
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
10
14
|
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
@@ -21,8 +25,8 @@ module OpenAI
|
|
|
21
25
|
# content type.
|
|
22
26
|
#
|
|
23
27
|
# @param model [String, Symbol, OpenAI::Models::ImageModel, nil]
|
|
24
|
-
# The model
|
|
25
|
-
#
|
|
28
|
+
# The legacy model used by the retired image variations endpoint. This endpoint no
|
|
29
|
+
# longer accepts requests.
|
|
26
30
|
#
|
|
27
31
|
# @param n [Integer, nil]
|
|
28
32
|
# The number of images to generate. Must be between 1 and 10.
|
|
@@ -62,7 +66,7 @@ module OpenAI
|
|
|
62
66
|
# See {OpenAI::Resources::Images#edit_stream_raw} for streaming counterpart.
|
|
63
67
|
#
|
|
64
68
|
# Creates an edited or extended image given one or more source images and a
|
|
65
|
-
# prompt. This endpoint supports GPT Image models
|
|
69
|
+
# prompt. This endpoint supports GPT Image models.
|
|
66
70
|
#
|
|
67
71
|
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
68
72
|
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
@@ -80,16 +84,13 @@ module OpenAI
|
|
|
80
84
|
# be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16
|
|
81
85
|
# images.
|
|
82
86
|
#
|
|
83
|
-
# For `dall-e-2`, you can only provide one image, and it should be a square `png`
|
|
84
|
-
# file less than 4MB.
|
|
85
|
-
#
|
|
86
87
|
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
87
88
|
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
88
89
|
# content type.
|
|
89
90
|
#
|
|
90
91
|
# @param prompt [String]
|
|
91
|
-
# A text description of the desired image(s). The maximum length is
|
|
92
|
-
# characters for
|
|
92
|
+
# A text description of the desired image(s). The maximum length is 32000
|
|
93
|
+
# characters for the GPT image models.
|
|
93
94
|
#
|
|
94
95
|
# @param background [Symbol, OpenAI::Models::ImageEditParams::Background, nil]
|
|
95
96
|
# Allows to set transparency for the background of the generated image(s). Must be
|
|
@@ -103,9 +104,10 @@ module OpenAI
|
|
|
103
104
|
# set the output format to `png` or `webp`.
|
|
104
105
|
#
|
|
105
106
|
# @param input_fidelity [Symbol, OpenAI::Models::ImageEditParams::InputFidelity, nil]
|
|
106
|
-
#
|
|
107
|
-
#
|
|
108
|
-
# `gpt-image-
|
|
107
|
+
# Control how much effort the model will exert to match the style and features,
|
|
108
|
+
# especially facial features, of input images. Supports `high` and `low` on
|
|
109
|
+
# `gpt-image-1` and `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For
|
|
110
|
+
# `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.
|
|
109
111
|
#
|
|
110
112
|
# @param mask [Pathname, StringIO, IO, String, OpenAI::FilePart]
|
|
111
113
|
# An additional image whose fully transparent areas (e.g. where alpha is zero)
|
|
@@ -118,12 +120,11 @@ module OpenAI
|
|
|
118
120
|
# content type.
|
|
119
121
|
#
|
|
120
122
|
# @param model [String, Symbol, OpenAI::Models::ImageModel, nil]
|
|
121
|
-
# The model to use for image
|
|
122
|
-
#
|
|
123
|
-
# `gpt-image-2-
|
|
124
|
-
# `gpt-image-2.5-
|
|
125
|
-
# `
|
|
126
|
-
# `gpt-image-1.5`.
|
|
123
|
+
# The GPT image model to use for image editing (`gpt-image-1`, `gpt-image-1-mini`,
|
|
124
|
+
# `gpt-image-1.5`, `gpt-image-2`, `gpt-image-2-2026-04-21`,
|
|
125
|
+
# `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
|
|
126
|
+
# `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, or
|
|
127
|
+
# `chatgpt-image-latest`).
|
|
127
128
|
#
|
|
128
129
|
# @param n [Integer, nil]
|
|
129
130
|
# The number of images to generate. Must be between 1 and 10.
|
|
@@ -153,24 +154,21 @@ module OpenAI
|
|
|
153
154
|
# `xhigh` and `max`. Defaults to `auto`.
|
|
154
155
|
#
|
|
155
156
|
# @param response_format [Symbol, OpenAI::Models::ImageEditParams::ResponseFormat, nil]
|
|
156
|
-
#
|
|
157
|
-
#
|
|
158
|
-
# generated. This parameter is only supported for `dall-e-2` (default is `url` for
|
|
159
|
-
# `dall-e-2`), as GPT image models always return base64-encoded images.
|
|
157
|
+
# Legacy response format parameter for retired image models. Unsupported for GPT
|
|
158
|
+
# image models, which always return base64-encoded images.
|
|
160
159
|
#
|
|
161
160
|
# @param size [String, Symbol, OpenAI::Models::ImageEditParams::Size, nil]
|
|
162
|
-
# The size of the generated images.
|
|
163
|
-
# `gpt-image-2
|
|
164
|
-
# `gpt-image-2.5-
|
|
165
|
-
# resolutions are supported as
|
|
166
|
-
# Width and height must both be
|
|
167
|
-
# must be between 1:3 and 3:1.
|
|
168
|
-
#
|
|
169
|
-
#
|
|
170
|
-
#
|
|
171
|
-
# `
|
|
172
|
-
#
|
|
173
|
-
# `1024x1024`, `1792x1024`, or `1024x1792`.
|
|
161
|
+
# The size of the generated images. Defaults to `auto`. For `gpt-image-2`,
|
|
162
|
+
# `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
|
|
163
|
+
# `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and
|
|
164
|
+
# `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as
|
|
165
|
+
# `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be
|
|
166
|
+
# divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1.
|
|
167
|
+
# Resolutions above `2560x1440` are experimental, and the maximum supported
|
|
168
|
+
# resolution is `3840x2160`. The requested size must also satisfy the model's
|
|
169
|
+
# current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and
|
|
170
|
+
# `1024x1536` are supported by the GPT image models; `auto` is supported for
|
|
171
|
+
# models that allow automatic sizing.
|
|
174
172
|
#
|
|
175
173
|
# @param user [String]
|
|
176
174
|
# A unique identifier representing your end-user, which can help OpenAI to monitor
|
|
@@ -203,7 +201,7 @@ module OpenAI
|
|
|
203
201
|
# See {OpenAI::Resources::Images#edit} for non-streaming counterpart.
|
|
204
202
|
#
|
|
205
203
|
# Creates an edited or extended image given one or more source images and a
|
|
206
|
-
# prompt. This endpoint supports GPT Image models
|
|
204
|
+
# prompt. This endpoint supports GPT Image models.
|
|
207
205
|
#
|
|
208
206
|
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
209
207
|
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
@@ -221,16 +219,13 @@ module OpenAI
|
|
|
221
219
|
# be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16
|
|
222
220
|
# images.
|
|
223
221
|
#
|
|
224
|
-
# For `dall-e-2`, you can only provide one image, and it should be a square `png`
|
|
225
|
-
# file less than 4MB.
|
|
226
|
-
#
|
|
227
222
|
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
228
223
|
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
229
224
|
# content type.
|
|
230
225
|
#
|
|
231
226
|
# @param prompt [String]
|
|
232
|
-
# A text description of the desired image(s). The maximum length is
|
|
233
|
-
# characters for
|
|
227
|
+
# A text description of the desired image(s). The maximum length is 32000
|
|
228
|
+
# characters for the GPT image models.
|
|
234
229
|
#
|
|
235
230
|
# @param background [Symbol, OpenAI::Models::ImageEditParams::Background, nil]
|
|
236
231
|
# Allows to set transparency for the background of the generated image(s). Must be
|
|
@@ -244,9 +239,10 @@ module OpenAI
|
|
|
244
239
|
# set the output format to `png` or `webp`.
|
|
245
240
|
#
|
|
246
241
|
# @param input_fidelity [Symbol, OpenAI::Models::ImageEditParams::InputFidelity, nil]
|
|
247
|
-
#
|
|
248
|
-
#
|
|
249
|
-
# `gpt-image-
|
|
242
|
+
# Control how much effort the model will exert to match the style and features,
|
|
243
|
+
# especially facial features, of input images. Supports `high` and `low` on
|
|
244
|
+
# `gpt-image-1` and `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For
|
|
245
|
+
# `gpt-image-2`, omit this parameter. Defaults to `low` on supported models.
|
|
250
246
|
#
|
|
251
247
|
# @param mask [Pathname, StringIO, IO, String, OpenAI::FilePart]
|
|
252
248
|
# An additional image whose fully transparent areas (e.g. where alpha is zero)
|
|
@@ -259,12 +255,11 @@ module OpenAI
|
|
|
259
255
|
# content type.
|
|
260
256
|
#
|
|
261
257
|
# @param model [String, Symbol, OpenAI::Models::ImageModel, nil]
|
|
262
|
-
# The model to use for image
|
|
263
|
-
#
|
|
264
|
-
# `gpt-image-2-
|
|
265
|
-
# `gpt-image-2.5-
|
|
266
|
-
# `
|
|
267
|
-
# `gpt-image-1.5`.
|
|
258
|
+
# The GPT image model to use for image editing (`gpt-image-1`, `gpt-image-1-mini`,
|
|
259
|
+
# `gpt-image-1.5`, `gpt-image-2`, `gpt-image-2-2026-04-21`,
|
|
260
|
+
# `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
|
|
261
|
+
# `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, or
|
|
262
|
+
# `chatgpt-image-latest`).
|
|
268
263
|
#
|
|
269
264
|
# @param n [Integer, nil]
|
|
270
265
|
# The number of images to generate. Must be between 1 and 10.
|
|
@@ -294,24 +289,21 @@ module OpenAI
|
|
|
294
289
|
# `xhigh` and `max`. Defaults to `auto`.
|
|
295
290
|
#
|
|
296
291
|
# @param response_format [Symbol, OpenAI::Models::ImageEditParams::ResponseFormat, nil]
|
|
297
|
-
#
|
|
298
|
-
#
|
|
299
|
-
# generated. This parameter is only supported for `dall-e-2` (default is `url` for
|
|
300
|
-
# `dall-e-2`), as GPT image models always return base64-encoded images.
|
|
292
|
+
# Legacy response format parameter for retired image models. Unsupported for GPT
|
|
293
|
+
# image models, which always return base64-encoded images.
|
|
301
294
|
#
|
|
302
295
|
# @param size [String, Symbol, OpenAI::Models::ImageEditParams::Size, nil]
|
|
303
|
-
# The size of the generated images.
|
|
304
|
-
# `gpt-image-2
|
|
305
|
-
# `gpt-image-2.5-
|
|
306
|
-
# resolutions are supported as
|
|
307
|
-
# Width and height must both be
|
|
308
|
-
# must be between 1:3 and 3:1.
|
|
309
|
-
#
|
|
310
|
-
#
|
|
311
|
-
#
|
|
312
|
-
# `
|
|
313
|
-
#
|
|
314
|
-
# `1024x1024`, `1792x1024`, or `1024x1792`.
|
|
296
|
+
# The size of the generated images. Defaults to `auto`. For `gpt-image-2`,
|
|
297
|
+
# `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
|
|
298
|
+
# `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and
|
|
299
|
+
# `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as
|
|
300
|
+
# `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be
|
|
301
|
+
# divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1.
|
|
302
|
+
# Resolutions above `2560x1440` are experimental, and the maximum supported
|
|
303
|
+
# resolution is `3840x2160`. The requested size must also satisfy the model's
|
|
304
|
+
# current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and
|
|
305
|
+
# `1024x1536` are supported by the GPT image models; `auto` is supported for
|
|
306
|
+
# models that allow automatic sizing.
|
|
315
307
|
#
|
|
316
308
|
# @param user [String]
|
|
317
309
|
# A unique identifier representing your end-user, which can help OpenAI to monitor
|
|
@@ -349,15 +341,14 @@ module OpenAI
|
|
|
349
341
|
|
|
350
342
|
# See {OpenAI::Resources::Images#generate_stream_raw} for streaming counterpart.
|
|
351
343
|
#
|
|
352
|
-
# Creates an image given a prompt.
|
|
344
|
+
# Creates an image given a prompt using a GPT Image model.
|
|
353
345
|
# [Learn more](https://developers.openai.com/api/docs/guides/images-vision).
|
|
354
346
|
#
|
|
355
347
|
# @overload generate(prompt:, background: nil, model: nil, moderation: nil, n: nil, output_compression: nil, output_format: nil, partial_images: nil, quality: nil, response_format: nil, size: nil, style: nil, user: nil, request_options: {})
|
|
356
348
|
#
|
|
357
349
|
# @param prompt [String]
|
|
358
350
|
# A text description of the desired image(s). The maximum length is 32000
|
|
359
|
-
# characters
|
|
360
|
-
# characters for `dall-e-3`.
|
|
351
|
+
# characters.
|
|
361
352
|
#
|
|
362
353
|
# @param background [Symbol, OpenAI::Models::ImageGenerateParams::Background, nil]
|
|
363
354
|
# Allows to set transparency for the background of the generated image(s). Must be
|
|
@@ -371,12 +362,11 @@ module OpenAI
|
|
|
371
362
|
# set the output format to `png` or `webp`.
|
|
372
363
|
#
|
|
373
364
|
# @param model [String, Symbol, OpenAI::Models::ImageModel, nil]
|
|
374
|
-
# The model to use for image generation.
|
|
375
|
-
#
|
|
376
|
-
# `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
|
|
365
|
+
# The GPT image model to use for image generation. Specify a model explicitly.
|
|
366
|
+
# Supported models include `gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`,
|
|
367
|
+
# `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
|
|
377
368
|
# `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
|
|
378
|
-
# `gpt-image-2.5-flare-2026-09-08
|
|
379
|
-
# specific to the GPT image models is used.
|
|
369
|
+
# `gpt-image-2.5-flare-2026-09-08`, and `chatgpt-image-latest`.
|
|
380
370
|
#
|
|
381
371
|
# @param moderation [Symbol, OpenAI::Models::ImageGenerateParams::Moderation, nil]
|
|
382
372
|
# Control the content-moderation level for images generated by the GPT image
|
|
@@ -384,8 +374,7 @@ module OpenAI
|
|
|
384
374
|
# value).
|
|
385
375
|
#
|
|
386
376
|
# @param n [Integer, nil]
|
|
387
|
-
# The number of images to generate. Must be between 1 and 10.
|
|
388
|
-
# `n=1` is supported.
|
|
377
|
+
# The number of images to generate. Must be between 1 and 10.
|
|
389
378
|
#
|
|
390
379
|
# @param output_compression [Integer, nil]
|
|
391
380
|
# The compression level (0-100%) for the generated images. This parameter is only
|
|
@@ -412,13 +401,9 @@ module OpenAI
|
|
|
412
401
|
# - `high`, `medium` and `low` are supported for the GPT image models.
|
|
413
402
|
# - `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their
|
|
414
403
|
# `2026-09-08` snapshots, also support `xhigh` and `max`.
|
|
415
|
-
# - `hd` and `standard` are supported for `dall-e-3`.
|
|
416
|
-
# - `standard` is the only option for `dall-e-2`.
|
|
417
404
|
#
|
|
418
405
|
# @param response_format [Symbol, OpenAI::Models::ImageGenerateParams::ResponseFormat, nil]
|
|
419
|
-
#
|
|
420
|
-
# returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes
|
|
421
|
-
# after the image has been generated. This parameter isn't supported for the GPT
|
|
406
|
+
# Legacy response format parameter for retired image models. Unsupported for GPT
|
|
422
407
|
# image models, which always return base64-encoded images.
|
|
423
408
|
#
|
|
424
409
|
# @param size [String, Symbol, OpenAI::Models::ImageGenerateParams::Size, nil]
|
|
@@ -431,15 +416,11 @@ module OpenAI
|
|
|
431
416
|
# the maximum supported resolution is `3840x2160`. The requested size must also
|
|
432
417
|
# satisfy the model's current pixel and edge limits. The standard sizes
|
|
433
418
|
# `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models;
|
|
434
|
-
# `auto` is supported for models that allow automatic sizing.
|
|
435
|
-
# one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of
|
|
436
|
-
# `1024x1024`, `1792x1024`, or `1024x1792`.
|
|
419
|
+
# `auto` is supported for models that allow automatic sizing.
|
|
437
420
|
#
|
|
438
421
|
# @param style [Symbol, OpenAI::Models::ImageGenerateParams::Style, nil]
|
|
439
|
-
#
|
|
440
|
-
#
|
|
441
|
-
# towards generating hyper-real and dramatic images. Natural causes the model to
|
|
442
|
-
# produce more natural, less hyper-real looking images.
|
|
422
|
+
# Legacy style parameter for retired image models. Unsupported for GPT image
|
|
423
|
+
# models; describe the desired style in the prompt instead.
|
|
443
424
|
#
|
|
444
425
|
# @param user [String]
|
|
445
426
|
# A unique identifier representing your end-user, which can help OpenAI to monitor
|
|
@@ -470,15 +451,14 @@ module OpenAI
|
|
|
470
451
|
|
|
471
452
|
# See {OpenAI::Resources::Images#generate} for non-streaming counterpart.
|
|
472
453
|
#
|
|
473
|
-
# Creates an image given a prompt.
|
|
454
|
+
# Creates an image given a prompt using a GPT Image model.
|
|
474
455
|
# [Learn more](https://developers.openai.com/api/docs/guides/images-vision).
|
|
475
456
|
#
|
|
476
457
|
# @overload generate_stream_raw(prompt:, background: nil, model: nil, moderation: nil, n: nil, output_compression: nil, output_format: nil, partial_images: nil, quality: nil, response_format: nil, size: nil, style: nil, user: nil, request_options: {})
|
|
477
458
|
#
|
|
478
459
|
# @param prompt [String]
|
|
479
460
|
# A text description of the desired image(s). The maximum length is 32000
|
|
480
|
-
# characters
|
|
481
|
-
# characters for `dall-e-3`.
|
|
461
|
+
# characters.
|
|
482
462
|
#
|
|
483
463
|
# @param background [Symbol, OpenAI::Models::ImageGenerateParams::Background, nil]
|
|
484
464
|
# Allows to set transparency for the background of the generated image(s). Must be
|
|
@@ -492,12 +472,11 @@ module OpenAI
|
|
|
492
472
|
# set the output format to `png` or `webp`.
|
|
493
473
|
#
|
|
494
474
|
# @param model [String, Symbol, OpenAI::Models::ImageModel, nil]
|
|
495
|
-
# The model to use for image generation.
|
|
496
|
-
#
|
|
497
|
-
# `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
|
|
475
|
+
# The GPT image model to use for image generation. Specify a model explicitly.
|
|
476
|
+
# Supported models include `gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`,
|
|
477
|
+
# `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
|
|
498
478
|
# `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
|
|
499
|
-
# `gpt-image-2.5-flare-2026-09-08
|
|
500
|
-
# specific to the GPT image models is used.
|
|
479
|
+
# `gpt-image-2.5-flare-2026-09-08`, and `chatgpt-image-latest`.
|
|
501
480
|
#
|
|
502
481
|
# @param moderation [Symbol, OpenAI::Models::ImageGenerateParams::Moderation, nil]
|
|
503
482
|
# Control the content-moderation level for images generated by the GPT image
|
|
@@ -505,8 +484,7 @@ module OpenAI
|
|
|
505
484
|
# value).
|
|
506
485
|
#
|
|
507
486
|
# @param n [Integer, nil]
|
|
508
|
-
# The number of images to generate. Must be between 1 and 10.
|
|
509
|
-
# `n=1` is supported.
|
|
487
|
+
# The number of images to generate. Must be between 1 and 10.
|
|
510
488
|
#
|
|
511
489
|
# @param output_compression [Integer, nil]
|
|
512
490
|
# The compression level (0-100%) for the generated images. This parameter is only
|
|
@@ -533,13 +511,9 @@ module OpenAI
|
|
|
533
511
|
# - `high`, `medium` and `low` are supported for the GPT image models.
|
|
534
512
|
# - `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their
|
|
535
513
|
# `2026-09-08` snapshots, also support `xhigh` and `max`.
|
|
536
|
-
# - `hd` and `standard` are supported for `dall-e-3`.
|
|
537
|
-
# - `standard` is the only option for `dall-e-2`.
|
|
538
514
|
#
|
|
539
515
|
# @param response_format [Symbol, OpenAI::Models::ImageGenerateParams::ResponseFormat, nil]
|
|
540
|
-
#
|
|
541
|
-
# returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes
|
|
542
|
-
# after the image has been generated. This parameter isn't supported for the GPT
|
|
516
|
+
# Legacy response format parameter for retired image models. Unsupported for GPT
|
|
543
517
|
# image models, which always return base64-encoded images.
|
|
544
518
|
#
|
|
545
519
|
# @param size [String, Symbol, OpenAI::Models::ImageGenerateParams::Size, nil]
|
|
@@ -552,15 +526,11 @@ module OpenAI
|
|
|
552
526
|
# the maximum supported resolution is `3840x2160`. The requested size must also
|
|
553
527
|
# satisfy the model's current pixel and edge limits. The standard sizes
|
|
554
528
|
# `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models;
|
|
555
|
-
# `auto` is supported for models that allow automatic sizing.
|
|
556
|
-
# one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of
|
|
557
|
-
# `1024x1024`, `1792x1024`, or `1024x1792`.
|
|
529
|
+
# `auto` is supported for models that allow automatic sizing.
|
|
558
530
|
#
|
|
559
531
|
# @param style [Symbol, OpenAI::Models::ImageGenerateParams::Style, nil]
|
|
560
|
-
#
|
|
561
|
-
#
|
|
562
|
-
# towards generating hyper-real and dramatic images. Natural causes the model to
|
|
563
|
-
# produce more natural, less hyper-real looking images.
|
|
532
|
+
# Legacy style parameter for retired image models. Unsupported for GPT image
|
|
533
|
+
# models; describe the desired style in the prompt instead.
|
|
564
534
|
#
|
|
565
535
|
# @param user [String]
|
|
566
536
|
# A unique identifier representing your end-user, which can help OpenAI to monitor
|
|
@@ -203,7 +203,7 @@ module OpenAI
|
|
|
203
203
|
# @param headers [Hash] The webhook headers
|
|
204
204
|
# @param webhook_secret [String, nil] The webhook secret (optional, will use client webhook secret or ENV["OPENAI_WEBHOOK_SECRET"] if not provided)
|
|
205
205
|
#
|
|
206
|
-
# @return [OpenAI::Models::Webhooks::BatchCancelledWebhookEvent, OpenAI::Models::Webhooks::BatchCompletedWebhookEvent, OpenAI::Models::Webhooks::BatchExpiredWebhookEvent, OpenAI::Models::Webhooks::BatchFailedWebhookEvent, OpenAI::Models::Webhooks::EvalRunCanceledWebhookEvent, OpenAI::Models::Webhooks::EvalRunFailedWebhookEvent, OpenAI::Models::Webhooks::EvalRunSucceededWebhookEvent, OpenAI::Models::Webhooks::FineTuningJobCancelledWebhookEvent, OpenAI::Models::Webhooks::FineTuningJobFailedWebhookEvent, OpenAI::Models::Webhooks::FineTuningJobSucceededWebhookEvent, OpenAI::Models::Webhooks::LiveCallIncomingWebhookEvent, OpenAI::Models::Webhooks::LiveTransportIncomingWebhookEvent, OpenAI::Models::Webhooks::RealtimeCallIncomingWebhookEvent, OpenAI::Models::Webhooks::ResponseCancelledWebhookEvent, OpenAI::Models::Webhooks::ResponseCompletedWebhookEvent, OpenAI::Models::Webhooks::ResponseFailedWebhookEvent, OpenAI::Models::Webhooks::ResponseIncompleteWebhookEvent, OpenAI::Models::Webhooks::SafetyAlertCreatedWebhookEvent, OpenAI::Models::Webhooks::SafetyDeactivationIssuedWebhookEvent, OpenAI::Models::Webhooks::SafetyOrgAlertCreatedWebhookEvent, OpenAI::Models::Webhooks::SafetyWarningIssuedWebhookEvent]
|
|
206
|
+
# @return [OpenAI::Models::Webhooks::AgentSessionActionRequiredWebhookEvent, OpenAI::Models::Webhooks::AgentSessionCreatedWebhookEvent, OpenAI::Models::Webhooks::AgentSessionFailedWebhookEvent, OpenAI::Models::Webhooks::AgentSessionIdleWebhookEvent, OpenAI::Models::Webhooks::AgentSessionInProgressWebhookEvent, OpenAI::Models::Webhooks::BatchCancelledWebhookEvent, OpenAI::Models::Webhooks::BatchCompletedWebhookEvent, OpenAI::Models::Webhooks::BatchExpiredWebhookEvent, OpenAI::Models::Webhooks::BatchFailedWebhookEvent, OpenAI::Models::Webhooks::EvalRunCanceledWebhookEvent, OpenAI::Models::Webhooks::EvalRunFailedWebhookEvent, OpenAI::Models::Webhooks::EvalRunSucceededWebhookEvent, OpenAI::Models::Webhooks::FineTuningJobCancelledWebhookEvent, OpenAI::Models::Webhooks::FineTuningJobFailedWebhookEvent, OpenAI::Models::Webhooks::FineTuningJobSucceededWebhookEvent, OpenAI::Models::Webhooks::LiveCallIncomingWebhookEvent, OpenAI::Models::Webhooks::LiveTransportIncomingWebhookEvent, OpenAI::Models::Webhooks::RealtimeCallIncomingWebhookEvent, OpenAI::Models::Webhooks::ResponseCancelledWebhookEvent, OpenAI::Models::Webhooks::ResponseCompletedWebhookEvent, OpenAI::Models::Webhooks::ResponseFailedWebhookEvent, OpenAI::Models::Webhooks::ResponseIncompleteWebhookEvent, OpenAI::Models::Webhooks::SafetyAlertCreatedWebhookEvent, OpenAI::Models::Webhooks::SafetyDeactivationIssuedWebhookEvent, OpenAI::Models::Webhooks::SafetyOrgAlertCreatedWebhookEvent, OpenAI::Models::Webhooks::SafetyWarningIssuedWebhookEvent]
|
|
207
207
|
#
|
|
208
208
|
# @raise [ArgumentError] if signature verification fails
|
|
209
209
|
def unwrap(
|
data/lib/openai/version.rb
CHANGED
data/lib/openai.rb
CHANGED
|
@@ -454,6 +454,8 @@ require_relative "openai/models/audio/translation"
|
|
|
454
454
|
require_relative "openai/models/audio/translation_create_params"
|
|
455
455
|
require_relative "openai/models/audio/translation_create_response"
|
|
456
456
|
require_relative "openai/models/audio/translation_verbose"
|
|
457
|
+
require_relative "openai/models/audio/voice"
|
|
458
|
+
require_relative "openai/models/audio/voice_create_params"
|
|
457
459
|
require_relative "openai/models/audio_model"
|
|
458
460
|
require_relative "openai/models/audio_response_format"
|
|
459
461
|
require_relative "openai/models/auto_file_chunking_strategy_param"
|
|
@@ -527,6 +529,7 @@ require_relative "openai/models/beta/agents/sessions/trace_list_params"
|
|
|
527
529
|
require_relative "openai/models/beta/agents/sessions/turn"
|
|
528
530
|
require_relative "openai/models/beta/agents/sessions/turn_list_params"
|
|
529
531
|
require_relative "openai/models/beta/agents/sessions/turn_retrieve_params"
|
|
532
|
+
require_relative "openai/models/beta/agents/sessions/turns/item_list_params"
|
|
530
533
|
require_relative "openai/models/beta/agents/session_update_params"
|
|
531
534
|
require_relative "openai/models/beta/agents/vault"
|
|
532
535
|
require_relative "openai/models/beta/agents/vault_create_params"
|
|
@@ -1435,6 +1438,11 @@ require_relative "openai/models/video_remix_params"
|
|
|
1435
1438
|
require_relative "openai/models/video_retrieve_params"
|
|
1436
1439
|
require_relative "openai/models/video_seconds"
|
|
1437
1440
|
require_relative "openai/models/video_size"
|
|
1441
|
+
require_relative "openai/models/webhooks/agent_session_action_required_webhook_event"
|
|
1442
|
+
require_relative "openai/models/webhooks/agent_session_created_webhook_event"
|
|
1443
|
+
require_relative "openai/models/webhooks/agent_session_failed_webhook_event"
|
|
1444
|
+
require_relative "openai/models/webhooks/agent_session_idle_webhook_event"
|
|
1445
|
+
require_relative "openai/models/webhooks/agent_session_in_progress_webhook_event"
|
|
1438
1446
|
require_relative "openai/models/webhooks/batch_cancelled_webhook_event"
|
|
1439
1447
|
require_relative "openai/models/webhooks/batch_completed_webhook_event"
|
|
1440
1448
|
require_relative "openai/models/webhooks/batch_expired_webhook_event"
|
|
@@ -1510,6 +1518,7 @@ require_relative "openai/resources/audio"
|
|
|
1510
1518
|
require_relative "openai/resources/audio/speech"
|
|
1511
1519
|
require_relative "openai/resources/audio/transcriptions"
|
|
1512
1520
|
require_relative "openai/resources/audio/translations"
|
|
1521
|
+
require_relative "openai/resources/audio/voices"
|
|
1513
1522
|
require_relative "openai/resources/batches"
|
|
1514
1523
|
require_relative "openai/resources/beta"
|
|
1515
1524
|
require_relative "openai/resources/beta/agents"
|
|
@@ -1526,6 +1535,7 @@ require_relative "openai/resources/beta/agents/sessions/subagents/turns"
|
|
|
1526
1535
|
require_relative "openai/resources/beta/agents/sessions/subagents/turns/items"
|
|
1527
1536
|
require_relative "openai/resources/beta/agents/sessions/traces"
|
|
1528
1537
|
require_relative "openai/resources/beta/agents/sessions/turns"
|
|
1538
|
+
require_relative "openai/resources/beta/agents/sessions/turns/items"
|
|
1529
1539
|
require_relative "openai/resources/beta/agents/vaults"
|
|
1530
1540
|
require_relative "openai/resources/beta/agents/vaults/credentials"
|
|
1531
1541
|
require_relative "openai/resources/beta/assistants"
|
|
@@ -56,6 +56,7 @@ module OpenAI
|
|
|
56
56
|
session_id: String,
|
|
57
57
|
input: T.any(String, T::Array[OpenAI::Models::Beta::AgentSessionInputMessageParam::OrHash]),
|
|
58
58
|
tool_handlers: T::Hash[String, OpenAI::Helpers::Agents::ToolHandler],
|
|
59
|
+
on_tool_error: T.nilable(T.proc.params(failure: OpenAI::Helpers::Beta::Agents::ToolError).void),
|
|
59
60
|
idempotency_key: T.nilable(String),
|
|
60
61
|
output_type: T.nilable(T.class_of(OpenAI::Helpers::StructuredOutput::BaseModel)),
|
|
61
62
|
request_options: T.nilable(OpenAI::RequestOptions::OrHash),
|
|
@@ -67,6 +68,7 @@ module OpenAI
|
|
|
67
68
|
session_id,
|
|
68
69
|
input:,
|
|
69
70
|
tool_handlers: {},
|
|
71
|
+
on_tool_error: nil,
|
|
70
72
|
idempotency_key: nil,
|
|
71
73
|
output_type: nil,
|
|
72
74
|
request_options: {},
|
|
@@ -13,11 +13,12 @@ module OpenAI
|
|
|
13
13
|
name: String,
|
|
14
14
|
arguments: T.class_of(OpenAI::BaseModel),
|
|
15
15
|
description: String,
|
|
16
|
+
defer_loading: T.nilable(T::Boolean),
|
|
16
17
|
handler: T.proc.params(arguments: T.untyped).returns(OpenAI::Helpers::Agents::ToolOutput)
|
|
17
18
|
)
|
|
18
19
|
.void
|
|
19
20
|
end
|
|
20
|
-
def initialize(name:, arguments:, description: "", &handler)
|
|
21
|
+
def initialize(name:, arguments:, description: "", defer_loading: nil, &handler)
|
|
21
22
|
end
|
|
22
23
|
|
|
23
24
|
sig { returns(OpenAI::Internal::AnyHash) }
|
|
@@ -29,9 +30,13 @@ module OpenAI
|
|
|
29
30
|
end
|
|
30
31
|
|
|
31
32
|
sig {
|
|
32
|
-
params(
|
|
33
|
+
params(
|
|
34
|
+
arguments: T.any(String, OpenAI::Internal::AnyHash),
|
|
35
|
+
report_stage: T.nilable(T.proc.params(stage: Symbol).void)
|
|
36
|
+
)
|
|
37
|
+
.returns(OpenAI::Helpers::Agents::ToolOutput)
|
|
33
38
|
}
|
|
34
|
-
def call(arguments)
|
|
39
|
+
def call(arguments, &report_stage)
|
|
35
40
|
end
|
|
36
41
|
end
|
|
37
42
|
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module OpenAI
|
|
4
|
+
module Helpers
|
|
5
|
+
module Beta
|
|
6
|
+
module Agents
|
|
7
|
+
# Beta, local-only tool failure diagnostic.
|
|
8
|
+
class ToolError
|
|
9
|
+
sig { returns(StandardError) }
|
|
10
|
+
attr_reader :error
|
|
11
|
+
sig { returns(String) }
|
|
12
|
+
attr_reader :tool_name, :session_id, :turn_id, :call_id
|
|
13
|
+
sig { returns(Symbol) }
|
|
14
|
+
attr_reader :stage
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -139,6 +139,18 @@ module OpenAI
|
|
|
139
139
|
sig { params(parser: T.nilable(OutputParser)).returns(T.self_type) }
|
|
140
140
|
def configure_output_parser(parser)
|
|
141
141
|
end
|
|
142
|
+
|
|
143
|
+
# @api private
|
|
144
|
+
sig do
|
|
145
|
+
params(
|
|
146
|
+
sessions: OpenAI::Resources::Beta::Agents::Sessions,
|
|
147
|
+
tool_handlers: T::Hash[String, OpenAI::Helpers::Agents::ToolHandler],
|
|
148
|
+
request_options: T.untyped
|
|
149
|
+
)
|
|
150
|
+
.returns(T.self_type)
|
|
151
|
+
end
|
|
152
|
+
def configure_tool_handlers(sessions:, tool_handlers:, request_options:)
|
|
153
|
+
end
|
|
142
154
|
end
|
|
143
155
|
end
|
|
144
156
|
end
|