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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -0
- data/README.md +76 -1
- data/lib/openai/helpers/agents/session_stream.rb +60 -3
- data/lib/openai/helpers/beta/agents/artifacts.rb +72 -0
- data/lib/openai/helpers/beta/agents/creation_stream.rb +69 -0
- data/lib/openai/helpers/beta/agents/files.rb +236 -0
- data/lib/openai/helpers/beta/agents/function_tool.rb +65 -0
- data/lib/openai/helpers/beta/agents/model_adapter.rb +27 -0
- data/lib/openai/helpers/beta/agents/result.rb +170 -0
- data/lib/openai/helpers/beta/agents/typed_output.rb +191 -0
- data/lib/openai/helpers/live/websocket.rb +7 -1
- data/lib/openai/helpers/realtime/conversation_item_variant_resolver.rb +1 -1
- data/lib/openai/helpers/responses_websocket/connection.rb +7 -1
- data/lib/openai/helpers/responses_websocket/session.rb +5 -1
- data/lib/openai/helpers/responses_websocket/transports/async_websocket.rb +12 -2
- data/lib/openai/internal/transport/base_client.rb +18 -0
- data/lib/openai/internal/type/array_of.rb +1 -1
- data/lib/openai/internal/type/base_model.rb +6 -3
- data/lib/openai/internal/type/converter.rb +50 -3
- data/lib/openai/internal/type/hash_of.rb +1 -1
- data/lib/openai/internal/type/union.rb +6 -6
- data/lib/openai/models/admin/organization/usage_audio_speeches_response.rb +16 -3
- data/lib/openai/models/admin/organization/usage_audio_transcriptions_response.rb +16 -3
- data/lib/openai/models/admin/organization/usage_code_interpreter_sessions_response.rb +16 -3
- data/lib/openai/models/admin/organization/usage_completions_response.rb +16 -3
- data/lib/openai/models/admin/organization/usage_costs_response.rb +16 -3
- data/lib/openai/models/admin/organization/usage_embeddings_response.rb +16 -3
- data/lib/openai/models/admin/organization/usage_file_search_calls_response.rb +16 -3
- data/lib/openai/models/admin/organization/usage_images_response.rb +16 -3
- data/lib/openai/models/admin/organization/usage_moderations_response.rb +16 -3
- data/lib/openai/models/admin/organization/usage_vector_stores_response.rb +16 -3
- data/lib/openai/models/admin/organization/usage_web_search_calls_response.rb +16 -3
- 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/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/session_trace.rb +64 -0
- data/lib/openai/models/beta/agents/sessions/trace_list_params.rb +68 -0
- data/lib/openai/models/beta/agents/vaults/credential.rb +8 -4
- data/lib/openai/models/beta/beta_response.rb +220 -0
- data/lib/openai/models/beta/beta_response_output_text.rb +2 -2
- data/lib/openai/models/beta/beta_response_output_text_annotation_added_event.rb +2 -2
- data/lib/openai/models/beta/beta_responses_client_event.rb +220 -0
- data/lib/openai/models/beta/beta_tool.rb +3 -9
- data/lib/openai/models/beta/environment.rb +33 -1
- data/lib/openai/models/beta/environment_param.rb +24 -1
- 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 +3 -0
- data/lib/openai/models/chat/chat_completion_audio_param.rb +6 -3
- data/lib/openai/models/chat/chat_completion_content_part_image.rb +1 -0
- data/lib/openai/models/chat_model.rb +178 -0
- 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 +76 -87
- data/lib/openai/models/image_generate_params.rb +51 -62
- data/lib/openai/models/image_model.rb +5 -3
- data/lib/openai/models/live/fork_server_event.rb +14 -3
- data/lib/openai/models/live/server_event.rb +14 -3
- data/lib/openai/models/realtime/realtime_audio_config_output.rb +9 -6
- data/lib/openai/models/realtime/realtime_response_create_audio_output.rb +9 -6
- data/lib/openai/models/realtime/translations/client_secret_create_params.rb +28 -0
- data/lib/openai/models/responses/response_compact_params.rb +220 -0
- data/lib/openai/models/responses/response_output_text.rb +2 -2
- data/lib/openai/models/responses/response_output_text_annotation_added_event.rb +2 -2
- data/lib/openai/models/responses/tool.rb +3 -9
- data/lib/openai/models/responses_model.rb +42 -0
- 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/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/files.rb +31 -0
- data/lib/openai/resources/beta/agents/sessions/artifacts.rb +8 -0
- data/lib/openai/resources/beta/agents/sessions/events.rb +6 -5
- data/lib/openai/resources/beta/agents/sessions/traces.rb +58 -0
- data/lib/openai/resources/beta/agents/sessions.rb +18 -5
- data/lib/openai/resources/evals/runs.rb +1 -1
- data/lib/openai/resources/images.rb +71 -103
- data/lib/openai/resources/realtime/translations/client_secrets.rb +58 -0
- data/lib/openai/resources/realtime/translations.rb +20 -0
- data/lib/openai/resources/realtime.rb +4 -0
- data/lib/openai/resources/webhooks.rb +1 -1
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +17 -1
- data/rbi/openai/helpers/agents.rbi +20 -1
- data/rbi/openai/helpers/beta/agents/artifacts.rbi +29 -0
- data/rbi/openai/helpers/beta/agents/files.rbi +65 -0
- data/rbi/openai/helpers/beta/agents/function_tool.rbi +40 -0
- data/rbi/openai/helpers/beta/agents/model_adapter.rbi +22 -0
- data/rbi/openai/helpers/beta/agents.rbi +146 -0
- data/rbi/openai/internal/transport/base_client.rbi +12 -0
- data/rbi/openai/internal/type/base_model.rbi +2 -2
- data/rbi/openai/internal/type/converter.rbi +21 -3
- data/rbi/openai/internal/type/union.rbi +6 -2
- data/rbi/openai/models/admin/organization/usage_audio_speeches_response.rbi +19 -2
- data/rbi/openai/models/admin/organization/usage_audio_transcriptions_response.rbi +19 -2
- data/rbi/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbi +19 -2
- data/rbi/openai/models/admin/organization/usage_completions_response.rbi +19 -2
- data/rbi/openai/models/admin/organization/usage_costs_response.rbi +19 -2
- data/rbi/openai/models/admin/organization/usage_embeddings_response.rbi +19 -2
- data/rbi/openai/models/admin/organization/usage_file_search_calls_response.rbi +19 -2
- data/rbi/openai/models/admin/organization/usage_images_response.rbi +19 -2
- data/rbi/openai/models/admin/organization/usage_moderations_response.rbi +19 -2
- data/rbi/openai/models/admin/organization/usage_vector_stores_response.rbi +19 -2
- data/rbi/openai/models/admin/organization/usage_web_search_calls_response.rbi +19 -2
- 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/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/session_trace.rbi +97 -0
- data/rbi/openai/models/beta/agents/sessions/trace_list_params.rbi +121 -0
- data/rbi/openai/models/beta/agents/vaults/credential.rbi +5 -5
- data/rbi/openai/models/beta/beta_response_output_text.rbi +2 -2
- data/rbi/openai/models/beta/beta_response_output_text_annotation_added_event.rbi +2 -2
- data/rbi/openai/models/beta/beta_tool.rbi +3 -9
- data/rbi/openai/models/beta/environment.rbi +29 -0
- data/rbi/openai/models/beta/environment_param.rbi +31 -0
- data/rbi/openai/models/beta/session_turn_error.rbi +3 -0
- data/rbi/openai/models/chat/chat_completion_audio_param.rbi +6 -3
- data/rbi/openai/models/chat/chat_completion_content_part_image.rbi +1 -0
- 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 +61 -82
- data/rbi/openai/models/image_generate_params.rbi +30 -61
- data/rbi/openai/models/image_model.rbi +3 -3
- data/rbi/openai/models/live/fork_server_event.rbi +14 -2
- data/rbi/openai/models/live/server_event.rbi +14 -2
- 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/translations/client_secret_create_params.rbi +68 -0
- data/rbi/openai/models/responses/response_output_text.rbi +2 -2
- data/rbi/openai/models/responses/response_output_text_annotation_added_event.rbi +2 -2
- data/rbi/openai/models/responses/tool.rbi +3 -9
- 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/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/files.rbi +31 -0
- data/rbi/openai/resources/beta/agents/sessions/artifacts.rbi +8 -0
- data/rbi/openai/resources/beta/agents/sessions/events.rbi +6 -5
- data/rbi/openai/resources/beta/agents/sessions/traces.rbi +54 -0
- data/rbi/openai/resources/beta/agents/sessions.rbi +6 -1
- data/rbi/openai/resources/images.rbi +69 -103
- data/rbi/openai/resources/realtime/translations/client_secrets.rbi +54 -0
- data/rbi/openai/resources/realtime/translations.rbi +22 -0
- data/rbi/openai/resources/realtime.rbi +3 -0
- data/rbi/openai/resources/webhooks.rbi +5 -0
- data/sig/openai/helpers/agents.rbs +7 -0
- data/sig/openai/helpers/beta/agents/artifacts.rbs +20 -0
- data/sig/openai/helpers/beta/agents/files.rbs +41 -0
- data/sig/openai/helpers/beta/agents/function_tool.rbs +24 -0
- data/sig/openai/helpers/beta/agents/model_adapter.rbs +16 -0
- data/sig/openai/helpers/beta/agents.rbs +71 -0
- data/sig/openai/helpers/structured_output.rbs +12 -0
- data/sig/openai/internal/transport/base_client.rbs +8 -0
- data/sig/openai/internal/type/base_model.rbs +3 -1
- data/sig/openai/internal/type/converter.rbs +16 -2
- data/sig/openai/internal/type/union.rbs +2 -1
- data/sig/openai/models/admin/organization/usage_audio_speeches_response.rbs +20 -3
- data/sig/openai/models/admin/organization/usage_audio_transcriptions_response.rbs +20 -3
- data/sig/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbs +20 -3
- data/sig/openai/models/admin/organization/usage_completions_response.rbs +20 -3
- data/sig/openai/models/admin/organization/usage_costs_response.rbs +20 -3
- data/sig/openai/models/admin/organization/usage_embeddings_response.rbs +20 -3
- data/sig/openai/models/admin/organization/usage_file_search_calls_response.rbs +20 -3
- data/sig/openai/models/admin/organization/usage_images_response.rbs +20 -3
- data/sig/openai/models/admin/organization/usage_moderations_response.rbs +20 -3
- data/sig/openai/models/admin/organization/usage_vector_stores_response.rbs +20 -3
- data/sig/openai/models/admin/organization/usage_web_search_calls_response.rbs +20 -3
- 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/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/session_trace.rbs +65 -0
- data/sig/openai/models/beta/agents/sessions/trace_list_params.rbs +81 -0
- data/sig/openai/models/beta/agents/vaults/credential.rbs +5 -5
- data/sig/openai/models/beta/beta_response_output_text.rbs +2 -2
- data/sig/openai/models/beta/beta_response_output_text_annotation_added_event.rbs +2 -2
- data/sig/openai/models/beta/beta_tool.rbs +3 -9
- data/sig/openai/models/beta/environment.rbs +22 -0
- data/sig/openai/models/beta/environment_param.rbs +25 -0
- data/sig/openai/models/beta/session_turn_error.rbs +4 -0
- data/sig/openai/models/chat/chat_completion_audio_param.rbs +4 -2
- data/sig/openai/models/chat/chat_completion_content_part_image.rbs +2 -1
- 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 +46 -60
- data/sig/openai/models/image_generate_params.rbs +23 -45
- data/sig/openai/models/image_model.rbs +6 -6
- data/sig/openai/models/live/fork_server_event.rbs +17 -2
- data/sig/openai/models/live/server_event.rbs +17 -2
- 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/realtime/translations/client_secret_create_params.rbs +39 -0
- data/sig/openai/models/responses/response_output_text.rbs +2 -2
- data/sig/openai/models/responses/response_output_text_annotation_added_event.rbs +2 -2
- data/sig/openai/models/responses/tool.rbs +3 -9
- 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/environments/files.rbs +17 -0
- data/sig/openai/resources/beta/agents/sessions/artifacts.rbs +4 -0
- data/sig/openai/resources/beta/agents/sessions/traces.rbs +21 -0
- data/sig/openai/resources/beta/agents/sessions.rbs +4 -1
- data/sig/openai/resources/realtime/translations/client_secrets.rbs +17 -0
- data/sig/openai/resources/realtime/translations.rbs +11 -0
- data/sig/openai/resources/realtime.rbs +2 -0
- data/sig/openai/resources/webhooks.rbs +6 -1
- 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
|
-
#
|
|
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
|
|
31
|
-
#
|
|
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
|
|
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
|
|
93
|
-
# characters for
|
|
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
|
|
119
|
-
#
|
|
120
|
-
# `gpt-image-2-
|
|
121
|
-
# `gpt-image-2.5-
|
|
122
|
-
# `
|
|
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
|
-
#
|
|
148
|
-
#
|
|
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.
|
|
153
|
-
# `gpt-image-2
|
|
154
|
-
# `gpt-image-2.5-
|
|
155
|
-
# resolutions are supported as
|
|
156
|
-
# Width and height must both be
|
|
157
|
-
# must be between 1:3 and 3:1.
|
|
158
|
-
#
|
|
159
|
-
#
|
|
160
|
-
#
|
|
161
|
-
# `
|
|
162
|
-
#
|
|
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
|
|
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
|
|
219
|
-
# characters for
|
|
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
|
|
245
|
-
#
|
|
246
|
-
# `gpt-image-2-
|
|
247
|
-
# `gpt-image-2.5-
|
|
248
|
-
# `
|
|
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
|
-
#
|
|
274
|
-
#
|
|
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.
|
|
279
|
-
# `gpt-image-2
|
|
280
|
-
# `gpt-image-2.5-
|
|
281
|
-
# resolutions are supported as
|
|
282
|
-
# Width and height must both be
|
|
283
|
-
# must be between 1:3 and 3:1.
|
|
284
|
-
#
|
|
285
|
-
#
|
|
286
|
-
#
|
|
287
|
-
# `
|
|
288
|
-
#
|
|
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
|
|
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.
|
|
342
|
-
#
|
|
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
|
|
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.
|
|
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
|
-
#
|
|
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.
|
|
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
|
-
#
|
|
398
|
-
#
|
|
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
|
|
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.
|
|
453
|
-
#
|
|
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
|
|
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.
|
|
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
|
-
#
|
|
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.
|
|
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
|
-
#
|
|
509
|
-
#
|
|
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
|