From b7525beb430cdc72dc6400a3d76dedbb26c6c6a7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 4 May 2026 19:10:03 +0000 Subject: [PATCH 01/16] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index ab1af60f..743417b1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 232 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-21ecab7aeb61612b9da5e52ea4c0cb75a33d443d975022934b9305e97d1a7d62.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-81b872fc8a50941a72f77f3fa0791f7234b9180db95b451b38ced94279e947c5.yml openapi_spec_hash: cfc868a0bb3567183510c9b5629c510f -config_hash: dd484e2cc01206d26516338d0f4596b0 +config_hash: 4a32815d42629ed593422278834dcca4 From 675956e64dc37637ca3c7dae843fcd95e474d53c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 4 May 2026 20:45:02 +0000 Subject: [PATCH 02/16] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 743417b1..0f287ffa 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 232 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-81b872fc8a50941a72f77f3fa0791f7234b9180db95b451b38ced94279e947c5.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-b29ed93b301b4a89daf4fb5bb6463cbc059ce944ff9808639679794c10e60dd6.yml openapi_spec_hash: cfc868a0bb3567183510c9b5629c510f -config_hash: 4a32815d42629ed593422278834dcca4 +config_hash: 2524657a4d3e2779f4a70cc581c33d80 From f475f30d4005c35467249ba9f4b48fc89e29bd18 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 4 May 2026 21:32:03 +0000 Subject: [PATCH 03/16] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0f287ffa..ad8c348e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 232 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-b29ed93b301b4a89daf4fb5bb6463cbc059ce944ff9808639679794c10e60dd6.yml -openapi_spec_hash: cfc868a0bb3567183510c9b5629c510f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-70926f399403fb20d9cee460500dad50a9555dd72b5abb768215e9f541a648ea.yml +openapi_spec_hash: ae4a7852e20f39c14adbf6f253b8a004 config_hash: 2524657a4d3e2779f4a70cc581c33d80 From 78717ad7d26a2f35b3afcc5ab02eb48b6cbf487d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 00:42:23 +0000 Subject: [PATCH 04/16] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index ad8c348e..a1b58404 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 232 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-70926f399403fb20d9cee460500dad50a9555dd72b5abb768215e9f541a648ea.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-61d75f384a1e6bee387e9e02168257426facdbbb9677b9b5cb30a3863da40b10.yml openapi_spec_hash: ae4a7852e20f39c14adbf6f253b8a004 -config_hash: 2524657a4d3e2779f4a70cc581c33d80 +config_hash: 51d639d7939b6ab974d1ee45e96c532b From b4864127789424527497aa6097d93ea06e9aa4f7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 08:08:17 +0000 Subject: [PATCH 05/16] feat(api): add web_search_call.results includable option --- .stats.yml | 4 ++-- lib/openai/models/responses/response_includable.rb | 2 ++ rbi/openai/models/responses/response_includable.rbi | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index a1b58404..fbb72ac0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 232 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-61d75f384a1e6bee387e9e02168257426facdbbb9677b9b5cb30a3863da40b10.yml -openapi_spec_hash: ae4a7852e20f39c14adbf6f253b8a004 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-1405c20d24646f71eecd0f7ed222426973b8806ef70a3865a2428c0c57b1f050.yml +openapi_spec_hash: 92713b0825f6b8760836778e6d27e837 config_hash: 51d639d7939b6ab974d1ee45e96c532b diff --git a/lib/openai/models/responses/response_includable.rb b/lib/openai/models/responses/response_includable.rb index c4c1959b..5b7c3e05 100644 --- a/lib/openai/models/responses/response_includable.rb +++ b/lib/openai/models/responses/response_includable.rb @@ -6,6 +6,8 @@ module Responses # Specify additional output data to include in the model response. Currently # supported values are: # + # - `web_search_call.results`: Include the search results of the web search tool + # call. # - `web_search_call.action.sources`: Include the sources of the web search tool # call. # - `code_interpreter_call.outputs`: Includes the outputs of python code execution diff --git a/rbi/openai/models/responses/response_includable.rbi b/rbi/openai/models/responses/response_includable.rbi index 06c2ac37..e0944dbb 100644 --- a/rbi/openai/models/responses/response_includable.rbi +++ b/rbi/openai/models/responses/response_includable.rbi @@ -6,6 +6,8 @@ module OpenAI # Specify additional output data to include in the model response. Currently # supported values are: # + # - `web_search_call.results`: Include the search results of the web search tool + # call. # - `web_search_call.action.sources`: Include the sources of the web search tool # call. # - `code_interpreter_call.outputs`: Includes the outputs of python code execution From 0e642fbf02845ff94b8eda0fca7e8348adc3ac37 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 15:50:00 +0000 Subject: [PATCH 06/16] feat(api): launch realtime translate + update image 2 --- .stats.yml | 4 +- lib/openai.rb | 3 ++ lib/openai/models/image_edit_params.rb | 30 ++++++++------ lib/openai/models/image_generate_params.rb | 12 +++--- lib/openai/models/image_model.rb | 7 +++- lib/openai/models/responses/tool.rb | 9 +++++ lib/openai/resources/images.rb | 4 +- lib/openai/resources/realtime.rb | 4 ++ lib/openai/resources/realtime/translations.rb | 24 ++++++++++++ .../resources/realtime/translations/calls.rb | 18 +++++++++ .../realtime/translations/client_secrets.rb | 18 +++++++++ rbi/openai/models/image_edit_params.rbi | 39 ++++++++++++------- rbi/openai/models/image_generate_params.rbi | 15 ++++--- rbi/openai/models/image_model.rbi | 11 ++++-- rbi/openai/models/responses/tool.rbi | 15 +++++++ rbi/openai/resources/images.rbi | 36 ++++++++++------- rbi/openai/resources/realtime.rbi | 3 ++ .../resources/realtime/translations.rbi | 22 +++++++++++ .../resources/realtime/translations/calls.rbi | 16 ++++++++ .../realtime/translations/client_secrets.rbi | 16 ++++++++ scripts/detect-breaking-changes | 3 ++ sig/openai/models/image_model.rbs | 16 +++++--- sig/openai/models/responses/tool.rbs | 11 +++++- sig/openai/resources/realtime.rbs | 2 + .../resources/realtime/translations.rbs | 13 +++++++ .../resources/realtime/translations/calls.rbs | 11 ++++++ .../realtime/translations/client_secrets.rbs | 11 ++++++ test/openai/resource_namespaces.rb | 5 +++ .../realtime/translations/calls_test.rb | 6 +++ .../translations/client_secrets_test.rb | 6 +++ .../resources/realtime/translations_test.rb | 6 +++ 31 files changed, 329 insertions(+), 67 deletions(-) create mode 100644 lib/openai/resources/realtime/translations.rb create mode 100644 lib/openai/resources/realtime/translations/calls.rb create mode 100644 lib/openai/resources/realtime/translations/client_secrets.rb create mode 100644 rbi/openai/resources/realtime/translations.rbi create mode 100644 rbi/openai/resources/realtime/translations/calls.rbi create mode 100644 rbi/openai/resources/realtime/translations/client_secrets.rbi create mode 100644 sig/openai/resources/realtime/translations.rbs create mode 100644 sig/openai/resources/realtime/translations/calls.rbs create mode 100644 sig/openai/resources/realtime/translations/client_secrets.rbs create mode 100644 test/openai/resources/realtime/translations/calls_test.rb create mode 100644 test/openai/resources/realtime/translations/client_secrets_test.rb create mode 100644 test/openai/resources/realtime/translations_test.rb diff --git a/.stats.yml b/.stats.yml index fbb72ac0..56a45391 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 232 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-1405c20d24646f71eecd0f7ed222426973b8806ef70a3865a2428c0c57b1f050.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-5ae2eda70e6a4a375842fb8bf3e88deab8e0aad1b3871b86e73274f131bb37ce.yml openapi_spec_hash: 92713b0825f6b8760836778e6d27e837 -config_hash: 51d639d7939b6ab974d1ee45e96c532b +config_hash: c15a744b2771a3948032b2438475b330 diff --git a/lib/openai.rb b/lib/openai.rb index b57fdc78..4da9e380 100644 --- a/lib/openai.rb +++ b/lib/openai.rb @@ -985,6 +985,9 @@ require_relative "openai/resources/realtime" require_relative "openai/resources/realtime/calls" require_relative "openai/resources/realtime/client_secrets" +require_relative "openai/resources/realtime/translations" +require_relative "openai/resources/realtime/translations/calls" +require_relative "openai/resources/realtime/translations/client_secrets" require_relative "openai/resources/responses" require_relative "openai/resources/responses/input_items" require_relative "openai/resources/responses/input_tokens" diff --git a/lib/openai/models/image_edit_params.rb b/lib/openai/models/image_edit_params.rb index 62f9e5a4..07edb47a 100644 --- a/lib/openai/models/image_edit_params.rb +++ b/lib/openai/models/image_edit_params.rb @@ -12,10 +12,10 @@ class ImageEditParams < OpenAI::Internal::Type::BaseModel # @!attribute image # The image(s) to edit. Must be a supported image file or an array of images. # - # For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and - # `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg` file less than - # 50MB. You can provide up to 16 images. `chatgpt-image-latest` follows the same - # input constraints as GPT image models. + # For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, + # `gpt-image-2`, `gpt-image-2-2026-04-21`, and `chatgpt-image-latest`), each image + # should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to + # 16 images. # # For `dall-e-2`, you can only provide one image, and it should be a square `png` # file less than 4MB. @@ -61,7 +61,10 @@ class ImageEditParams < OpenAI::Internal::Type::BaseModel optional :mask, OpenAI::Internal::Type::FileInput # @!attribute model - # The model to use for image generation. Defaults to `gpt-image-1.5`. + # The model to use for image generation. One of `dall-e-2` or a GPT image model + # (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, + # `gpt-image-2-2026-04-21`, or `chatgpt-image-latest`). Defaults to + # `gpt-image-1.5`. # # @return [String, Symbol, OpenAI::Models::ImageModel, nil] optional :model, union: -> { OpenAI::ImageEditParams::Model }, nil?: true @@ -145,7 +148,7 @@ class ImageEditParams < OpenAI::Internal::Type::BaseModel # # @param mask [Pathname, StringIO, IO, String, OpenAI::FilePart] An additional image whose fully transparent areas (e.g. where alpha is zero) ind # - # @param model [String, Symbol, OpenAI::Models::ImageModel, nil] The model to use for image generation. Defaults to `gpt-image-1.5`. + # @param model [String, Symbol, OpenAI::Models::ImageModel, nil] The model to use for image generation. One of `dall-e-2` or a GPT image model (` # # @param n [Integer, nil] The number of images to generate. Must be between 1 and 10. # @@ -167,10 +170,10 @@ class ImageEditParams < OpenAI::Internal::Type::BaseModel # The image(s) to edit. Must be a supported image file or an array of images. # - # For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and - # `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg` file less than - # 50MB. You can provide up to 16 images. `chatgpt-image-latest` follows the same - # input constraints as GPT image models. + # For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, + # `gpt-image-2`, `gpt-image-2-2026-04-21`, and `chatgpt-image-latest`), each image + # should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to + # 16 images. # # For `dall-e-2`, you can only provide one image, and it should be a square `png` # file less than 4MB. @@ -220,13 +223,16 @@ module InputFidelity # @return [Array] end - # The model to use for image generation. Defaults to `gpt-image-1.5`. + # The model to use for image generation. One of `dall-e-2` or a GPT image model + # (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, + # `gpt-image-2-2026-04-21`, or `chatgpt-image-latest`). Defaults to + # `gpt-image-1.5`. module Model extend OpenAI::Internal::Type::Union variant String - # The model to use for image generation. Defaults to `gpt-image-1.5`. + # The model to use for image generation. One of `dall-e-2` or a GPT image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, `gpt-image-2-2026-04-21`, or `chatgpt-image-latest`). Defaults to `gpt-image-1.5`. variant enum: -> { OpenAI::ImageModel } # @!method self.variants diff --git a/lib/openai/models/image_generate_params.rb b/lib/openai/models/image_generate_params.rb index d0604546..7270a3b3 100644 --- a/lib/openai/models/image_generate_params.rb +++ b/lib/openai/models/image_generate_params.rb @@ -31,8 +31,9 @@ class ImageGenerateParams < OpenAI::Internal::Type::BaseModel # @!attribute model # The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT - # image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`). Defaults to - # `dall-e-2` unless a parameter specific to the GPT image models is used. + # image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, + # or `gpt-image-2-2026-04-21`). Defaults to `dall-e-2` unless a parameter specific + # to the GPT image models is used. # # @return [String, Symbol, OpenAI::Models::ImageModel, nil] optional :model, union: -> { OpenAI::ImageGenerateParams::Model }, nil?: true @@ -176,14 +177,15 @@ module Background end # The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT - # image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`). Defaults to - # `dall-e-2` unless a parameter specific to the GPT image models is used. + # image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, + # or `gpt-image-2-2026-04-21`). Defaults to `dall-e-2` unless a parameter specific + # to the GPT image models is used. module Model extend OpenAI::Internal::Type::Union variant String - # The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`). Defaults to `dall-e-2` unless a parameter specific to the GPT image models is used. + # The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, or `gpt-image-2-2026-04-21`). Defaults to `dall-e-2` unless a parameter specific to the GPT image models is used. variant enum: -> { OpenAI::ImageModel } # @!method self.variants diff --git a/lib/openai/models/image_model.rb b/lib/openai/models/image_model.rb index aa447df7..6cf428b8 100644 --- a/lib/openai/models/image_model.rb +++ b/lib/openai/models/image_model.rb @@ -5,11 +5,14 @@ module Models module ImageModel extend OpenAI::Internal::Type::Enum + GPT_IMAGE_1 = :"gpt-image-1" + GPT_IMAGE_1_MINI = :"gpt-image-1-mini" + GPT_IMAGE_2 = :"gpt-image-2" + GPT_IMAGE_2_2026_04_21 = :"gpt-image-2-2026-04-21" GPT_IMAGE_1_5 = :"gpt-image-1.5" + CHATGPT_IMAGE_LATEST = :"chatgpt-image-latest" DALL_E_2 = :"dall-e-2" DALL_E_3 = :"dall-e-3" - GPT_IMAGE_1 = :"gpt-image-1" - GPT_IMAGE_1_MINI = :"gpt-image-1-mini" # @!method self.values # @return [Array] diff --git a/lib/openai/models/responses/tool.rb b/lib/openai/models/responses/tool.rb index 6a232792..08d26e5c 100644 --- a/lib/openai/models/responses/tool.rb +++ b/lib/openai/models/responses/tool.rb @@ -681,8 +681,14 @@ module Model variant const: -> { OpenAI::Models::Responses::Tool::ImageGeneration::Model::GPT_IMAGE_1_MINI } + variant const: -> { OpenAI::Models::Responses::Tool::ImageGeneration::Model::GPT_IMAGE_2 } + + variant const: -> { OpenAI::Models::Responses::Tool::ImageGeneration::Model::GPT_IMAGE_2_2026_04_21 } + variant const: -> { OpenAI::Models::Responses::Tool::ImageGeneration::Model::GPT_IMAGE_1_5 } + variant const: -> { OpenAI::Models::Responses::Tool::ImageGeneration::Model::CHATGPT_IMAGE_LATEST } + # @!method self.variants # @return [Array(String, Symbol)] @@ -694,7 +700,10 @@ module Model GPT_IMAGE_1 = :"gpt-image-1" GPT_IMAGE_1_MINI = :"gpt-image-1-mini" + GPT_IMAGE_2 = :"gpt-image-2" + GPT_IMAGE_2_2026_04_21 = :"gpt-image-2-2026-04-21" GPT_IMAGE_1_5 = :"gpt-image-1.5" + CHATGPT_IMAGE_LATEST = :"chatgpt-image-latest" # @!endgroup end diff --git a/lib/openai/resources/images.rb b/lib/openai/resources/images.rb index 77116f01..8eeefe1a 100644 --- a/lib/openai/resources/images.rb +++ b/lib/openai/resources/images.rb @@ -62,7 +62,7 @@ def create_variation(params) # # @param mask [Pathname, StringIO, IO, String, OpenAI::FilePart] An additional image whose fully transparent areas (e.g. where alpha is zero) ind # - # @param model [String, Symbol, OpenAI::Models::ImageModel, nil] The model to use for image generation. Defaults to `gpt-image-1.5`. + # @param model [String, Symbol, OpenAI::Models::ImageModel, nil] The model to use for image generation. One of `dall-e-2` or a GPT image model (` # # @param n [Integer, nil] The number of images to generate. Must be between 1 and 10. # @@ -123,7 +123,7 @@ def edit(params) # # @param mask [Pathname, StringIO, IO, String, OpenAI::FilePart] An additional image whose fully transparent areas (e.g. where alpha is zero) ind # - # @param model [String, Symbol, OpenAI::Models::ImageModel, nil] The model to use for image generation. Defaults to `gpt-image-1.5`. + # @param model [String, Symbol, OpenAI::Models::ImageModel, nil] The model to use for image generation. One of `dall-e-2` or a GPT image model (` # # @param n [Integer, nil] The number of images to generate. Must be between 1 and 10. # diff --git a/lib/openai/resources/realtime.rb b/lib/openai/resources/realtime.rb index f361d152..510ce241 100644 --- a/lib/openai/resources/realtime.rb +++ b/lib/openai/resources/realtime.rb @@ -9,6 +9,9 @@ class Realtime # @return [OpenAI::Resources::Realtime::Calls] attr_reader :calls + # @return [OpenAI::Resources::Realtime::Translations] + attr_reader :translations + # @api private # # @param client [OpenAI::Client] @@ -16,6 +19,7 @@ def initialize(client:) @client = client @client_secrets = OpenAI::Resources::Realtime::ClientSecrets.new(client: client) @calls = OpenAI::Resources::Realtime::Calls.new(client: client) + @translations = OpenAI::Resources::Realtime::Translations.new(client: client) end end end diff --git a/lib/openai/resources/realtime/translations.rb b/lib/openai/resources/realtime/translations.rb new file mode 100644 index 00000000..cfade19a --- /dev/null +++ b/lib/openai/resources/realtime/translations.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module OpenAI + module Resources + class Realtime + class Translations + # @return [OpenAI::Resources::Realtime::Translations::ClientSecrets] + attr_reader :client_secrets + + # @return [OpenAI::Resources::Realtime::Translations::Calls] + attr_reader :calls + + # @api private + # + # @param client [OpenAI::Client] + def initialize(client:) + @client = client + @client_secrets = OpenAI::Resources::Realtime::Translations::ClientSecrets.new(client: client) + @calls = OpenAI::Resources::Realtime::Translations::Calls.new(client: client) + end + end + end + end +end diff --git a/lib/openai/resources/realtime/translations/calls.rb b/lib/openai/resources/realtime/translations/calls.rb new file mode 100644 index 00000000..198aabaf --- /dev/null +++ b/lib/openai/resources/realtime/translations/calls.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module OpenAI + module Resources + class Realtime + class Translations + class Calls + # @api private + # + # @param client [OpenAI::Client] + def initialize(client:) + @client = client + end + end + end + end + end +end diff --git a/lib/openai/resources/realtime/translations/client_secrets.rb b/lib/openai/resources/realtime/translations/client_secrets.rb new file mode 100644 index 00000000..b4efce3f --- /dev/null +++ b/lib/openai/resources/realtime/translations/client_secrets.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module OpenAI + module Resources + class Realtime + class Translations + class ClientSecrets + # @api private + # + # @param client [OpenAI::Client] + def initialize(client:) + @client = client + end + end + end + end + end +end diff --git a/rbi/openai/models/image_edit_params.rbi b/rbi/openai/models/image_edit_params.rbi index 219bcb83..65691ce3 100644 --- a/rbi/openai/models/image_edit_params.rbi +++ b/rbi/openai/models/image_edit_params.rbi @@ -13,10 +13,10 @@ module OpenAI # The image(s) to edit. Must be a supported image file or an array of images. # - # For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and - # `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg` file less than - # 50MB. You can provide up to 16 images. `chatgpt-image-latest` follows the same - # input constraints as GPT image models. + # For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, + # `gpt-image-2`, `gpt-image-2-2026-04-21`, and `chatgpt-image-latest`), each image + # should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to + # 16 images. # # For `dall-e-2`, you can only provide one image, and it should be a square `png` # file less than 4MB. @@ -57,7 +57,10 @@ module OpenAI sig { params(mask: OpenAI::Internal::FileInput).void } attr_writer :mask - # The model to use for image generation. Defaults to `gpt-image-1.5`. + # The model to use for image generation. One of `dall-e-2` or a GPT image model + # (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, + # `gpt-image-2-2026-04-21`, or `chatgpt-image-latest`). Defaults to + # `gpt-image-1.5`. sig { returns(T.nilable(T.any(String, OpenAI::ImageModel::OrSymbol))) } attr_accessor :model @@ -142,10 +145,10 @@ module OpenAI def self.new( # The image(s) to edit. Must be a supported image file or an array of images. # - # For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and - # `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg` file less than - # 50MB. You can provide up to 16 images. `chatgpt-image-latest` follows the same - # input constraints as GPT image models. + # For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, + # `gpt-image-2`, `gpt-image-2-2026-04-21`, and `chatgpt-image-latest`), each image + # should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to + # 16 images. # # For `dall-e-2`, you can only provide one image, and it should be a square `png` # file less than 4MB. @@ -171,7 +174,10 @@ module OpenAI # the mask will be applied on the first image. Must be a valid PNG file, less than # 4MB, and have the same dimensions as `image`. mask: nil, - # The model to use for image generation. Defaults to `gpt-image-1.5`. + # The model to use for image generation. One of `dall-e-2` or a GPT image model + # (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, + # `gpt-image-2-2026-04-21`, or `chatgpt-image-latest`). Defaults to + # `gpt-image-1.5`. model: nil, # The number of images to generate. Must be between 1 and 10. n: nil, @@ -240,10 +246,10 @@ module OpenAI # The image(s) to edit. Must be a supported image file or an array of images. # - # For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and - # `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg` file less than - # 50MB. You can provide up to 16 images. `chatgpt-image-latest` follows the same - # input constraints as GPT image models. + # For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, + # `gpt-image-2`, `gpt-image-2-2026-04-21`, and `chatgpt-image-latest`), each image + # should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to + # 16 images. # # For `dall-e-2`, you can only provide one image, and it should be a square `png` # file less than 4MB. @@ -318,7 +324,10 @@ module OpenAI end end - # The model to use for image generation. Defaults to `gpt-image-1.5`. + # The model to use for image generation. One of `dall-e-2` or a GPT image model + # (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, + # `gpt-image-2-2026-04-21`, or `chatgpt-image-latest`). Defaults to + # `gpt-image-1.5`. module Model extend OpenAI::Internal::Type::Union diff --git a/rbi/openai/models/image_generate_params.rbi b/rbi/openai/models/image_generate_params.rbi index 7837a2e4..964fc9d1 100644 --- a/rbi/openai/models/image_generate_params.rbi +++ b/rbi/openai/models/image_generate_params.rbi @@ -30,8 +30,9 @@ module OpenAI attr_accessor :background # The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT - # image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`). Defaults to - # `dall-e-2` unless a parameter specific to the GPT image models is used. + # image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, + # or `gpt-image-2-2026-04-21`). Defaults to `dall-e-2` unless a parameter specific + # to the GPT image models is used. sig { returns(T.nilable(T.any(String, OpenAI::ImageModel::OrSymbol))) } attr_accessor :model @@ -150,8 +151,9 @@ module OpenAI # be set to either `png` (default value) or `webp`. background: nil, # The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT - # image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`). Defaults to - # `dall-e-2` unless a parameter specific to the GPT image models is used. + # image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, + # or `gpt-image-2-2026-04-21`). Defaults to `dall-e-2` unless a parameter specific + # to the GPT image models is used. model: nil, # Control the content-moderation level for images generated by the GPT image # models. Must be either `low` for less restrictive filtering or `auto` (default @@ -268,8 +270,9 @@ module OpenAI end # The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT - # image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`). Defaults to - # `dall-e-2` unless a parameter specific to the GPT image models is used. + # image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, + # or `gpt-image-2-2026-04-21`). Defaults to `dall-e-2` unless a parameter specific + # to the GPT image models is used. module Model extend OpenAI::Internal::Type::Union diff --git a/rbi/openai/models/image_model.rbi b/rbi/openai/models/image_model.rbi index 911c8016..d5750782 100644 --- a/rbi/openai/models/image_model.rbi +++ b/rbi/openai/models/image_model.rbi @@ -8,12 +8,17 @@ module OpenAI TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::ImageModel) } OrSymbol = T.type_alias { T.any(Symbol, String) } - GPT_IMAGE_1_5 = T.let(:"gpt-image-1.5", OpenAI::ImageModel::TaggedSymbol) - DALL_E_2 = T.let(:"dall-e-2", OpenAI::ImageModel::TaggedSymbol) - DALL_E_3 = T.let(:"dall-e-3", OpenAI::ImageModel::TaggedSymbol) GPT_IMAGE_1 = T.let(:"gpt-image-1", OpenAI::ImageModel::TaggedSymbol) GPT_IMAGE_1_MINI = T.let(:"gpt-image-1-mini", OpenAI::ImageModel::TaggedSymbol) + GPT_IMAGE_2 = T.let(:"gpt-image-2", OpenAI::ImageModel::TaggedSymbol) + GPT_IMAGE_2_2026_04_21 = + T.let(:"gpt-image-2-2026-04-21", OpenAI::ImageModel::TaggedSymbol) + GPT_IMAGE_1_5 = T.let(:"gpt-image-1.5", OpenAI::ImageModel::TaggedSymbol) + CHATGPT_IMAGE_LATEST = + T.let(:"chatgpt-image-latest", OpenAI::ImageModel::TaggedSymbol) + DALL_E_2 = T.let(:"dall-e-2", OpenAI::ImageModel::TaggedSymbol) + DALL_E_3 = T.let(:"dall-e-3", OpenAI::ImageModel::TaggedSymbol) sig { override.returns(T::Array[OpenAI::ImageModel::TaggedSymbol]) } def self.values diff --git a/rbi/openai/models/responses/tool.rbi b/rbi/openai/models/responses/tool.rbi index cab7db9c..220054ae 100644 --- a/rbi/openai/models/responses/tool.rbi +++ b/rbi/openai/models/responses/tool.rbi @@ -1388,11 +1388,26 @@ module OpenAI :"gpt-image-1-mini", OpenAI::Responses::Tool::ImageGeneration::Model::TaggedSymbol ) + GPT_IMAGE_2 = + T.let( + :"gpt-image-2", + OpenAI::Responses::Tool::ImageGeneration::Model::TaggedSymbol + ) + GPT_IMAGE_2_2026_04_21 = + T.let( + :"gpt-image-2-2026-04-21", + OpenAI::Responses::Tool::ImageGeneration::Model::TaggedSymbol + ) GPT_IMAGE_1_5 = T.let( :"gpt-image-1.5", OpenAI::Responses::Tool::ImageGeneration::Model::TaggedSymbol ) + CHATGPT_IMAGE_LATEST = + T.let( + :"chatgpt-image-latest", + OpenAI::Responses::Tool::ImageGeneration::Model::TaggedSymbol + ) end # Moderation level for the generated image. Default: `auto`. diff --git a/rbi/openai/resources/images.rbi b/rbi/openai/resources/images.rbi index a33916b9..28ddb9d8 100644 --- a/rbi/openai/resources/images.rbi +++ b/rbi/openai/resources/images.rbi @@ -74,10 +74,10 @@ module OpenAI def edit( # The image(s) to edit. Must be a supported image file or an array of images. # - # For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and - # `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg` file less than - # 50MB. You can provide up to 16 images. `chatgpt-image-latest` follows the same - # input constraints as GPT image models. + # For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, + # `gpt-image-2`, `gpt-image-2-2026-04-21`, and `chatgpt-image-latest`), each image + # should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to + # 16 images. # # For `dall-e-2`, you can only provide one image, and it should be a square `png` # file less than 4MB. @@ -103,7 +103,10 @@ module OpenAI # the mask will be applied on the first image. Must be a valid PNG file, less than # 4MB, and have the same dimensions as `image`. mask: nil, - # The model to use for image generation. Defaults to `gpt-image-1.5`. + # The model to use for image generation. One of `dall-e-2` or a GPT image model + # (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, + # `gpt-image-2-2026-04-21`, or `chatgpt-image-latest`). Defaults to + # `gpt-image-1.5`. model: nil, # The number of images to generate. Must be between 1 and 10. n: nil, @@ -178,10 +181,10 @@ module OpenAI def edit_stream_raw( # The image(s) to edit. Must be a supported image file or an array of images. # - # For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and - # `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg` file less than - # 50MB. You can provide up to 16 images. `chatgpt-image-latest` follows the same - # input constraints as GPT image models. + # For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, + # `gpt-image-2`, `gpt-image-2-2026-04-21`, and `chatgpt-image-latest`), each image + # should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to + # 16 images. # # For `dall-e-2`, you can only provide one image, and it should be a square `png` # file less than 4MB. @@ -207,7 +210,10 @@ module OpenAI # the mask will be applied on the first image. Must be a valid PNG file, less than # 4MB, and have the same dimensions as `image`. mask: nil, - # The model to use for image generation. Defaults to `gpt-image-1.5`. + # The model to use for image generation. One of `dall-e-2` or a GPT image model + # (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, + # `gpt-image-2-2026-04-21`, or `chatgpt-image-latest`). Defaults to + # `gpt-image-1.5`. model: nil, # The number of images to generate. Must be between 1 and 10. n: nil, @@ -290,8 +296,9 @@ module OpenAI # be set to either `png` (default value) or `webp`. background: nil, # The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT - # image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`). Defaults to - # `dall-e-2` unless a parameter specific to the GPT image models is used. + # image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, + # or `gpt-image-2-2026-04-21`). Defaults to `dall-e-2` unless a parameter specific + # to the GPT image models is used. model: nil, # Control the content-moderation level for images generated by the GPT image # models. Must be either `low` for less restrictive filtering or `auto` (default @@ -391,8 +398,9 @@ module OpenAI # be set to either `png` (default value) or `webp`. background: nil, # The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT - # image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`). Defaults to - # `dall-e-2` unless a parameter specific to the GPT image models is used. + # image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, + # or `gpt-image-2-2026-04-21`). Defaults to `dall-e-2` unless a parameter specific + # to the GPT image models is used. model: nil, # Control the content-moderation level for images generated by the GPT image # models. Must be either `low` for less restrictive filtering or `auto` (default diff --git a/rbi/openai/resources/realtime.rbi b/rbi/openai/resources/realtime.rbi index 93c14444..a8991eef 100644 --- a/rbi/openai/resources/realtime.rbi +++ b/rbi/openai/resources/realtime.rbi @@ -9,6 +9,9 @@ module OpenAI sig { returns(OpenAI::Resources::Realtime::Calls) } attr_reader :calls + sig { returns(OpenAI::Resources::Realtime::Translations) } + attr_reader :translations + # @api private sig { params(client: OpenAI::Client).returns(T.attached_class) } def self.new(client:) diff --git a/rbi/openai/resources/realtime/translations.rbi b/rbi/openai/resources/realtime/translations.rbi new file mode 100644 index 00000000..bcb95957 --- /dev/null +++ b/rbi/openai/resources/realtime/translations.rbi @@ -0,0 +1,22 @@ +# typed: strong + +module OpenAI + module Resources + class Realtime + class Translations + sig do + returns(OpenAI::Resources::Realtime::Translations::ClientSecrets) + end + attr_reader :client_secrets + + sig { returns(OpenAI::Resources::Realtime::Translations::Calls) } + attr_reader :calls + + # @api private + sig { params(client: OpenAI::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end + end +end diff --git a/rbi/openai/resources/realtime/translations/calls.rbi b/rbi/openai/resources/realtime/translations/calls.rbi new file mode 100644 index 00000000..588cc975 --- /dev/null +++ b/rbi/openai/resources/realtime/translations/calls.rbi @@ -0,0 +1,16 @@ +# typed: strong + +module OpenAI + module Resources + class Realtime + class Translations + class Calls + # @api private + sig { params(client: OpenAI::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end + end + end +end diff --git a/rbi/openai/resources/realtime/translations/client_secrets.rbi b/rbi/openai/resources/realtime/translations/client_secrets.rbi new file mode 100644 index 00000000..6d956161 --- /dev/null +++ b/rbi/openai/resources/realtime/translations/client_secrets.rbi @@ -0,0 +1,16 @@ +# typed: strong + +module OpenAI + module Resources + class Realtime + class Translations + class ClientSecrets + # @api private + sig { params(client: OpenAI::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end + end + end +end diff --git a/scripts/detect-breaking-changes b/scripts/detect-breaking-changes index f3f79fd3..d3c5400a 100755 --- a/scripts/detect-breaking-changes +++ b/scripts/detect-breaking-changes @@ -76,6 +76,9 @@ TEST_PATHS=( test/openai/resources/realtime_test.rb test/openai/resources/realtime/client_secrets_test.rb test/openai/resources/realtime/calls_test.rb + test/openai/resources/realtime/translations_test.rb + test/openai/resources/realtime/translations/client_secrets_test.rb + test/openai/resources/realtime/translations/calls_test.rb test/openai/resources/conversations_test.rb test/openai/resources/conversations/items_test.rb test/openai/resources/evals_test.rb diff --git a/sig/openai/models/image_model.rbs b/sig/openai/models/image_model.rbs index 99884446..42ef7cd5 100644 --- a/sig/openai/models/image_model.rbs +++ b/sig/openai/models/image_model.rbs @@ -1,20 +1,26 @@ module OpenAI module Models type image_model = - :"gpt-image-1.5" + :"gpt-image-1" + | :"gpt-image-1-mini" + | :"gpt-image-2" + | :"gpt-image-2-2026-04-21" + | :"gpt-image-1.5" + | :"chatgpt-image-latest" | :"dall-e-2" | :"dall-e-3" - | :"gpt-image-1" - | :"gpt-image-1-mini" module ImageModel extend OpenAI::Internal::Type::Enum + GPT_IMAGE_1: :"gpt-image-1" + GPT_IMAGE_1_MINI: :"gpt-image-1-mini" + GPT_IMAGE_2: :"gpt-image-2" + GPT_IMAGE_2_2026_04_21: :"gpt-image-2-2026-04-21" GPT_IMAGE_1_5: :"gpt-image-1.5" + CHATGPT_IMAGE_LATEST: :"chatgpt-image-latest" DALL_E_2: :"dall-e-2" DALL_E_3: :"dall-e-3" - GPT_IMAGE_1: :"gpt-image-1" - GPT_IMAGE_1_MINI: :"gpt-image-1-mini" def self?.values: -> ::Array[OpenAI::Models::image_model] end diff --git a/sig/openai/models/responses/tool.rbs b/sig/openai/models/responses/tool.rbs index e46f382c..b5733a90 100644 --- a/sig/openai/models/responses/tool.rbs +++ b/sig/openai/models/responses/tool.rbs @@ -493,7 +493,13 @@ module OpenAI end type model = - String | :"gpt-image-1" | :"gpt-image-1-mini" | :"gpt-image-1.5" + String + | :"gpt-image-1" + | :"gpt-image-1-mini" + | :"gpt-image-2" + | :"gpt-image-2-2026-04-21" + | :"gpt-image-1.5" + | :"chatgpt-image-latest" module Model extend OpenAI::Internal::Type::Union @@ -502,7 +508,10 @@ module OpenAI GPT_IMAGE_1: :"gpt-image-1" GPT_IMAGE_1_MINI: :"gpt-image-1-mini" + GPT_IMAGE_2: :"gpt-image-2" + GPT_IMAGE_2_2026_04_21: :"gpt-image-2-2026-04-21" GPT_IMAGE_1_5: :"gpt-image-1.5" + CHATGPT_IMAGE_LATEST: :"chatgpt-image-latest" end type moderation = :auto | :low diff --git a/sig/openai/resources/realtime.rbs b/sig/openai/resources/realtime.rbs index 999debec..a7eabd87 100644 --- a/sig/openai/resources/realtime.rbs +++ b/sig/openai/resources/realtime.rbs @@ -5,6 +5,8 @@ module OpenAI attr_reader calls: OpenAI::Resources::Realtime::Calls + attr_reader translations: OpenAI::Resources::Realtime::Translations + def initialize: (client: OpenAI::Client) -> void end end diff --git a/sig/openai/resources/realtime/translations.rbs b/sig/openai/resources/realtime/translations.rbs new file mode 100644 index 00000000..20a256cc --- /dev/null +++ b/sig/openai/resources/realtime/translations.rbs @@ -0,0 +1,13 @@ +module OpenAI + module Resources + class Realtime + class Translations + attr_reader client_secrets: OpenAI::Resources::Realtime::Translations::ClientSecrets + + attr_reader calls: OpenAI::Resources::Realtime::Translations::Calls + + def initialize: (client: OpenAI::Client) -> void + end + end + end +end diff --git a/sig/openai/resources/realtime/translations/calls.rbs b/sig/openai/resources/realtime/translations/calls.rbs new file mode 100644 index 00000000..1476aae9 --- /dev/null +++ b/sig/openai/resources/realtime/translations/calls.rbs @@ -0,0 +1,11 @@ +module OpenAI + module Resources + class Realtime + class Translations + class Calls + def initialize: (client: OpenAI::Client) -> void + end + end + end + end +end diff --git a/sig/openai/resources/realtime/translations/client_secrets.rbs b/sig/openai/resources/realtime/translations/client_secrets.rbs new file mode 100644 index 00000000..501f5958 --- /dev/null +++ b/sig/openai/resources/realtime/translations/client_secrets.rbs @@ -0,0 +1,11 @@ +module OpenAI + module Resources + class Realtime + class Translations + class ClientSecrets + def initialize: (client: OpenAI::Client) -> void + end + end + end + end +end diff --git a/test/openai/resource_namespaces.rb b/test/openai/resource_namespaces.rb index 049d6f36..e49d771f 100644 --- a/test/openai/resource_namespaces.rb +++ b/test/openai/resource_namespaces.rb @@ -112,6 +112,8 @@ module Users end module Realtime + module Translations + end end module Responses @@ -130,6 +132,9 @@ module Runs end end + module Translations + end + module Uploads end diff --git a/test/openai/resources/realtime/translations/calls_test.rb b/test/openai/resources/realtime/translations/calls_test.rb new file mode 100644 index 00000000..77b4f354 --- /dev/null +++ b/test/openai/resources/realtime/translations/calls_test.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +require_relative "../../../test_helper" + +class OpenAI::Test::Resources::Realtime::Translations::CallsTest < OpenAI::Test::ResourceTest +end diff --git a/test/openai/resources/realtime/translations/client_secrets_test.rb b/test/openai/resources/realtime/translations/client_secrets_test.rb new file mode 100644 index 00000000..8c5dacba --- /dev/null +++ b/test/openai/resources/realtime/translations/client_secrets_test.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +require_relative "../../../test_helper" + +class OpenAI::Test::Resources::Realtime::Translations::ClientSecretsTest < OpenAI::Test::ResourceTest +end diff --git a/test/openai/resources/realtime/translations_test.rb b/test/openai/resources/realtime/translations_test.rb new file mode 100644 index 00000000..acee1899 --- /dev/null +++ b/test/openai/resources/realtime/translations_test.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +require_relative "../../test_helper" + +class OpenAI::Test::Resources::Realtime::TranslationsTest < OpenAI::Test::ResourceTest +end From 20c82091b6c24668e90ed895dfc7e88b0aafd977 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 17:11:46 +0000 Subject: [PATCH 07/16] feat(api): manual updates --- .stats.yml | 4 +- lib/openai.rb | 3 - lib/openai/models/image_edit_params.rb | 59 ++++---- lib/openai/models/image_generate_params.rb | 63 ++++----- lib/openai/models/responses/tool.rb | 65 +++++---- lib/openai/resources/images.rb | 8 +- lib/openai/resources/realtime.rb | 4 - lib/openai/resources/realtime/translations.rb | 24 ---- .../resources/realtime/translations/calls.rb | 18 --- .../realtime/translations/client_secrets.rb | 18 --- rbi/openai/models/image_edit_params.rbi | 98 ++++++------- rbi/openai/models/image_generate_params.rbi | 105 +++++++------- rbi/openai/models/responses/tool.rbi | 129 +++++++++--------- rbi/openai/resources/images.rbi | 110 +++++++++++---- rbi/openai/resources/realtime.rbi | 3 - .../resources/realtime/translations.rbi | 22 --- .../resources/realtime/translations/calls.rbi | 16 --- .../realtime/translations/client_secrets.rbi | 16 --- scripts/detect-breaking-changes | 3 - sig/openai/models/image_edit_params.rbs | 29 +--- sig/openai/models/image_generate_params.rbs | 33 +---- sig/openai/models/responses/tool.rbs | 25 +--- sig/openai/resources/images.rbs | 8 +- sig/openai/resources/realtime.rbs | 2 - .../resources/realtime/translations.rbs | 13 -- .../resources/realtime/translations/calls.rbs | 11 -- .../realtime/translations/client_secrets.rbs | 11 -- test/openai/resource_namespaces.rb | 5 - .../realtime/translations/calls_test.rb | 6 - .../translations/client_secrets_test.rb | 6 - .../resources/realtime/translations_test.rb | 6 - 31 files changed, 362 insertions(+), 561 deletions(-) delete mode 100644 lib/openai/resources/realtime/translations.rb delete mode 100644 lib/openai/resources/realtime/translations/calls.rb delete mode 100644 lib/openai/resources/realtime/translations/client_secrets.rb delete mode 100644 rbi/openai/resources/realtime/translations.rbi delete mode 100644 rbi/openai/resources/realtime/translations/calls.rbi delete mode 100644 rbi/openai/resources/realtime/translations/client_secrets.rbi delete mode 100644 sig/openai/resources/realtime/translations.rbs delete mode 100644 sig/openai/resources/realtime/translations/calls.rbs delete mode 100644 sig/openai/resources/realtime/translations/client_secrets.rbs delete mode 100644 test/openai/resources/realtime/translations/calls_test.rb delete mode 100644 test/openai/resources/realtime/translations/client_secrets_test.rb delete mode 100644 test/openai/resources/realtime/translations_test.rb diff --git a/.stats.yml b/.stats.yml index 56a45391..aeb20505 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 232 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-5ae2eda70e6a4a375842fb8bf3e88deab8e0aad1b3871b86e73274f131bb37ce.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-5002c7ce1688cf372f6c268507494c5e6396f38db8d85d79029d949b7bb06fe3.yml openapi_spec_hash: 92713b0825f6b8760836778e6d27e837 -config_hash: c15a744b2771a3948032b2438475b330 +config_hash: c6cf65d9b19a16ce4313602a2204d48f diff --git a/lib/openai.rb b/lib/openai.rb index 4da9e380..b57fdc78 100644 --- a/lib/openai.rb +++ b/lib/openai.rb @@ -985,9 +985,6 @@ require_relative "openai/resources/realtime" require_relative "openai/resources/realtime/calls" require_relative "openai/resources/realtime/client_secrets" -require_relative "openai/resources/realtime/translations" -require_relative "openai/resources/realtime/translations/calls" -require_relative "openai/resources/realtime/translations/client_secrets" require_relative "openai/resources/responses" require_relative "openai/resources/responses/input_items" require_relative "openai/resources/responses/input_tokens" diff --git a/lib/openai/models/image_edit_params.rb b/lib/openai/models/image_edit_params.rb index 07edb47a..75866770 100644 --- a/lib/openai/models/image_edit_params.rb +++ b/lib/openai/models/image_edit_params.rb @@ -32,9 +32,14 @@ class ImageEditParams < OpenAI::Internal::Type::BaseModel # @!attribute background # Allows to set transparency for the background of the generated image(s). This - # parameter is only supported for the GPT image models. Must be one of - # `transparent`, `opaque` or `auto` (default value). When `auto` is used, the - # model will automatically determine the best background for the image. + # parameter is only supported for GPT image models that support transparent + # backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value). + # When `auto` is used, the model will automatically determine the best background + # for the image. + # + # `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent + # backgrounds. Requests with `background` set to `transparent` will return an + # error for these models; use `opaque` or `auto` instead. # # If `transparent`, the output format needs to support transparency, so it should # be set to either `png` (default value) or `webp`. @@ -119,12 +124,20 @@ class ImageEditParams < OpenAI::Internal::Type::BaseModel optional :response_format, enum: -> { OpenAI::ImageEditParams::ResponseFormat }, nil?: true # @!attribute size - # The size of the generated images. Must be one of `1024x1024`, `1536x1024` - # (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image - # models, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. + # The size of the generated images. For `gpt-image-2` and + # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` + # strings, for example `1536x864`. Width and height must both be divisible by 16 + # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above + # `2560x1440` are experimental, and the maximum supported resolution is + # `3840x2160`. The requested size must also satisfy the model's current pixel and + # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are + # supported by the GPT image models; `auto` is supported for models that allow + # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or + # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or + # `1024x1792`. # - # @return [Symbol, OpenAI::Models::ImageEditParams::Size, nil] - optional :size, enum: -> { OpenAI::ImageEditParams::Size }, nil?: true + # @return [String, nil] + optional :size, String, nil?: true # @!attribute user # A unique identifier representing your end-user, which can help OpenAI to monitor @@ -162,7 +175,7 @@ class ImageEditParams < OpenAI::Internal::Type::BaseModel # # @param response_format [Symbol, OpenAI::Models::ImageEditParams::ResponseFormat, nil] The format in which the generated images are returned. Must be one of `url` or ` # - # @param size [Symbol, OpenAI::Models::ImageEditParams::Size, nil] The size of the generated images. Must be one of `1024x1024`, `1536x1024` (lands + # @param size [String, nil] The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21` # # @param user [String] A unique identifier representing your end-user, which can help OpenAI to monitor # @@ -192,9 +205,14 @@ module Image end # Allows to set transparency for the background of the generated image(s). This - # parameter is only supported for the GPT image models. Must be one of - # `transparent`, `opaque` or `auto` (default value). When `auto` is used, the - # model will automatically determine the best background for the image. + # parameter is only supported for GPT image models that support transparent + # backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value). + # When `auto` is used, the model will automatically determine the best background + # for the image. + # + # `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent + # backgrounds. Requests with `background` set to `transparent` will return an + # error for these models; use `opaque` or `auto` instead. # # If `transparent`, the output format needs to support transparency, so it should # be set to either `png` (default value) or `webp`. @@ -281,23 +299,6 @@ module ResponseFormat # @!method self.values # @return [Array] end - - # The size of the generated images. Must be one of `1024x1024`, `1536x1024` - # (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image - # models, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. - module Size - extend OpenAI::Internal::Type::Enum - - SIZE_256X256 = :"256x256" - SIZE_512X512 = :"512x512" - SIZE_1024X1024 = :"1024x1024" - SIZE_1536X1024 = :"1536x1024" - SIZE_1024X1536 = :"1024x1536" - AUTO = :auto - - # @!method self.values - # @return [Array] - end end end end diff --git a/lib/openai/models/image_generate_params.rb b/lib/openai/models/image_generate_params.rb index 7270a3b3..189c7788 100644 --- a/lib/openai/models/image_generate_params.rb +++ b/lib/openai/models/image_generate_params.rb @@ -19,9 +19,14 @@ class ImageGenerateParams < OpenAI::Internal::Type::BaseModel # @!attribute background # Allows to set transparency for the background of the generated image(s). This - # parameter is only supported for the GPT image models. Must be one of - # `transparent`, `opaque` or `auto` (default value). When `auto` is used, the - # model will automatically determine the best background for the image. + # parameter is only supported for GPT image models that support transparent + # backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value). + # When `auto` is used, the model will automatically determine the best background + # for the image. + # + # `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent + # backgrounds. Requests with `background` set to `transparent` will return an + # error for these models; use `opaque` or `auto` instead. # # If `transparent`, the output format needs to support transparency, so it should # be set to either `png` (default value) or `webp`. @@ -101,13 +106,20 @@ class ImageGenerateParams < OpenAI::Internal::Type::BaseModel optional :response_format, enum: -> { OpenAI::ImageGenerateParams::ResponseFormat }, nil?: true # @!attribute size - # The size of the generated images. Must be one of `1024x1024`, `1536x1024` - # (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image - # models, one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`, and one of - # `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3`. + # The size of the generated images. For `gpt-image-2` and + # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` + # strings, for example `1536x864`. Width and height must both be divisible by 16 + # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above + # `2560x1440` are experimental, and the maximum supported resolution is + # `3840x2160`. The requested size must also satisfy the model's current pixel and + # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are + # supported by the GPT image models; `auto` is supported for models that allow + # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or + # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or + # `1024x1792`. # - # @return [Symbol, OpenAI::Models::ImageGenerateParams::Size, nil] - optional :size, enum: -> { OpenAI::ImageGenerateParams::Size }, nil?: true + # @return [String, nil] + optional :size, String, nil?: true # @!attribute style # The style of the generated images. This parameter is only supported for @@ -150,7 +162,7 @@ class ImageGenerateParams < OpenAI::Internal::Type::BaseModel # # @param response_format [Symbol, OpenAI::Models::ImageGenerateParams::ResponseFormat, nil] The format in which generated images with `dall-e-2` and `dall-e-3` are returned # - # @param size [Symbol, OpenAI::Models::ImageGenerateParams::Size, nil] The size of the generated images. Must be one of `1024x1024`, `1536x1024` (lands + # @param size [String, nil] The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21` # # @param style [Symbol, OpenAI::Models::ImageGenerateParams::Style, nil] The style of the generated images. This parameter is only supported for `dall-e- # @@ -159,9 +171,14 @@ class ImageGenerateParams < OpenAI::Internal::Type::BaseModel # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] # Allows to set transparency for the background of the generated image(s). This - # parameter is only supported for the GPT image models. Must be one of - # `transparent`, `opaque` or `auto` (default value). When `auto` is used, the - # model will automatically determine the best background for the image. + # parameter is only supported for GPT image models that support transparent + # backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value). + # When `auto` is used, the model will automatically determine the best background + # for the image. + # + # `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent + # backgrounds. Requests with `background` set to `transparent` will return an + # error for these models; use `opaque` or `auto` instead. # # If `transparent`, the output format needs to support transparency, so it should # be set to either `png` (default value) or `webp`. @@ -253,26 +270,6 @@ module ResponseFormat # @return [Array] end - # The size of the generated images. Must be one of `1024x1024`, `1536x1024` - # (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image - # models, one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`, and one of - # `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3`. - module Size - extend OpenAI::Internal::Type::Enum - - AUTO = :auto - SIZE_1024X1024 = :"1024x1024" - SIZE_1536X1024 = :"1536x1024" - SIZE_1024X1536 = :"1024x1536" - SIZE_256X256 = :"256x256" - SIZE_512X512 = :"512x512" - SIZE_1792X1024 = :"1792x1024" - SIZE_1024X1792 = :"1024x1792" - - # @!method self.values - # @return [Array] - end - # The style of the generated images. This parameter is only supported for # `dall-e-3`. Must be one of `vivid` or `natural`. Vivid causes the model to lean # towards generating hyper-real and dramatic images. Natural causes the model to diff --git a/lib/openai/models/responses/tool.rb b/lib/openai/models/responses/tool.rb index 08d26e5c..4213ce8e 100644 --- a/lib/openai/models/responses/tool.rb +++ b/lib/openai/models/responses/tool.rb @@ -495,8 +495,18 @@ class ImageGeneration < OpenAI::Internal::Type::BaseModel optional :action, enum: -> { OpenAI::Responses::Tool::ImageGeneration::Action } # @!attribute background - # Background type for the generated image. One of `transparent`, `opaque`, or - # `auto`. Default: `auto`. + # Allows to set transparency for the background of the generated image(s). This + # parameter is only supported for GPT image models that support transparent + # backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value). + # When `auto` is used, the model will automatically determine the best background + # for the image. + # + # `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent + # backgrounds. Requests with `background` set to `transparent` will return an + # error for these models; use `opaque` or `auto` instead. + # + # If `transparent`, the output format needs to support transparency, so it should + # be set to either `png` (default value) or `webp`. # # @return [Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::Background, nil] optional :background, enum: -> { OpenAI::Responses::Tool::ImageGeneration::Background } @@ -561,11 +571,20 @@ class ImageGeneration < OpenAI::Internal::Type::BaseModel optional :quality, enum: -> { OpenAI::Responses::Tool::ImageGeneration::Quality } # @!attribute size - # The size of the generated image. One of `1024x1024`, `1024x1536`, `1536x1024`, - # or `auto`. Default: `auto`. + # The size of the generated images. For `gpt-image-2` and + # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` + # strings, for example `1536x864`. Width and height must both be divisible by 16 + # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above + # `2560x1440` are experimental, and the maximum supported resolution is + # `3840x2160`. The requested size must also satisfy the model's current pixel and + # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are + # supported by the GPT image models; `auto` is supported for models that allow + # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or + # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or + # `1024x1792`. # - # @return [Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::Size, nil] - optional :size, enum: -> { OpenAI::Responses::Tool::ImageGeneration::Size } + # @return [String, nil] + optional :size, String # @!method initialize(action: nil, background: nil, input_fidelity: nil, input_image_mask: nil, model: nil, moderation: nil, output_compression: nil, output_format: nil, partial_images: nil, quality: nil, size: nil, type: :image_generation) # Some parameter documentations has been truncated, see @@ -575,7 +594,7 @@ class ImageGeneration < OpenAI::Internal::Type::BaseModel # # @param action [Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::Action] Whether to generate a new image or edit an existing image. Default: `auto`. # - # @param background [Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::Background] Background type for the generated image. One of `transparent`, + # @param background [Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::Background] Allows to set transparency for the background of the generated image(s). # # @param input_fidelity [Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::InputFidelity, nil] Control how much effort the model will exert to match the style and features, es # @@ -593,7 +612,7 @@ class ImageGeneration < OpenAI::Internal::Type::BaseModel # # @param quality [Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::Quality] The quality of the generated image. One of `low`, `medium`, `high`, # - # @param size [Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::Size] The size of the generated image. One of `1024x1024`, `1024x1536`, + # @param size [String] The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21` # # @param type [Symbol, :image_generation] The type of the image generation tool. Always `image_generation`. @@ -611,8 +630,18 @@ module Action # @return [Array] end - # Background type for the generated image. One of `transparent`, `opaque`, or - # `auto`. Default: `auto`. + # Allows to set transparency for the background of the generated image(s). This + # parameter is only supported for GPT image models that support transparent + # backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value). + # When `auto` is used, the model will automatically determine the best background + # for the image. + # + # `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent + # backgrounds. Requests with `background` set to `transparent` will return an + # error for these models; use `opaque` or `auto` instead. + # + # If `transparent`, the output format needs to support transparency, so it should + # be set to either `png` (default value) or `webp`. # # @see OpenAI::Models::Responses::Tool::ImageGeneration#background module Background @@ -751,22 +780,6 @@ module Quality # @!method self.values # @return [Array] end - - # The size of the generated image. One of `1024x1024`, `1024x1536`, `1536x1024`, - # or `auto`. Default: `auto`. - # - # @see OpenAI::Models::Responses::Tool::ImageGeneration#size - module Size - extend OpenAI::Internal::Type::Enum - - SIZE_1024X1024 = :"1024x1024" - SIZE_1024X1536 = :"1024x1536" - SIZE_1536X1024 = :"1536x1024" - AUTO = :auto - - # @!method self.values - # @return [Array] - end end class LocalShell < OpenAI::Internal::Type::BaseModel diff --git a/lib/openai/resources/images.rb b/lib/openai/resources/images.rb index 8eeefe1a..ed51ab94 100644 --- a/lib/openai/resources/images.rb +++ b/lib/openai/resources/images.rb @@ -76,7 +76,7 @@ def create_variation(params) # # @param response_format [Symbol, OpenAI::Models::ImageEditParams::ResponseFormat, nil] The format in which the generated images are returned. Must be one of `url` or ` # - # @param size [Symbol, OpenAI::Models::ImageEditParams::Size, nil] The size of the generated images. Must be one of `1024x1024`, `1536x1024` (lands + # @param size [String, nil] The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21` # # @param user [String] A unique identifier representing your end-user, which can help OpenAI to monitor # @@ -137,7 +137,7 @@ def edit(params) # # @param response_format [Symbol, OpenAI::Models::ImageEditParams::ResponseFormat, nil] The format in which the generated images are returned. Must be one of `url` or ` # - # @param size [Symbol, OpenAI::Models::ImageEditParams::Size, nil] The size of the generated images. Must be one of `1024x1024`, `1536x1024` (lands + # @param size [String, nil] The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21` # # @param user [String] A unique identifier representing your end-user, which can help OpenAI to monitor # @@ -199,7 +199,7 @@ def edit_stream_raw(params) # # @param response_format [Symbol, OpenAI::Models::ImageGenerateParams::ResponseFormat, nil] The format in which generated images with `dall-e-2` and `dall-e-3` are returned # - # @param size [Symbol, OpenAI::Models::ImageGenerateParams::Size, nil] The size of the generated images. Must be one of `1024x1024`, `1536x1024` (lands + # @param size [String, nil] The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21` # # @param style [Symbol, OpenAI::Models::ImageGenerateParams::Style, nil] The style of the generated images. This parameter is only supported for `dall-e- # @@ -256,7 +256,7 @@ def generate(params) # # @param response_format [Symbol, OpenAI::Models::ImageGenerateParams::ResponseFormat, nil] The format in which generated images with `dall-e-2` and `dall-e-3` are returned # - # @param size [Symbol, OpenAI::Models::ImageGenerateParams::Size, nil] The size of the generated images. Must be one of `1024x1024`, `1536x1024` (lands + # @param size [String, nil] The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21` # # @param style [Symbol, OpenAI::Models::ImageGenerateParams::Style, nil] The style of the generated images. This parameter is only supported for `dall-e- # diff --git a/lib/openai/resources/realtime.rb b/lib/openai/resources/realtime.rb index 510ce241..f361d152 100644 --- a/lib/openai/resources/realtime.rb +++ b/lib/openai/resources/realtime.rb @@ -9,9 +9,6 @@ class Realtime # @return [OpenAI::Resources::Realtime::Calls] attr_reader :calls - # @return [OpenAI::Resources::Realtime::Translations] - attr_reader :translations - # @api private # # @param client [OpenAI::Client] @@ -19,7 +16,6 @@ def initialize(client:) @client = client @client_secrets = OpenAI::Resources::Realtime::ClientSecrets.new(client: client) @calls = OpenAI::Resources::Realtime::Calls.new(client: client) - @translations = OpenAI::Resources::Realtime::Translations.new(client: client) end end end diff --git a/lib/openai/resources/realtime/translations.rb b/lib/openai/resources/realtime/translations.rb deleted file mode 100644 index cfade19a..00000000 --- a/lib/openai/resources/realtime/translations.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -module OpenAI - module Resources - class Realtime - class Translations - # @return [OpenAI::Resources::Realtime::Translations::ClientSecrets] - attr_reader :client_secrets - - # @return [OpenAI::Resources::Realtime::Translations::Calls] - attr_reader :calls - - # @api private - # - # @param client [OpenAI::Client] - def initialize(client:) - @client = client - @client_secrets = OpenAI::Resources::Realtime::Translations::ClientSecrets.new(client: client) - @calls = OpenAI::Resources::Realtime::Translations::Calls.new(client: client) - end - end - end - end -end diff --git a/lib/openai/resources/realtime/translations/calls.rb b/lib/openai/resources/realtime/translations/calls.rb deleted file mode 100644 index 198aabaf..00000000 --- a/lib/openai/resources/realtime/translations/calls.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module OpenAI - module Resources - class Realtime - class Translations - class Calls - # @api private - # - # @param client [OpenAI::Client] - def initialize(client:) - @client = client - end - end - end - end - end -end diff --git a/lib/openai/resources/realtime/translations/client_secrets.rb b/lib/openai/resources/realtime/translations/client_secrets.rb deleted file mode 100644 index b4efce3f..00000000 --- a/lib/openai/resources/realtime/translations/client_secrets.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module OpenAI - module Resources - class Realtime - class Translations - class ClientSecrets - # @api private - # - # @param client [OpenAI::Client] - def initialize(client:) - @client = client - end - end - end - end - end -end diff --git a/rbi/openai/models/image_edit_params.rbi b/rbi/openai/models/image_edit_params.rbi index 65691ce3..c0119949 100644 --- a/rbi/openai/models/image_edit_params.rbi +++ b/rbi/openai/models/image_edit_params.rbi @@ -29,9 +29,14 @@ module OpenAI attr_accessor :prompt # Allows to set transparency for the background of the generated image(s). This - # parameter is only supported for the GPT image models. Must be one of - # `transparent`, `opaque` or `auto` (default value). When `auto` is used, the - # model will automatically determine the best background for the image. + # parameter is only supported for GPT image models that support transparent + # backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value). + # When `auto` is used, the model will automatically determine the best background + # for the image. + # + # `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent + # backgrounds. Requests with `background` set to `transparent` will return an + # error for these models; use `opaque` or `auto` instead. # # If `transparent`, the output format needs to support transparency, so it should # be set to either `png` (default value) or `webp`. @@ -105,10 +110,18 @@ module OpenAI end attr_accessor :response_format - # The size of the generated images. Must be one of `1024x1024`, `1536x1024` - # (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image - # models, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. - sig { returns(T.nilable(OpenAI::ImageEditParams::Size::OrSymbol)) } + # The size of the generated images. For `gpt-image-2` and + # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` + # strings, for example `1536x864`. Width and height must both be divisible by 16 + # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above + # `2560x1440` are experimental, and the maximum supported resolution is + # `3840x2160`. The requested size must also satisfy the model's current pixel and + # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are + # supported by the GPT image models; `auto` is supported for models that allow + # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or + # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or + # `1024x1792`. + sig { returns(T.nilable(String)) } attr_accessor :size # A unique identifier representing your end-user, which can help OpenAI to monitor @@ -137,7 +150,7 @@ module OpenAI quality: T.nilable(OpenAI::ImageEditParams::Quality::OrSymbol), response_format: T.nilable(OpenAI::ImageEditParams::ResponseFormat::OrSymbol), - size: T.nilable(OpenAI::ImageEditParams::Size::OrSymbol), + size: T.nilable(String), user: String, request_options: OpenAI::RequestOptions::OrHash ).returns(T.attached_class) @@ -157,9 +170,14 @@ module OpenAI # characters for `dall-e-2`, and 32000 characters for the GPT image models. prompt:, # Allows to set transparency for the background of the generated image(s). This - # parameter is only supported for the GPT image models. Must be one of - # `transparent`, `opaque` or `auto` (default value). When `auto` is used, the - # model will automatically determine the best background for the image. + # parameter is only supported for GPT image models that support transparent + # backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value). + # When `auto` is used, the model will automatically determine the best background + # for the image. + # + # `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent + # backgrounds. Requests with `background` set to `transparent` will return an + # error for these models; use `opaque` or `auto` instead. # # If `transparent`, the output format needs to support transparency, so it should # be set to either `png` (default value) or `webp`. @@ -204,9 +222,17 @@ module OpenAI # generated. This parameter is only supported for `dall-e-2` (default is `url` for # `dall-e-2`), as GPT image models always return base64-encoded images. response_format: nil, - # The size of the generated images. Must be one of `1024x1024`, `1536x1024` - # (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image - # models, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. + # The size of the generated images. For `gpt-image-2` and + # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` + # strings, for example `1536x864`. Width and height must both be divisible by 16 + # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above + # `2560x1440` are experimental, and the maximum supported resolution is + # `3840x2160`. The requested size must also satisfy the model's current pixel and + # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are + # supported by the GPT image models; `auto` is supported for models that allow + # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or + # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or + # `1024x1792`. size: nil, # A unique identifier representing your end-user, which can help OpenAI to monitor # and detect abuse. @@ -235,7 +261,7 @@ module OpenAI quality: T.nilable(OpenAI::ImageEditParams::Quality::OrSymbol), response_format: T.nilable(OpenAI::ImageEditParams::ResponseFormat::OrSymbol), - size: T.nilable(OpenAI::ImageEditParams::Size::OrSymbol), + size: T.nilable(String), user: String, request_options: OpenAI::RequestOptions } @@ -272,9 +298,14 @@ module OpenAI end # Allows to set transparency for the background of the generated image(s). This - # parameter is only supported for the GPT image models. Must be one of - # `transparent`, `opaque` or `auto` (default value). When `auto` is used, the - # model will automatically determine the best background for the image. + # parameter is only supported for GPT image models that support transparent + # backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value). + # When `auto` is used, the model will automatically determine the best background + # for the image. + # + # `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent + # backgrounds. Requests with `background` set to `transparent` will return an + # error for these models; use `opaque` or `auto` instead. # # If `transparent`, the output format needs to support transparency, so it should # be set to either `png` (default value) or `webp`. @@ -417,37 +448,6 @@ module OpenAI def self.values end end - - # The size of the generated images. Must be one of `1024x1024`, `1536x1024` - # (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image - # models, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. - module Size - extend OpenAI::Internal::Type::Enum - - TaggedSymbol = - T.type_alias { T.all(Symbol, OpenAI::ImageEditParams::Size) } - OrSymbol = T.type_alias { T.any(Symbol, String) } - - SIZE_256X256 = - T.let(:"256x256", OpenAI::ImageEditParams::Size::TaggedSymbol) - SIZE_512X512 = - T.let(:"512x512", OpenAI::ImageEditParams::Size::TaggedSymbol) - SIZE_1024X1024 = - T.let(:"1024x1024", OpenAI::ImageEditParams::Size::TaggedSymbol) - SIZE_1536X1024 = - T.let(:"1536x1024", OpenAI::ImageEditParams::Size::TaggedSymbol) - SIZE_1024X1536 = - T.let(:"1024x1536", OpenAI::ImageEditParams::Size::TaggedSymbol) - AUTO = T.let(:auto, OpenAI::ImageEditParams::Size::TaggedSymbol) - - sig do - override.returns( - T::Array[OpenAI::ImageEditParams::Size::TaggedSymbol] - ) - end - def self.values - end - end end end end diff --git a/rbi/openai/models/image_generate_params.rbi b/rbi/openai/models/image_generate_params.rbi index 964fc9d1..781e70e9 100644 --- a/rbi/openai/models/image_generate_params.rbi +++ b/rbi/openai/models/image_generate_params.rbi @@ -18,9 +18,14 @@ module OpenAI attr_accessor :prompt # Allows to set transparency for the background of the generated image(s). This - # parameter is only supported for the GPT image models. Must be one of - # `transparent`, `opaque` or `auto` (default value). When `auto` is used, the - # model will automatically determine the best background for the image. + # parameter is only supported for GPT image models that support transparent + # backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value). + # When `auto` is used, the model will automatically determine the best background + # for the image. + # + # `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent + # backgrounds. Requests with `background` set to `transparent` will return an + # error for these models; use `opaque` or `auto` instead. # # If `transparent`, the output format needs to support transparency, so it should # be set to either `png` (default value) or `webp`. @@ -92,11 +97,18 @@ module OpenAI end attr_accessor :response_format - # The size of the generated images. Must be one of `1024x1024`, `1536x1024` - # (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image - # models, one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`, and one of - # `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3`. - sig { returns(T.nilable(OpenAI::ImageGenerateParams::Size::OrSymbol)) } + # The size of the generated images. For `gpt-image-2` and + # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` + # strings, for example `1536x864`. Width and height must both be divisible by 16 + # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above + # `2560x1440` are experimental, and the maximum supported resolution is + # `3840x2160`. The requested size must also satisfy the model's current pixel and + # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are + # supported by the GPT image models; `auto` is supported for models that allow + # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or + # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or + # `1024x1792`. + sig { returns(T.nilable(String)) } attr_accessor :size # The style of the generated images. This parameter is only supported for @@ -131,7 +143,7 @@ module OpenAI quality: T.nilable(OpenAI::ImageGenerateParams::Quality::OrSymbol), response_format: T.nilable(OpenAI::ImageGenerateParams::ResponseFormat::OrSymbol), - size: T.nilable(OpenAI::ImageGenerateParams::Size::OrSymbol), + size: T.nilable(String), style: T.nilable(OpenAI::ImageGenerateParams::Style::OrSymbol), user: String, request_options: OpenAI::RequestOptions::OrHash @@ -143,9 +155,14 @@ module OpenAI # characters for `dall-e-3`. prompt:, # Allows to set transparency for the background of the generated image(s). This - # parameter is only supported for the GPT image models. Must be one of - # `transparent`, `opaque` or `auto` (default value). When `auto` is used, the - # model will automatically determine the best background for the image. + # parameter is only supported for GPT image models that support transparent + # backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value). + # When `auto` is used, the model will automatically determine the best background + # for the image. + # + # `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent + # backgrounds. Requests with `background` set to `transparent` will return an + # error for these models; use `opaque` or `auto` instead. # # If `transparent`, the output format needs to support transparency, so it should # be set to either `png` (default value) or `webp`. @@ -189,10 +206,17 @@ module OpenAI # after the image has been generated. This parameter isn't supported for the GPT # image models, which always return base64-encoded images. response_format: nil, - # The size of the generated images. Must be one of `1024x1024`, `1536x1024` - # (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image - # models, one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`, and one of - # `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3`. + # The size of the generated images. For `gpt-image-2` and + # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` + # strings, for example `1536x864`. Width and height must both be divisible by 16 + # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above + # `2560x1440` are experimental, and the maximum supported resolution is + # `3840x2160`. The requested size must also satisfy the model's current pixel and + # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are + # supported by the GPT image models; `auto` is supported for models that allow + # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or + # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or + # `1024x1792`. size: nil, # The style of the generated images. This parameter is only supported for # `dall-e-3`. Must be one of `vivid` or `natural`. Vivid causes the model to lean @@ -224,7 +248,7 @@ module OpenAI quality: T.nilable(OpenAI::ImageGenerateParams::Quality::OrSymbol), response_format: T.nilable(OpenAI::ImageGenerateParams::ResponseFormat::OrSymbol), - size: T.nilable(OpenAI::ImageGenerateParams::Size::OrSymbol), + size: T.nilable(String), style: T.nilable(OpenAI::ImageGenerateParams::Style::OrSymbol), user: String, request_options: OpenAI::RequestOptions @@ -235,9 +259,14 @@ module OpenAI end # Allows to set transparency for the background of the generated image(s). This - # parameter is only supported for the GPT image models. Must be one of - # `transparent`, `opaque` or `auto` (default value). When `auto` is used, the - # model will automatically determine the best background for the image. + # parameter is only supported for GPT image models that support transparent + # backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value). + # When `auto` is used, the model will automatically determine the best background + # for the image. + # + # `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent + # backgrounds. Requests with `background` set to `transparent` will return an + # error for these models; use `opaque` or `auto` instead. # # If `transparent`, the output format needs to support transparency, so it should # be set to either `png` (default value) or `webp`. @@ -402,42 +431,6 @@ module OpenAI end end - # The size of the generated images. Must be one of `1024x1024`, `1536x1024` - # (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image - # models, one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`, and one of - # `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3`. - module Size - extend OpenAI::Internal::Type::Enum - - TaggedSymbol = - T.type_alias { T.all(Symbol, OpenAI::ImageGenerateParams::Size) } - OrSymbol = T.type_alias { T.any(Symbol, String) } - - AUTO = T.let(:auto, OpenAI::ImageGenerateParams::Size::TaggedSymbol) - SIZE_1024X1024 = - T.let(:"1024x1024", OpenAI::ImageGenerateParams::Size::TaggedSymbol) - SIZE_1536X1024 = - T.let(:"1536x1024", OpenAI::ImageGenerateParams::Size::TaggedSymbol) - SIZE_1024X1536 = - T.let(:"1024x1536", OpenAI::ImageGenerateParams::Size::TaggedSymbol) - SIZE_256X256 = - T.let(:"256x256", OpenAI::ImageGenerateParams::Size::TaggedSymbol) - SIZE_512X512 = - T.let(:"512x512", OpenAI::ImageGenerateParams::Size::TaggedSymbol) - SIZE_1792X1024 = - T.let(:"1792x1024", OpenAI::ImageGenerateParams::Size::TaggedSymbol) - SIZE_1024X1792 = - T.let(:"1024x1792", OpenAI::ImageGenerateParams::Size::TaggedSymbol) - - sig do - override.returns( - T::Array[OpenAI::ImageGenerateParams::Size::TaggedSymbol] - ) - end - def self.values - end - end - # The style of the generated images. This parameter is only supported for # `dall-e-3`. Must be one of `vivid` or `natural`. Vivid causes the model to lean # towards generating hyper-real and dramatic images. Natural causes the model to diff --git a/rbi/openai/models/responses/tool.rbi b/rbi/openai/models/responses/tool.rbi index 220054ae..4a72f96b 100644 --- a/rbi/openai/models/responses/tool.rbi +++ b/rbi/openai/models/responses/tool.rbi @@ -926,8 +926,18 @@ module OpenAI end attr_writer :action - # Background type for the generated image. One of `transparent`, `opaque`, or - # `auto`. Default: `auto`. + # Allows to set transparency for the background of the generated image(s). This + # parameter is only supported for GPT image models that support transparent + # backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value). + # When `auto` is used, the model will automatically determine the best background + # for the image. + # + # `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent + # backgrounds. Requests with `background` set to `transparent` will return an + # error for these models; use `opaque` or `auto` instead. + # + # If `transparent`, the output format needs to support transparency, so it should + # be set to either `png` (default value) or `webp`. sig do returns( T.nilable( @@ -1072,22 +1082,21 @@ module OpenAI end attr_writer :quality - # The size of the generated image. One of `1024x1024`, `1024x1536`, `1536x1024`, - # or `auto`. Default: `auto`. - sig do - returns( - T.nilable( - OpenAI::Responses::Tool::ImageGeneration::Size::OrSymbol - ) - ) - end + # The size of the generated images. For `gpt-image-2` and + # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` + # strings, for example `1536x864`. Width and height must both be divisible by 16 + # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above + # `2560x1440` are experimental, and the maximum supported resolution is + # `3840x2160`. The requested size must also satisfy the model's current pixel and + # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are + # supported by the GPT image models; `auto` is supported for models that allow + # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or + # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or + # `1024x1792`. + sig { returns(T.nilable(String)) } attr_reader :size - sig do - params( - size: OpenAI::Responses::Tool::ImageGeneration::Size::OrSymbol - ).void - end + sig { params(size: String).void } attr_writer :size # A tool that generates images using the GPT image models. @@ -1116,15 +1125,25 @@ module OpenAI partial_images: Integer, quality: OpenAI::Responses::Tool::ImageGeneration::Quality::OrSymbol, - size: OpenAI::Responses::Tool::ImageGeneration::Size::OrSymbol, + size: String, type: Symbol ).returns(T.attached_class) end def self.new( # Whether to generate a new image or edit an existing image. Default: `auto`. action: nil, - # Background type for the generated image. One of `transparent`, `opaque`, or - # `auto`. Default: `auto`. + # Allows to set transparency for the background of the generated image(s). This + # parameter is only supported for GPT image models that support transparent + # backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value). + # When `auto` is used, the model will automatically determine the best background + # for the image. + # + # `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent + # backgrounds. Requests with `background` set to `transparent` will return an + # error for these models; use `opaque` or `auto` instead. + # + # If `transparent`, the output format needs to support transparency, so it should + # be set to either `png` (default value) or `webp`. background: nil, # Control how much effort the model will exert to match the style and features, # especially facial features, of input images. This parameter is only supported @@ -1149,8 +1168,17 @@ module OpenAI # The quality of the generated image. One of `low`, `medium`, `high`, or `auto`. # Default: `auto`. quality: nil, - # The size of the generated image. One of `1024x1024`, `1024x1536`, `1536x1024`, - # or `auto`. Default: `auto`. + # The size of the generated images. For `gpt-image-2` and + # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` + # strings, for example `1536x864`. Width and height must both be divisible by 16 + # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above + # `2560x1440` are experimental, and the maximum supported resolution is + # `3840x2160`. The requested size must also satisfy the model's current pixel and + # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are + # supported by the GPT image models; `auto` is supported for models that allow + # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or + # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or + # `1024x1792`. size: nil, # The type of the image generation tool. Always `image_generation`. type: :image_generation @@ -1184,7 +1212,7 @@ module OpenAI partial_images: Integer, quality: OpenAI::Responses::Tool::ImageGeneration::Quality::OrSymbol, - size: OpenAI::Responses::Tool::ImageGeneration::Size::OrSymbol + size: String } ) end @@ -1228,8 +1256,18 @@ module OpenAI end end - # Background type for the generated image. One of `transparent`, `opaque`, or - # `auto`. Default: `auto`. + # Allows to set transparency for the background of the generated image(s). This + # parameter is only supported for GPT image models that support transparent + # backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value). + # When `auto` is used, the model will automatically determine the best background + # for the image. + # + # `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent + # backgrounds. Requests with `background` set to `transparent` will return an + # error for these models; use `opaque` or `auto` instead. + # + # If `transparent`, the output format needs to support transparency, so it should + # be set to either `png` (default value) or `webp`. module Background extend OpenAI::Internal::Type::Enum @@ -1528,49 +1566,6 @@ module OpenAI def self.values end end - - # The size of the generated image. One of `1024x1024`, `1024x1536`, `1536x1024`, - # or `auto`. Default: `auto`. - module Size - extend OpenAI::Internal::Type::Enum - - TaggedSymbol = - T.type_alias do - T.all(Symbol, OpenAI::Responses::Tool::ImageGeneration::Size) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - SIZE_1024X1024 = - T.let( - :"1024x1024", - OpenAI::Responses::Tool::ImageGeneration::Size::TaggedSymbol - ) - SIZE_1024X1536 = - T.let( - :"1024x1536", - OpenAI::Responses::Tool::ImageGeneration::Size::TaggedSymbol - ) - SIZE_1536X1024 = - T.let( - :"1536x1024", - OpenAI::Responses::Tool::ImageGeneration::Size::TaggedSymbol - ) - AUTO = - T.let( - :auto, - OpenAI::Responses::Tool::ImageGeneration::Size::TaggedSymbol - ) - - sig do - override.returns( - T::Array[ - OpenAI::Responses::Tool::ImageGeneration::Size::TaggedSymbol - ] - ) - end - def self.values - end - end end class LocalShell < OpenAI::Internal::Type::BaseModel diff --git a/rbi/openai/resources/images.rbi b/rbi/openai/resources/images.rbi index 28ddb9d8..20142713 100644 --- a/rbi/openai/resources/images.rbi +++ b/rbi/openai/resources/images.rbi @@ -65,7 +65,7 @@ module OpenAI quality: T.nilable(OpenAI::ImageEditParams::Quality::OrSymbol), response_format: T.nilable(OpenAI::ImageEditParams::ResponseFormat::OrSymbol), - size: T.nilable(OpenAI::ImageEditParams::Size::OrSymbol), + size: T.nilable(String), user: String, stream: T.noreturn, request_options: OpenAI::RequestOptions::OrHash @@ -86,9 +86,14 @@ module OpenAI # characters for `dall-e-2`, and 32000 characters for the GPT image models. prompt:, # Allows to set transparency for the background of the generated image(s). This - # parameter is only supported for the GPT image models. Must be one of - # `transparent`, `opaque` or `auto` (default value). When `auto` is used, the - # model will automatically determine the best background for the image. + # parameter is only supported for GPT image models that support transparent + # backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value). + # When `auto` is used, the model will automatically determine the best background + # for the image. + # + # `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent + # backgrounds. Requests with `background` set to `transparent` will return an + # error for these models; use `opaque` or `auto` instead. # # If `transparent`, the output format needs to support transparency, so it should # be set to either `png` (default value) or `webp`. @@ -133,9 +138,17 @@ module OpenAI # generated. This parameter is only supported for `dall-e-2` (default is `url` for # `dall-e-2`), as GPT image models always return base64-encoded images. response_format: nil, - # The size of the generated images. Must be one of `1024x1024`, `1536x1024` - # (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image - # models, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. + # The size of the generated images. For `gpt-image-2` and + # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` + # strings, for example `1536x864`. Width and height must both be divisible by 16 + # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above + # `2560x1440` are experimental, and the maximum supported resolution is + # `3840x2160`. The requested size must also satisfy the model's current pixel and + # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are + # supported by the GPT image models; `auto` is supported for models that allow + # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or + # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or + # `1024x1792`. size: nil, # A unique identifier representing your end-user, which can help OpenAI to monitor # and detect abuse. @@ -170,7 +183,7 @@ module OpenAI quality: T.nilable(OpenAI::ImageEditParams::Quality::OrSymbol), response_format: T.nilable(OpenAI::ImageEditParams::ResponseFormat::OrSymbol), - size: T.nilable(OpenAI::ImageEditParams::Size::OrSymbol), + size: T.nilable(String), user: String, stream: T.noreturn, request_options: OpenAI::RequestOptions::OrHash @@ -193,9 +206,14 @@ module OpenAI # characters for `dall-e-2`, and 32000 characters for the GPT image models. prompt:, # Allows to set transparency for the background of the generated image(s). This - # parameter is only supported for the GPT image models. Must be one of - # `transparent`, `opaque` or `auto` (default value). When `auto` is used, the - # model will automatically determine the best background for the image. + # parameter is only supported for GPT image models that support transparent + # backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value). + # When `auto` is used, the model will automatically determine the best background + # for the image. + # + # `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent + # backgrounds. Requests with `background` set to `transparent` will return an + # error for these models; use `opaque` or `auto` instead. # # If `transparent`, the output format needs to support transparency, so it should # be set to either `png` (default value) or `webp`. @@ -240,9 +258,17 @@ module OpenAI # generated. This parameter is only supported for `dall-e-2` (default is `url` for # `dall-e-2`), as GPT image models always return base64-encoded images. response_format: nil, - # The size of the generated images. Must be one of `1024x1024`, `1536x1024` - # (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image - # models, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. + # The size of the generated images. For `gpt-image-2` and + # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` + # strings, for example `1536x864`. Width and height must both be divisible by 16 + # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above + # `2560x1440` are experimental, and the maximum supported resolution is + # `3840x2160`. The requested size must also satisfy the model's current pixel and + # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are + # supported by the GPT image models; `auto` is supported for models that allow + # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or + # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or + # `1024x1792`. size: nil, # A unique identifier representing your end-user, which can help OpenAI to monitor # and detect abuse. @@ -275,7 +301,7 @@ module OpenAI quality: T.nilable(OpenAI::ImageGenerateParams::Quality::OrSymbol), response_format: T.nilable(OpenAI::ImageGenerateParams::ResponseFormat::OrSymbol), - size: T.nilable(OpenAI::ImageGenerateParams::Size::OrSymbol), + size: T.nilable(String), style: T.nilable(OpenAI::ImageGenerateParams::Style::OrSymbol), user: String, stream: T.noreturn, @@ -288,9 +314,14 @@ module OpenAI # characters for `dall-e-3`. prompt:, # Allows to set transparency for the background of the generated image(s). This - # parameter is only supported for the GPT image models. Must be one of - # `transparent`, `opaque` or `auto` (default value). When `auto` is used, the - # model will automatically determine the best background for the image. + # parameter is only supported for GPT image models that support transparent + # backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value). + # When `auto` is used, the model will automatically determine the best background + # for the image. + # + # `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent + # backgrounds. Requests with `background` set to `transparent` will return an + # error for these models; use `opaque` or `auto` instead. # # If `transparent`, the output format needs to support transparency, so it should # be set to either `png` (default value) or `webp`. @@ -334,10 +365,17 @@ module OpenAI # after the image has been generated. This parameter isn't supported for the GPT # image models, which always return base64-encoded images. response_format: nil, - # The size of the generated images. Must be one of `1024x1024`, `1536x1024` - # (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image - # models, one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`, and one of - # `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3`. + # The size of the generated images. For `gpt-image-2` and + # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` + # strings, for example `1536x864`. Width and height must both be divisible by 16 + # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above + # `2560x1440` are experimental, and the maximum supported resolution is + # `3840x2160`. The requested size must also satisfy the model's current pixel and + # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are + # supported by the GPT image models; `auto` is supported for models that allow + # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or + # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or + # `1024x1792`. size: nil, # The style of the generated images. This parameter is only supported for # `dall-e-3`. Must be one of `vivid` or `natural`. Vivid causes the model to lean @@ -375,7 +413,7 @@ module OpenAI quality: T.nilable(OpenAI::ImageGenerateParams::Quality::OrSymbol), response_format: T.nilable(OpenAI::ImageGenerateParams::ResponseFormat::OrSymbol), - size: T.nilable(OpenAI::ImageGenerateParams::Size::OrSymbol), + size: T.nilable(String), style: T.nilable(OpenAI::ImageGenerateParams::Style::OrSymbol), user: String, stream: T.noreturn, @@ -390,9 +428,14 @@ module OpenAI # characters for `dall-e-3`. prompt:, # Allows to set transparency for the background of the generated image(s). This - # parameter is only supported for the GPT image models. Must be one of - # `transparent`, `opaque` or `auto` (default value). When `auto` is used, the - # model will automatically determine the best background for the image. + # parameter is only supported for GPT image models that support transparent + # backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value). + # When `auto` is used, the model will automatically determine the best background + # for the image. + # + # `gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent + # backgrounds. Requests with `background` set to `transparent` will return an + # error for these models; use `opaque` or `auto` instead. # # If `transparent`, the output format needs to support transparency, so it should # be set to either `png` (default value) or `webp`. @@ -436,10 +479,17 @@ module OpenAI # after the image has been generated. This parameter isn't supported for the GPT # image models, which always return base64-encoded images. response_format: nil, - # The size of the generated images. Must be one of `1024x1024`, `1536x1024` - # (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image - # models, one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`, and one of - # `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3`. + # The size of the generated images. For `gpt-image-2` and + # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` + # strings, for example `1536x864`. Width and height must both be divisible by 16 + # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above + # `2560x1440` are experimental, and the maximum supported resolution is + # `3840x2160`. The requested size must also satisfy the model's current pixel and + # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are + # supported by the GPT image models; `auto` is supported for models that allow + # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or + # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or + # `1024x1792`. size: nil, # The style of the generated images. This parameter is only supported for # `dall-e-3`. Must be one of `vivid` or `natural`. Vivid causes the model to lean diff --git a/rbi/openai/resources/realtime.rbi b/rbi/openai/resources/realtime.rbi index a8991eef..93c14444 100644 --- a/rbi/openai/resources/realtime.rbi +++ b/rbi/openai/resources/realtime.rbi @@ -9,9 +9,6 @@ module OpenAI sig { returns(OpenAI::Resources::Realtime::Calls) } attr_reader :calls - sig { returns(OpenAI::Resources::Realtime::Translations) } - attr_reader :translations - # @api private sig { params(client: OpenAI::Client).returns(T.attached_class) } def self.new(client:) diff --git a/rbi/openai/resources/realtime/translations.rbi b/rbi/openai/resources/realtime/translations.rbi deleted file mode 100644 index bcb95957..00000000 --- a/rbi/openai/resources/realtime/translations.rbi +++ /dev/null @@ -1,22 +0,0 @@ -# typed: strong - -module OpenAI - module Resources - class Realtime - class Translations - sig do - returns(OpenAI::Resources::Realtime::Translations::ClientSecrets) - end - attr_reader :client_secrets - - sig { returns(OpenAI::Resources::Realtime::Translations::Calls) } - attr_reader :calls - - # @api private - sig { params(client: OpenAI::Client).returns(T.attached_class) } - def self.new(client:) - end - end - end - end -end diff --git a/rbi/openai/resources/realtime/translations/calls.rbi b/rbi/openai/resources/realtime/translations/calls.rbi deleted file mode 100644 index 588cc975..00000000 --- a/rbi/openai/resources/realtime/translations/calls.rbi +++ /dev/null @@ -1,16 +0,0 @@ -# typed: strong - -module OpenAI - module Resources - class Realtime - class Translations - class Calls - # @api private - sig { params(client: OpenAI::Client).returns(T.attached_class) } - def self.new(client:) - end - end - end - end - end -end diff --git a/rbi/openai/resources/realtime/translations/client_secrets.rbi b/rbi/openai/resources/realtime/translations/client_secrets.rbi deleted file mode 100644 index 6d956161..00000000 --- a/rbi/openai/resources/realtime/translations/client_secrets.rbi +++ /dev/null @@ -1,16 +0,0 @@ -# typed: strong - -module OpenAI - module Resources - class Realtime - class Translations - class ClientSecrets - # @api private - sig { params(client: OpenAI::Client).returns(T.attached_class) } - def self.new(client:) - end - end - end - end - end -end diff --git a/scripts/detect-breaking-changes b/scripts/detect-breaking-changes index d3c5400a..f3f79fd3 100755 --- a/scripts/detect-breaking-changes +++ b/scripts/detect-breaking-changes @@ -76,9 +76,6 @@ TEST_PATHS=( test/openai/resources/realtime_test.rb test/openai/resources/realtime/client_secrets_test.rb test/openai/resources/realtime/calls_test.rb - test/openai/resources/realtime/translations_test.rb - test/openai/resources/realtime/translations/client_secrets_test.rb - test/openai/resources/realtime/translations/calls_test.rb test/openai/resources/conversations_test.rb test/openai/resources/conversations/items_test.rb test/openai/resources/evals_test.rb diff --git a/sig/openai/models/image_edit_params.rbs b/sig/openai/models/image_edit_params.rbs index 66f4812f..0b789808 100644 --- a/sig/openai/models/image_edit_params.rbs +++ b/sig/openai/models/image_edit_params.rbs @@ -14,7 +14,7 @@ module OpenAI partial_images: Integer?, quality: OpenAI::Models::ImageEditParams::quality?, response_format: OpenAI::Models::ImageEditParams::response_format?, - size: OpenAI::Models::ImageEditParams::size?, + size: String?, user: String } & OpenAI::Internal::Type::request_parameters @@ -49,7 +49,7 @@ module OpenAI attr_accessor response_format: OpenAI::Models::ImageEditParams::response_format? - attr_accessor size: OpenAI::Models::ImageEditParams::size? + attr_accessor size: String? attr_reader user: String? @@ -68,7 +68,7 @@ module OpenAI ?partial_images: Integer?, ?quality: OpenAI::Models::ImageEditParams::quality?, ?response_format: OpenAI::Models::ImageEditParams::response_format?, - ?size: OpenAI::Models::ImageEditParams::size?, + ?size: String?, ?user: String, ?request_options: OpenAI::request_opts ) -> void @@ -86,7 +86,7 @@ module OpenAI partial_images: Integer?, quality: OpenAI::Models::ImageEditParams::quality?, response_format: OpenAI::Models::ImageEditParams::response_format?, - size: OpenAI::Models::ImageEditParams::size?, + size: String?, user: String, request_options: OpenAI::RequestOptions } @@ -169,27 +169,6 @@ module OpenAI def self?.values: -> ::Array[OpenAI::Models::ImageEditParams::response_format] end - - type size = - :"256x256" - | :"512x512" - | :"1024x1024" - | :"1536x1024" - | :"1024x1536" - | :auto - - module Size - extend OpenAI::Internal::Type::Enum - - SIZE_256X256: :"256x256" - SIZE_512X512: :"512x512" - SIZE_1024X1024: :"1024x1024" - SIZE_1536X1024: :"1536x1024" - SIZE_1024X1536: :"1024x1536" - AUTO: :auto - - def self?.values: -> ::Array[OpenAI::Models::ImageEditParams::size] - end end end end diff --git a/sig/openai/models/image_generate_params.rbs b/sig/openai/models/image_generate_params.rbs index e870a248..8208f7c9 100644 --- a/sig/openai/models/image_generate_params.rbs +++ b/sig/openai/models/image_generate_params.rbs @@ -12,7 +12,7 @@ module OpenAI partial_images: Integer?, quality: OpenAI::Models::ImageGenerateParams::quality?, response_format: OpenAI::Models::ImageGenerateParams::response_format?, - size: OpenAI::Models::ImageGenerateParams::size?, + size: String?, style: OpenAI::Models::ImageGenerateParams::style?, user: String } @@ -42,7 +42,7 @@ module OpenAI attr_accessor response_format: OpenAI::Models::ImageGenerateParams::response_format? - attr_accessor size: OpenAI::Models::ImageGenerateParams::size? + attr_accessor size: String? attr_accessor style: OpenAI::Models::ImageGenerateParams::style? @@ -61,7 +61,7 @@ module OpenAI ?partial_images: Integer?, ?quality: OpenAI::Models::ImageGenerateParams::quality?, ?response_format: OpenAI::Models::ImageGenerateParams::response_format?, - ?size: OpenAI::Models::ImageGenerateParams::size?, + ?size: String?, ?style: OpenAI::Models::ImageGenerateParams::style?, ?user: String, ?request_options: OpenAI::request_opts @@ -78,7 +78,7 @@ module OpenAI partial_images: Integer?, quality: OpenAI::Models::ImageGenerateParams::quality?, response_format: OpenAI::Models::ImageGenerateParams::response_format?, - size: OpenAI::Models::ImageGenerateParams::size?, + size: String?, style: OpenAI::Models::ImageGenerateParams::style?, user: String, request_options: OpenAI::RequestOptions @@ -153,31 +153,6 @@ module OpenAI def self?.values: -> ::Array[OpenAI::Models::ImageGenerateParams::response_format] end - type size = - :auto - | :"1024x1024" - | :"1536x1024" - | :"1024x1536" - | :"256x256" - | :"512x512" - | :"1792x1024" - | :"1024x1792" - - module Size - extend OpenAI::Internal::Type::Enum - - AUTO: :auto - SIZE_1024X1024: :"1024x1024" - SIZE_1536X1024: :"1536x1024" - SIZE_1024X1536: :"1024x1536" - SIZE_256X256: :"256x256" - SIZE_512X512: :"512x512" - SIZE_1792X1024: :"1792x1024" - SIZE_1024X1792: :"1024x1792" - - def self?.values: -> ::Array[OpenAI::Models::ImageGenerateParams::size] - end - type style = :vivid | :natural module Style diff --git a/sig/openai/models/responses/tool.rbs b/sig/openai/models/responses/tool.rbs index b5733a90..f17e752d 100644 --- a/sig/openai/models/responses/tool.rbs +++ b/sig/openai/models/responses/tool.rbs @@ -347,7 +347,7 @@ module OpenAI output_format: OpenAI::Models::Responses::Tool::ImageGeneration::output_format, partial_images: Integer, quality: OpenAI::Models::Responses::Tool::ImageGeneration::quality, - size: OpenAI::Models::Responses::Tool::ImageGeneration::size + size: String } class ImageGeneration < OpenAI::Internal::Type::BaseModel @@ -405,11 +405,9 @@ module OpenAI OpenAI::Models::Responses::Tool::ImageGeneration::quality ) -> OpenAI::Models::Responses::Tool::ImageGeneration::quality - attr_reader size: OpenAI::Models::Responses::Tool::ImageGeneration::size? + attr_reader size: String? - def size=: ( - OpenAI::Models::Responses::Tool::ImageGeneration::size - ) -> OpenAI::Models::Responses::Tool::ImageGeneration::size + def size=: (String) -> String def initialize: ( ?action: OpenAI::Models::Responses::Tool::ImageGeneration::action, @@ -422,7 +420,7 @@ module OpenAI ?output_format: OpenAI::Models::Responses::Tool::ImageGeneration::output_format, ?partial_images: Integer, ?quality: OpenAI::Models::Responses::Tool::ImageGeneration::quality, - ?size: OpenAI::Models::Responses::Tool::ImageGeneration::size, + ?size: String, ?type: :image_generation ) -> void @@ -438,7 +436,7 @@ module OpenAI output_format: OpenAI::Models::Responses::Tool::ImageGeneration::output_format, partial_images: Integer, quality: OpenAI::Models::Responses::Tool::ImageGeneration::quality, - size: OpenAI::Models::Responses::Tool::ImageGeneration::size + size: String } type action = :generate | :edit | :auto @@ -549,19 +547,6 @@ module OpenAI def self?.values: -> ::Array[OpenAI::Models::Responses::Tool::ImageGeneration::quality] end - - type size = :"1024x1024" | :"1024x1536" | :"1536x1024" | :auto - - module Size - extend OpenAI::Internal::Type::Enum - - SIZE_1024X1024: :"1024x1024" - SIZE_1024X1536: :"1024x1536" - SIZE_1536X1024: :"1536x1024" - AUTO: :auto - - def self?.values: -> ::Array[OpenAI::Models::Responses::Tool::ImageGeneration::size] - end end type local_shell = { type: :local_shell } diff --git a/sig/openai/resources/images.rbs b/sig/openai/resources/images.rbs index bd5dfbcf..6ee6a4a0 100644 --- a/sig/openai/resources/images.rbs +++ b/sig/openai/resources/images.rbs @@ -24,7 +24,7 @@ module OpenAI ?partial_images: Integer?, ?quality: OpenAI::Models::ImageEditParams::quality?, ?response_format: OpenAI::Models::ImageEditParams::response_format?, - ?size: OpenAI::Models::ImageEditParams::size?, + ?size: String?, ?user: String, ?request_options: OpenAI::request_opts ) -> OpenAI::ImagesResponse @@ -42,7 +42,7 @@ module OpenAI ?partial_images: Integer?, ?quality: OpenAI::Models::ImageEditParams::quality?, ?response_format: OpenAI::Models::ImageEditParams::response_format?, - ?size: OpenAI::Models::ImageEditParams::size?, + ?size: String?, ?user: String, ?request_options: OpenAI::request_opts ) -> OpenAI::Internal::Stream[OpenAI::Models::image_edit_stream_event] @@ -58,7 +58,7 @@ module OpenAI ?partial_images: Integer?, ?quality: OpenAI::Models::ImageGenerateParams::quality?, ?response_format: OpenAI::Models::ImageGenerateParams::response_format?, - ?size: OpenAI::Models::ImageGenerateParams::size?, + ?size: String?, ?style: OpenAI::Models::ImageGenerateParams::style?, ?user: String, ?request_options: OpenAI::request_opts @@ -75,7 +75,7 @@ module OpenAI ?partial_images: Integer?, ?quality: OpenAI::Models::ImageGenerateParams::quality?, ?response_format: OpenAI::Models::ImageGenerateParams::response_format?, - ?size: OpenAI::Models::ImageGenerateParams::size?, + ?size: String?, ?style: OpenAI::Models::ImageGenerateParams::style?, ?user: String, ?request_options: OpenAI::request_opts diff --git a/sig/openai/resources/realtime.rbs b/sig/openai/resources/realtime.rbs index a7eabd87..999debec 100644 --- a/sig/openai/resources/realtime.rbs +++ b/sig/openai/resources/realtime.rbs @@ -5,8 +5,6 @@ module OpenAI attr_reader calls: OpenAI::Resources::Realtime::Calls - attr_reader translations: OpenAI::Resources::Realtime::Translations - def initialize: (client: OpenAI::Client) -> void end end diff --git a/sig/openai/resources/realtime/translations.rbs b/sig/openai/resources/realtime/translations.rbs deleted file mode 100644 index 20a256cc..00000000 --- a/sig/openai/resources/realtime/translations.rbs +++ /dev/null @@ -1,13 +0,0 @@ -module OpenAI - module Resources - class Realtime - class Translations - attr_reader client_secrets: OpenAI::Resources::Realtime::Translations::ClientSecrets - - attr_reader calls: OpenAI::Resources::Realtime::Translations::Calls - - def initialize: (client: OpenAI::Client) -> void - end - end - end -end diff --git a/sig/openai/resources/realtime/translations/calls.rbs b/sig/openai/resources/realtime/translations/calls.rbs deleted file mode 100644 index 1476aae9..00000000 --- a/sig/openai/resources/realtime/translations/calls.rbs +++ /dev/null @@ -1,11 +0,0 @@ -module OpenAI - module Resources - class Realtime - class Translations - class Calls - def initialize: (client: OpenAI::Client) -> void - end - end - end - end -end diff --git a/sig/openai/resources/realtime/translations/client_secrets.rbs b/sig/openai/resources/realtime/translations/client_secrets.rbs deleted file mode 100644 index 501f5958..00000000 --- a/sig/openai/resources/realtime/translations/client_secrets.rbs +++ /dev/null @@ -1,11 +0,0 @@ -module OpenAI - module Resources - class Realtime - class Translations - class ClientSecrets - def initialize: (client: OpenAI::Client) -> void - end - end - end - end -end diff --git a/test/openai/resource_namespaces.rb b/test/openai/resource_namespaces.rb index e49d771f..049d6f36 100644 --- a/test/openai/resource_namespaces.rb +++ b/test/openai/resource_namespaces.rb @@ -112,8 +112,6 @@ module Users end module Realtime - module Translations - end end module Responses @@ -132,9 +130,6 @@ module Runs end end - module Translations - end - module Uploads end diff --git a/test/openai/resources/realtime/translations/calls_test.rb b/test/openai/resources/realtime/translations/calls_test.rb deleted file mode 100644 index 77b4f354..00000000 --- a/test/openai/resources/realtime/translations/calls_test.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -require_relative "../../../test_helper" - -class OpenAI::Test::Resources::Realtime::Translations::CallsTest < OpenAI::Test::ResourceTest -end diff --git a/test/openai/resources/realtime/translations/client_secrets_test.rb b/test/openai/resources/realtime/translations/client_secrets_test.rb deleted file mode 100644 index 8c5dacba..00000000 --- a/test/openai/resources/realtime/translations/client_secrets_test.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -require_relative "../../../test_helper" - -class OpenAI::Test::Resources::Realtime::Translations::ClientSecretsTest < OpenAI::Test::ResourceTest -end diff --git a/test/openai/resources/realtime/translations_test.rb b/test/openai/resources/realtime/translations_test.rb deleted file mode 100644 index acee1899..00000000 --- a/test/openai/resources/realtime/translations_test.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -require_relative "../../test_helper" - -class OpenAI::Test::Resources::Realtime::TranslationsTest < OpenAI::Test::ResourceTest -end From 2085700725c2325e880a715ce3b13b4efce7b5d4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 May 2026 08:58:14 +0000 Subject: [PATCH 08/16] feat(api): add quantity field to organization usage costs results --- .stats.yml | 4 ++-- .../organization/usage_audio_speeches_response.rb | 11 ++++++++++- .../usage_audio_transcriptions_response.rb | 11 ++++++++++- .../usage_code_interpreter_sessions_response.rb | 11 ++++++++++- .../admin/organization/usage_completions_response.rb | 11 ++++++++++- .../admin/organization/usage_costs_response.rb | 11 ++++++++++- .../admin/organization/usage_embeddings_response.rb | 11 ++++++++++- .../admin/organization/usage_images_response.rb | 11 ++++++++++- .../admin/organization/usage_moderations_response.rb | 11 ++++++++++- .../organization/usage_vector_stores_response.rb | 11 ++++++++++- .../models/chat/chat_completion_token_logprob.rb | 3 +-- lib/openai/models/chat/completion_create_params.rb | 7 ++++--- lib/openai/models/responses/response.rb | 7 ++++--- .../models/responses/response_create_params.rb | 7 ++++--- .../models/responses/response_text_delta_event.rb | 4 ++-- .../models/responses/response_text_done_event.rb | 4 ++-- .../models/responses/responses_client_event.rb | 7 ++++--- lib/openai/resources/chat/completions.rb | 4 ++-- lib/openai/resources/responses.rb | 4 ++-- .../organization/usage_audio_speeches_response.rbi | 12 +++++++++++- .../usage_audio_transcriptions_response.rbi | 12 +++++++++++- .../usage_code_interpreter_sessions_response.rbi | 12 +++++++++++- .../organization/usage_completions_response.rbi | 12 +++++++++++- .../admin/organization/usage_costs_response.rbi | 12 +++++++++++- .../admin/organization/usage_embeddings_response.rbi | 12 +++++++++++- .../admin/organization/usage_images_response.rbi | 12 +++++++++++- .../organization/usage_moderations_response.rbi | 12 +++++++++++- .../organization/usage_vector_stores_response.rbi | 12 +++++++++++- .../models/chat/chat_completion_token_logprob.rbi | 6 ++---- rbi/openai/models/chat/completion_create_params.rbi | 10 ++++++---- rbi/openai/models/responses/response.rbi | 10 ++++++---- .../models/responses/response_create_params.rbi | 10 ++++++---- .../models/responses/response_text_delta_event.rbi | 4 ++-- .../models/responses/response_text_done_event.rbi | 4 ++-- .../models/responses/responses_client_event.rbi | 10 ++++++---- rbi/openai/resources/chat/completions.rbi | 10 ++++++---- rbi/openai/resources/responses.rbi | 10 ++++++---- .../organization/usage_audio_speeches_response.rbs | 9 +++++++-- .../usage_audio_transcriptions_response.rbs | 9 +++++++-- .../usage_code_interpreter_sessions_response.rbs | 9 +++++++-- .../organization/usage_completions_response.rbs | 9 +++++++-- .../admin/organization/usage_costs_response.rbs | 9 +++++++-- .../admin/organization/usage_embeddings_response.rbs | 9 +++++++-- .../admin/organization/usage_images_response.rbs | 9 +++++++-- .../organization/usage_moderations_response.rbs | 9 +++++++-- .../organization/usage_vector_stores_response.rbs | 9 +++++++-- 46 files changed, 321 insertions(+), 92 deletions(-) diff --git a/.stats.yml b/.stats.yml index aeb20505..3ffa289b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 232 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-5002c7ce1688cf372f6c268507494c5e6396f38db8d85d79029d949b7bb06fe3.yml -openapi_spec_hash: 92713b0825f6b8760836778e6d27e837 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-578515408e7ee6ac115f3768b358ff2cd4f5699cbfb527fe58b19806e7d1f713.yml +openapi_spec_hash: b2df68d6233a18b475590978f5682c04 config_hash: c6cf65d9b19a16ce4313602a2204d48f diff --git a/lib/openai/models/admin/organization/usage_audio_speeches_response.rb b/lib/openai/models/admin/organization/usage_audio_speeches_response.rb index d60a8208..a4aaf921 100644 --- a/lib/openai/models/admin/organization/usage_audio_speeches_response.rb +++ b/lib/openai/models/admin/organization/usage_audio_speeches_response.rb @@ -684,7 +684,14 @@ class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel # @return [String, nil] optional :project_id, String, nil?: true - # @!method initialize(amount: nil, api_key_id: nil, line_item: nil, project_id: nil, object: :"organization.costs.result") + # @!attribute quantity + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + # + # @return [Float, nil] + optional :quantity, Float, nil?: true + + # @!method initialize(amount: nil, api_key_id: nil, line_item: nil, project_id: nil, quantity: nil, object: :"organization.costs.result") # Some parameter documentations has been truncated, see # {OpenAI::Models::Admin::Organization::UsageAudioSpeechesResponse::Data::Result::OrganizationCostsResult} # for more details. @@ -699,6 +706,8 @@ class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel # # @param project_id [String, nil] When `group_by=project_id`, this field provides the project ID of the grouped co # + # @param quantity [Float, nil] When `group_by=line_item`, this field provides the quantity of the grouped costs + # # @param object [Symbol, :"organization.costs.result"] # @see OpenAI::Models::Admin::Organization::UsageAudioSpeechesResponse::Data::Result::OrganizationCostsResult#amount diff --git a/lib/openai/models/admin/organization/usage_audio_transcriptions_response.rb b/lib/openai/models/admin/organization/usage_audio_transcriptions_response.rb index f546c442..b0835d30 100644 --- a/lib/openai/models/admin/organization/usage_audio_transcriptions_response.rb +++ b/lib/openai/models/admin/organization/usage_audio_transcriptions_response.rb @@ -684,7 +684,14 @@ class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel # @return [String, nil] optional :project_id, String, nil?: true - # @!method initialize(amount: nil, api_key_id: nil, line_item: nil, project_id: nil, object: :"organization.costs.result") + # @!attribute quantity + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + # + # @return [Float, nil] + optional :quantity, Float, nil?: true + + # @!method initialize(amount: nil, api_key_id: nil, line_item: nil, project_id: nil, quantity: nil, object: :"organization.costs.result") # Some parameter documentations has been truncated, see # {OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse::Data::Result::OrganizationCostsResult} # for more details. @@ -699,6 +706,8 @@ class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel # # @param project_id [String, nil] When `group_by=project_id`, this field provides the project ID of the grouped co # + # @param quantity [Float, nil] When `group_by=line_item`, this field provides the quantity of the grouped costs + # # @param object [Symbol, :"organization.costs.result"] # @see OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse::Data::Result::OrganizationCostsResult#amount diff --git a/lib/openai/models/admin/organization/usage_code_interpreter_sessions_response.rb b/lib/openai/models/admin/organization/usage_code_interpreter_sessions_response.rb index a0744fec..d33fe823 100644 --- a/lib/openai/models/admin/organization/usage_code_interpreter_sessions_response.rb +++ b/lib/openai/models/admin/organization/usage_code_interpreter_sessions_response.rb @@ -684,7 +684,14 @@ class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel # @return [String, nil] optional :project_id, String, nil?: true - # @!method initialize(amount: nil, api_key_id: nil, line_item: nil, project_id: nil, object: :"organization.costs.result") + # @!attribute quantity + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + # + # @return [Float, nil] + optional :quantity, Float, nil?: true + + # @!method initialize(amount: nil, api_key_id: nil, line_item: nil, project_id: nil, quantity: nil, object: :"organization.costs.result") # Some parameter documentations has been truncated, see # {OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationCostsResult} # for more details. @@ -699,6 +706,8 @@ class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel # # @param project_id [String, nil] When `group_by=project_id`, this field provides the project ID of the grouped co # + # @param quantity [Float, nil] When `group_by=line_item`, this field provides the quantity of the grouped costs + # # @param object [Symbol, :"organization.costs.result"] # @see OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationCostsResult#amount diff --git a/lib/openai/models/admin/organization/usage_completions_response.rb b/lib/openai/models/admin/organization/usage_completions_response.rb index 0954051c..14e931ac 100644 --- a/lib/openai/models/admin/organization/usage_completions_response.rb +++ b/lib/openai/models/admin/organization/usage_completions_response.rb @@ -684,7 +684,14 @@ class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel # @return [String, nil] optional :project_id, String, nil?: true - # @!method initialize(amount: nil, api_key_id: nil, line_item: nil, project_id: nil, object: :"organization.costs.result") + # @!attribute quantity + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + # + # @return [Float, nil] + optional :quantity, Float, nil?: true + + # @!method initialize(amount: nil, api_key_id: nil, line_item: nil, project_id: nil, quantity: nil, object: :"organization.costs.result") # Some parameter documentations has been truncated, see # {OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationCostsResult} # for more details. @@ -699,6 +706,8 @@ class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel # # @param project_id [String, nil] When `group_by=project_id`, this field provides the project ID of the grouped co # + # @param quantity [Float, nil] When `group_by=line_item`, this field provides the quantity of the grouped costs + # # @param object [Symbol, :"organization.costs.result"] # @see OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationCostsResult#amount diff --git a/lib/openai/models/admin/organization/usage_costs_response.rb b/lib/openai/models/admin/organization/usage_costs_response.rb index d29af080..1f138293 100644 --- a/lib/openai/models/admin/organization/usage_costs_response.rb +++ b/lib/openai/models/admin/organization/usage_costs_response.rb @@ -684,7 +684,14 @@ class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel # @return [String, nil] optional :project_id, String, nil?: true - # @!method initialize(amount: nil, api_key_id: nil, line_item: nil, project_id: nil, object: :"organization.costs.result") + # @!attribute quantity + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + # + # @return [Float, nil] + optional :quantity, Float, nil?: true + + # @!method initialize(amount: nil, api_key_id: nil, line_item: nil, project_id: nil, quantity: nil, object: :"organization.costs.result") # Some parameter documentations has been truncated, see # {OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult} # for more details. @@ -699,6 +706,8 @@ class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel # # @param project_id [String, nil] When `group_by=project_id`, this field provides the project ID of the grouped co # + # @param quantity [Float, nil] When `group_by=line_item`, this field provides the quantity of the grouped costs + # # @param object [Symbol, :"organization.costs.result"] # @see OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult#amount diff --git a/lib/openai/models/admin/organization/usage_embeddings_response.rb b/lib/openai/models/admin/organization/usage_embeddings_response.rb index 9405c1b8..3cba762e 100644 --- a/lib/openai/models/admin/organization/usage_embeddings_response.rb +++ b/lib/openai/models/admin/organization/usage_embeddings_response.rb @@ -684,7 +684,14 @@ class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel # @return [String, nil] optional :project_id, String, nil?: true - # @!method initialize(amount: nil, api_key_id: nil, line_item: nil, project_id: nil, object: :"organization.costs.result") + # @!attribute quantity + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + # + # @return [Float, nil] + optional :quantity, Float, nil?: true + + # @!method initialize(amount: nil, api_key_id: nil, line_item: nil, project_id: nil, quantity: nil, object: :"organization.costs.result") # Some parameter documentations has been truncated, see # {OpenAI::Models::Admin::Organization::UsageEmbeddingsResponse::Data::Result::OrganizationCostsResult} # for more details. @@ -699,6 +706,8 @@ class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel # # @param project_id [String, nil] When `group_by=project_id`, this field provides the project ID of the grouped co # + # @param quantity [Float, nil] When `group_by=line_item`, this field provides the quantity of the grouped costs + # # @param object [Symbol, :"organization.costs.result"] # @see OpenAI::Models::Admin::Organization::UsageEmbeddingsResponse::Data::Result::OrganizationCostsResult#amount diff --git a/lib/openai/models/admin/organization/usage_images_response.rb b/lib/openai/models/admin/organization/usage_images_response.rb index 208bb965..3c96923d 100644 --- a/lib/openai/models/admin/organization/usage_images_response.rb +++ b/lib/openai/models/admin/organization/usage_images_response.rb @@ -684,7 +684,14 @@ class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel # @return [String, nil] optional :project_id, String, nil?: true - # @!method initialize(amount: nil, api_key_id: nil, line_item: nil, project_id: nil, object: :"organization.costs.result") + # @!attribute quantity + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + # + # @return [Float, nil] + optional :quantity, Float, nil?: true + + # @!method initialize(amount: nil, api_key_id: nil, line_item: nil, project_id: nil, quantity: nil, object: :"organization.costs.result") # Some parameter documentations has been truncated, see # {OpenAI::Models::Admin::Organization::UsageImagesResponse::Data::Result::OrganizationCostsResult} # for more details. @@ -699,6 +706,8 @@ class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel # # @param project_id [String, nil] When `group_by=project_id`, this field provides the project ID of the grouped co # + # @param quantity [Float, nil] When `group_by=line_item`, this field provides the quantity of the grouped costs + # # @param object [Symbol, :"organization.costs.result"] # @see OpenAI::Models::Admin::Organization::UsageImagesResponse::Data::Result::OrganizationCostsResult#amount diff --git a/lib/openai/models/admin/organization/usage_moderations_response.rb b/lib/openai/models/admin/organization/usage_moderations_response.rb index f82a3c4f..5d4d6402 100644 --- a/lib/openai/models/admin/organization/usage_moderations_response.rb +++ b/lib/openai/models/admin/organization/usage_moderations_response.rb @@ -684,7 +684,14 @@ class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel # @return [String, nil] optional :project_id, String, nil?: true - # @!method initialize(amount: nil, api_key_id: nil, line_item: nil, project_id: nil, object: :"organization.costs.result") + # @!attribute quantity + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + # + # @return [Float, nil] + optional :quantity, Float, nil?: true + + # @!method initialize(amount: nil, api_key_id: nil, line_item: nil, project_id: nil, quantity: nil, object: :"organization.costs.result") # Some parameter documentations has been truncated, see # {OpenAI::Models::Admin::Organization::UsageModerationsResponse::Data::Result::OrganizationCostsResult} # for more details. @@ -699,6 +706,8 @@ class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel # # @param project_id [String, nil] When `group_by=project_id`, this field provides the project ID of the grouped co # + # @param quantity [Float, nil] When `group_by=line_item`, this field provides the quantity of the grouped costs + # # @param object [Symbol, :"organization.costs.result"] # @see OpenAI::Models::Admin::Organization::UsageModerationsResponse::Data::Result::OrganizationCostsResult#amount diff --git a/lib/openai/models/admin/organization/usage_vector_stores_response.rb b/lib/openai/models/admin/organization/usage_vector_stores_response.rb index 745345b2..7c8673bd 100644 --- a/lib/openai/models/admin/organization/usage_vector_stores_response.rb +++ b/lib/openai/models/admin/organization/usage_vector_stores_response.rb @@ -684,7 +684,14 @@ class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel # @return [String, nil] optional :project_id, String, nil?: true - # @!method initialize(amount: nil, api_key_id: nil, line_item: nil, project_id: nil, object: :"organization.costs.result") + # @!attribute quantity + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + # + # @return [Float, nil] + optional :quantity, Float, nil?: true + + # @!method initialize(amount: nil, api_key_id: nil, line_item: nil, project_id: nil, quantity: nil, object: :"organization.costs.result") # Some parameter documentations has been truncated, see # {OpenAI::Models::Admin::Organization::UsageVectorStoresResponse::Data::Result::OrganizationCostsResult} # for more details. @@ -699,6 +706,8 @@ class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel # # @param project_id [String, nil] When `group_by=project_id`, this field provides the project ID of the grouped co # + # @param quantity [Float, nil] When `group_by=line_item`, this field provides the quantity of the grouped costs + # # @param object [Symbol, :"organization.costs.result"] # @see OpenAI::Models::Admin::Organization::UsageVectorStoresResponse::Data::Result::OrganizationCostsResult#amount diff --git a/lib/openai/models/chat/chat_completion_token_logprob.rb b/lib/openai/models/chat/chat_completion_token_logprob.rb index 7a09b7c2..72d78fdb 100644 --- a/lib/openai/models/chat/chat_completion_token_logprob.rb +++ b/lib/openai/models/chat/chat_completion_token_logprob.rb @@ -29,8 +29,7 @@ class ChatCompletionTokenLogprob < OpenAI::Internal::Type::BaseModel # @!attribute top_logprobs # List of the most likely tokens and their log probability, at this token - # position. In rare cases, there may be fewer than the number of requested - # `top_logprobs` returned. + # position. The number of entries may be fewer than the requested `top_logprobs`. # # @return [Array] required :top_logprobs, diff --git a/lib/openai/models/chat/completion_create_params.rb b/lib/openai/models/chat/completion_create_params.rb index b3366868..63a89099 100644 --- a/lib/openai/models/chat/completion_create_params.rb +++ b/lib/openai/models/chat/completion_create_params.rb @@ -340,8 +340,9 @@ class CompletionCreateParams < OpenAI::Internal::Type::BaseModel } # @!attribute top_logprobs - # An integer between 0 and 20 specifying the number of most likely tokens to - # return at each token position, each with an associated log probability. + # An integer between 0 and 20 specifying the maximum number of most likely tokens + # to return at each token position, each with an associated log probability. In + # some cases, the number of returned tokens may be fewer than requested. # `logprobs` must be set to `true` if this parameter is used. # # @return [Integer, nil] @@ -447,7 +448,7 @@ class CompletionCreateParams < OpenAI::Internal::Type::BaseModel # # @param tools [Array] A list of tools the model may call. You can provide either # - # @param top_logprobs [Integer, nil] An integer between 0 and 20 specifying the number of most likely tokens to + # @param top_logprobs [Integer, nil] An integer between 0 and 20 specifying the maximum number of most likely # # @param top_p [Float, nil] An alternative to sampling with temperature, called nucleus sampling, # diff --git a/lib/openai/models/responses/response.rb b/lib/openai/models/responses/response.rb index 8feb582e..6405eba4 100644 --- a/lib/openai/models/responses/response.rb +++ b/lib/openai/models/responses/response.rb @@ -269,8 +269,9 @@ class Response < OpenAI::Internal::Type::BaseModel optional :text, -> { OpenAI::Responses::ResponseTextConfig } # @!attribute top_logprobs - # An integer between 0 and 20 specifying the number of most likely tokens to - # return at each token position, each with an associated log probability. + # An integer between 0 and 20 specifying the maximum number of most likely tokens + # to return at each token position, each with an associated log probability. In + # some cases, the number of returned tokens may be fewer than requested. # # @return [Integer, nil] optional :top_logprobs, Integer, nil?: true @@ -384,7 +385,7 @@ def output_text # # @param text [OpenAI::Models::Responses::ResponseTextConfig] Configuration options for a text response from the model. Can be plain # - # @param top_logprobs [Integer, nil] An integer between 0 and 20 specifying the number of most likely tokens to + # @param top_logprobs [Integer, nil] An integer between 0 and 20 specifying the maximum number of most likely # # @param truncation [Symbol, OpenAI::Models::Responses::Response::Truncation, nil] The truncation strategy to use for the model response. # diff --git a/lib/openai/models/responses/response_create_params.rb b/lib/openai/models/responses/response_create_params.rb index 3072d2f0..91491a26 100644 --- a/lib/openai/models/responses/response_create_params.rb +++ b/lib/openai/models/responses/response_create_params.rb @@ -279,8 +279,9 @@ class ResponseCreateParams < OpenAI::Internal::Type::BaseModel optional :tools, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Responses::Tool] } # @!attribute top_logprobs - # An integer between 0 and 20 specifying the number of most likely tokens to - # return at each token position, each with an associated log probability. + # An integer between 0 and 20 specifying the maximum number of most likely tokens + # to return at each token position, each with an associated log probability. In + # some cases, the number of returned tokens may be fewer than requested. # # @return [Integer, nil] optional :top_logprobs, Integer, nil?: true @@ -371,7 +372,7 @@ class ResponseCreateParams < OpenAI::Internal::Type::BaseModel # # @param tools [Array] An array of tools the model may call while generating a response. You # - # @param top_logprobs [Integer, nil] An integer between 0 and 20 specifying the number of most likely tokens to + # @param top_logprobs [Integer, nil] An integer between 0 and 20 specifying the maximum number of most likely # # @param top_p [Float, nil] An alternative to sampling with temperature, called nucleus sampling, # diff --git a/lib/openai/models/responses/response_text_delta_event.rb b/lib/openai/models/responses/response_text_delta_event.rb index 9701d97c..7339d060 100644 --- a/lib/openai/models/responses/response_text_delta_event.rb +++ b/lib/openai/models/responses/response_text_delta_event.rb @@ -81,7 +81,7 @@ class Logprob < OpenAI::Internal::Type::BaseModel required :logprob, Float # @!attribute top_logprobs - # The log probability of the top 20 most likely tokens. + # The log probabilities of up to 20 of the most likely tokens. # # @return [Array, nil] optional :top_logprobs, @@ -99,7 +99,7 @@ class Logprob < OpenAI::Internal::Type::BaseModel # # @param logprob [Float] The log probability of this token. # - # @param top_logprobs [Array] The log probability of the top 20 most likely tokens. + # @param top_logprobs [Array] The log probabilities of up to 20 of the most likely tokens. class TopLogprob < OpenAI::Internal::Type::BaseModel # @!attribute token diff --git a/lib/openai/models/responses/response_text_done_event.rb b/lib/openai/models/responses/response_text_done_event.rb index 77110a2a..9f7cd3be 100644 --- a/lib/openai/models/responses/response_text_done_event.rb +++ b/lib/openai/models/responses/response_text_done_event.rb @@ -81,7 +81,7 @@ class Logprob < OpenAI::Internal::Type::BaseModel required :logprob, Float # @!attribute top_logprobs - # The log probability of the top 20 most likely tokens. + # The log probabilities of up to 20 of the most likely tokens. # # @return [Array, nil] optional :top_logprobs, @@ -99,7 +99,7 @@ class Logprob < OpenAI::Internal::Type::BaseModel # # @param logprob [Float] The log probability of this token. # - # @param top_logprobs [Array] The log probability of the top 20 most likely tokens. + # @param top_logprobs [Array] The log probabilities of up to 20 of the most likely tokens. class TopLogprob < OpenAI::Internal::Type::BaseModel # @!attribute token diff --git a/lib/openai/models/responses/responses_client_event.rb b/lib/openai/models/responses/responses_client_event.rb index 3638b0e7..694eaac6 100644 --- a/lib/openai/models/responses/responses_client_event.rb +++ b/lib/openai/models/responses/responses_client_event.rb @@ -284,8 +284,9 @@ class ResponsesClientEvent < OpenAI::Internal::Type::BaseModel optional :tools, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Responses::Tool] } # @!attribute top_logprobs - # An integer between 0 and 20 specifying the number of most likely tokens to - # return at each token position, each with an associated log probability. + # An integer between 0 and 20 specifying the maximum number of most likely tokens + # to return at each token position, each with an associated log probability. In + # some cases, the number of returned tokens may be fewer than requested. # # @return [Integer, nil] optional :top_logprobs, Integer, nil?: true @@ -378,7 +379,7 @@ class ResponsesClientEvent < OpenAI::Internal::Type::BaseModel # # @param tools [Array] An array of tools the model may call while generating a response. You # - # @param top_logprobs [Integer, nil] An integer between 0 and 20 specifying the number of most likely tokens to + # @param top_logprobs [Integer, nil] An integer between 0 and 20 specifying the maximum number of most likely # # @param top_p [Float, nil] An alternative to sampling with temperature, called nucleus sampling, # diff --git a/lib/openai/resources/chat/completions.rb b/lib/openai/resources/chat/completions.rb index 89c5b7e6..a2c3b924 100644 --- a/lib/openai/resources/chat/completions.rb +++ b/lib/openai/resources/chat/completions.rb @@ -97,7 +97,7 @@ class Completions # # @param tools [Array] A list of tools the model may call. You can provide either # - # @param top_logprobs [Integer, nil] An integer between 0 and 20 specifying the number of most likely tokens to + # @param top_logprobs [Integer, nil] An integer between 0 and 20 specifying the maximum number of most likely # # @param top_p [Float, nil] An alternative to sampling with temperature, called nucleus sampling, # @@ -349,7 +349,7 @@ def stream(params) # # @param tools [Array] A list of tools the model may call. You can provide either # - # @param top_logprobs [Integer, nil] An integer between 0 and 20 specifying the number of most likely tokens to + # @param top_logprobs [Integer, nil] An integer between 0 and 20 specifying the maximum number of most likely # # @param top_p [Float, nil] An alternative to sampling with temperature, called nucleus sampling, # diff --git a/lib/openai/resources/responses.rb b/lib/openai/resources/responses.rb index a31a78a0..cd4e73e8 100644 --- a/lib/openai/resources/responses.rb +++ b/lib/openai/resources/responses.rb @@ -76,7 +76,7 @@ class Responses # # @param tools [Array] An array of tools the model may call while generating a response. You # - # @param top_logprobs [Integer, nil] An integer between 0 and 20 specifying the number of most likely tokens to + # @param top_logprobs [Integer, nil] An integer between 0 and 20 specifying the maximum number of most likely # # @param top_p [Float, nil] An alternative to sampling with temperature, called nucleus sampling, # @@ -299,7 +299,7 @@ def stream(params) # # @param tools [Array] An array of tools the model may call while generating a response. You # - # @param top_logprobs [Integer, nil] An integer between 0 and 20 specifying the number of most likely tokens to + # @param top_logprobs [Integer, nil] An integer between 0 and 20 specifying the maximum number of most likely # # @param top_p [Float, nil] An alternative to sampling with temperature, called nucleus sampling, # diff --git a/rbi/openai/models/admin/organization/usage_audio_speeches_response.rbi b/rbi/openai/models/admin/organization/usage_audio_speeches_response.rbi index ef1b7e94..15e388cf 100644 --- a/rbi/openai/models/admin/organization/usage_audio_speeches_response.rbi +++ b/rbi/openai/models/admin/organization/usage_audio_speeches_response.rbi @@ -926,6 +926,11 @@ module OpenAI sig { returns(T.nilable(String)) } attr_accessor :project_id + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + sig { returns(T.nilable(Float)) } + attr_accessor :quantity + # The aggregated costs details of the specific time bucket. sig do params( @@ -934,6 +939,7 @@ module OpenAI api_key_id: T.nilable(String), line_item: T.nilable(String), project_id: T.nilable(String), + quantity: T.nilable(Float), object: Symbol ).returns(T.attached_class) end @@ -949,6 +955,9 @@ module OpenAI # When `group_by=project_id`, this field provides the project ID of the grouped # costs result. project_id: nil, + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + quantity: nil, object: :"organization.costs.result" ) end @@ -961,7 +970,8 @@ module OpenAI OpenAI::Models::Admin::Organization::UsageAudioSpeechesResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: T.nilable(String), line_item: T.nilable(String), - project_id: T.nilable(String) + project_id: T.nilable(String), + quantity: T.nilable(Float) } ) end diff --git a/rbi/openai/models/admin/organization/usage_audio_transcriptions_response.rbi b/rbi/openai/models/admin/organization/usage_audio_transcriptions_response.rbi index 232ae911..a8ac3e5c 100644 --- a/rbi/openai/models/admin/organization/usage_audio_transcriptions_response.rbi +++ b/rbi/openai/models/admin/organization/usage_audio_transcriptions_response.rbi @@ -926,6 +926,11 @@ module OpenAI sig { returns(T.nilable(String)) } attr_accessor :project_id + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + sig { returns(T.nilable(Float)) } + attr_accessor :quantity + # The aggregated costs details of the specific time bucket. sig do params( @@ -934,6 +939,7 @@ module OpenAI api_key_id: T.nilable(String), line_item: T.nilable(String), project_id: T.nilable(String), + quantity: T.nilable(Float), object: Symbol ).returns(T.attached_class) end @@ -949,6 +955,9 @@ module OpenAI # When `group_by=project_id`, this field provides the project ID of the grouped # costs result. project_id: nil, + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + quantity: nil, object: :"organization.costs.result" ) end @@ -961,7 +970,8 @@ module OpenAI OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: T.nilable(String), line_item: T.nilable(String), - project_id: T.nilable(String) + project_id: T.nilable(String), + quantity: T.nilable(Float) } ) end diff --git a/rbi/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbi b/rbi/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbi index 5a91bbc2..396c25f7 100644 --- a/rbi/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbi +++ b/rbi/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbi @@ -926,6 +926,11 @@ module OpenAI sig { returns(T.nilable(String)) } attr_accessor :project_id + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + sig { returns(T.nilable(Float)) } + attr_accessor :quantity + # The aggregated costs details of the specific time bucket. sig do params( @@ -934,6 +939,7 @@ module OpenAI api_key_id: T.nilable(String), line_item: T.nilable(String), project_id: T.nilable(String), + quantity: T.nilable(Float), object: Symbol ).returns(T.attached_class) end @@ -949,6 +955,9 @@ module OpenAI # When `group_by=project_id`, this field provides the project ID of the grouped # costs result. project_id: nil, + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + quantity: nil, object: :"organization.costs.result" ) end @@ -961,7 +970,8 @@ module OpenAI OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: T.nilable(String), line_item: T.nilable(String), - project_id: T.nilable(String) + project_id: T.nilable(String), + quantity: T.nilable(Float) } ) end diff --git a/rbi/openai/models/admin/organization/usage_completions_response.rbi b/rbi/openai/models/admin/organization/usage_completions_response.rbi index d72416da..e7652d5c 100644 --- a/rbi/openai/models/admin/organization/usage_completions_response.rbi +++ b/rbi/openai/models/admin/organization/usage_completions_response.rbi @@ -926,6 +926,11 @@ module OpenAI sig { returns(T.nilable(String)) } attr_accessor :project_id + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + sig { returns(T.nilable(Float)) } + attr_accessor :quantity + # The aggregated costs details of the specific time bucket. sig do params( @@ -934,6 +939,7 @@ module OpenAI api_key_id: T.nilable(String), line_item: T.nilable(String), project_id: T.nilable(String), + quantity: T.nilable(Float), object: Symbol ).returns(T.attached_class) end @@ -949,6 +955,9 @@ module OpenAI # When `group_by=project_id`, this field provides the project ID of the grouped # costs result. project_id: nil, + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + quantity: nil, object: :"organization.costs.result" ) end @@ -961,7 +970,8 @@ module OpenAI OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: T.nilable(String), line_item: T.nilable(String), - project_id: T.nilable(String) + project_id: T.nilable(String), + quantity: T.nilable(Float) } ) end diff --git a/rbi/openai/models/admin/organization/usage_costs_response.rbi b/rbi/openai/models/admin/organization/usage_costs_response.rbi index 157ee650..888a7544 100644 --- a/rbi/openai/models/admin/organization/usage_costs_response.rbi +++ b/rbi/openai/models/admin/organization/usage_costs_response.rbi @@ -926,6 +926,11 @@ module OpenAI sig { returns(T.nilable(String)) } attr_accessor :project_id + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + sig { returns(T.nilable(Float)) } + attr_accessor :quantity + # The aggregated costs details of the specific time bucket. sig do params( @@ -934,6 +939,7 @@ module OpenAI api_key_id: T.nilable(String), line_item: T.nilable(String), project_id: T.nilable(String), + quantity: T.nilable(Float), object: Symbol ).returns(T.attached_class) end @@ -949,6 +955,9 @@ module OpenAI # When `group_by=project_id`, this field provides the project ID of the grouped # costs result. project_id: nil, + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + quantity: nil, object: :"organization.costs.result" ) end @@ -961,7 +970,8 @@ module OpenAI OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: T.nilable(String), line_item: T.nilable(String), - project_id: T.nilable(String) + project_id: T.nilable(String), + quantity: T.nilable(Float) } ) end diff --git a/rbi/openai/models/admin/organization/usage_embeddings_response.rbi b/rbi/openai/models/admin/organization/usage_embeddings_response.rbi index 11eec65b..ef530064 100644 --- a/rbi/openai/models/admin/organization/usage_embeddings_response.rbi +++ b/rbi/openai/models/admin/organization/usage_embeddings_response.rbi @@ -926,6 +926,11 @@ module OpenAI sig { returns(T.nilable(String)) } attr_accessor :project_id + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + sig { returns(T.nilable(Float)) } + attr_accessor :quantity + # The aggregated costs details of the specific time bucket. sig do params( @@ -934,6 +939,7 @@ module OpenAI api_key_id: T.nilable(String), line_item: T.nilable(String), project_id: T.nilable(String), + quantity: T.nilable(Float), object: Symbol ).returns(T.attached_class) end @@ -949,6 +955,9 @@ module OpenAI # When `group_by=project_id`, this field provides the project ID of the grouped # costs result. project_id: nil, + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + quantity: nil, object: :"organization.costs.result" ) end @@ -961,7 +970,8 @@ module OpenAI OpenAI::Models::Admin::Organization::UsageEmbeddingsResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: T.nilable(String), line_item: T.nilable(String), - project_id: T.nilable(String) + project_id: T.nilable(String), + quantity: T.nilable(Float) } ) end diff --git a/rbi/openai/models/admin/organization/usage_images_response.rbi b/rbi/openai/models/admin/organization/usage_images_response.rbi index 343787e3..3576b15a 100644 --- a/rbi/openai/models/admin/organization/usage_images_response.rbi +++ b/rbi/openai/models/admin/organization/usage_images_response.rbi @@ -926,6 +926,11 @@ module OpenAI sig { returns(T.nilable(String)) } attr_accessor :project_id + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + sig { returns(T.nilable(Float)) } + attr_accessor :quantity + # The aggregated costs details of the specific time bucket. sig do params( @@ -934,6 +939,7 @@ module OpenAI api_key_id: T.nilable(String), line_item: T.nilable(String), project_id: T.nilable(String), + quantity: T.nilable(Float), object: Symbol ).returns(T.attached_class) end @@ -949,6 +955,9 @@ module OpenAI # When `group_by=project_id`, this field provides the project ID of the grouped # costs result. project_id: nil, + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + quantity: nil, object: :"organization.costs.result" ) end @@ -961,7 +970,8 @@ module OpenAI OpenAI::Models::Admin::Organization::UsageImagesResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: T.nilable(String), line_item: T.nilable(String), - project_id: T.nilable(String) + project_id: T.nilable(String), + quantity: T.nilable(Float) } ) end diff --git a/rbi/openai/models/admin/organization/usage_moderations_response.rbi b/rbi/openai/models/admin/organization/usage_moderations_response.rbi index 2058983a..02c9a5cc 100644 --- a/rbi/openai/models/admin/organization/usage_moderations_response.rbi +++ b/rbi/openai/models/admin/organization/usage_moderations_response.rbi @@ -926,6 +926,11 @@ module OpenAI sig { returns(T.nilable(String)) } attr_accessor :project_id + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + sig { returns(T.nilable(Float)) } + attr_accessor :quantity + # The aggregated costs details of the specific time bucket. sig do params( @@ -934,6 +939,7 @@ module OpenAI api_key_id: T.nilable(String), line_item: T.nilable(String), project_id: T.nilable(String), + quantity: T.nilable(Float), object: Symbol ).returns(T.attached_class) end @@ -949,6 +955,9 @@ module OpenAI # When `group_by=project_id`, this field provides the project ID of the grouped # costs result. project_id: nil, + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + quantity: nil, object: :"organization.costs.result" ) end @@ -961,7 +970,8 @@ module OpenAI OpenAI::Models::Admin::Organization::UsageModerationsResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: T.nilable(String), line_item: T.nilable(String), - project_id: T.nilable(String) + project_id: T.nilable(String), + quantity: T.nilable(Float) } ) end diff --git a/rbi/openai/models/admin/organization/usage_vector_stores_response.rbi b/rbi/openai/models/admin/organization/usage_vector_stores_response.rbi index d8f319f4..7aa40b0d 100644 --- a/rbi/openai/models/admin/organization/usage_vector_stores_response.rbi +++ b/rbi/openai/models/admin/organization/usage_vector_stores_response.rbi @@ -926,6 +926,11 @@ module OpenAI sig { returns(T.nilable(String)) } attr_accessor :project_id + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + sig { returns(T.nilable(Float)) } + attr_accessor :quantity + # The aggregated costs details of the specific time bucket. sig do params( @@ -934,6 +939,7 @@ module OpenAI api_key_id: T.nilable(String), line_item: T.nilable(String), project_id: T.nilable(String), + quantity: T.nilable(Float), object: Symbol ).returns(T.attached_class) end @@ -949,6 +955,9 @@ module OpenAI # When `group_by=project_id`, this field provides the project ID of the grouped # costs result. project_id: nil, + # When `group_by=line_item`, this field provides the quantity of the grouped costs + # result. + quantity: nil, object: :"organization.costs.result" ) end @@ -961,7 +970,8 @@ module OpenAI OpenAI::Models::Admin::Organization::UsageVectorStoresResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: T.nilable(String), line_item: T.nilable(String), - project_id: T.nilable(String) + project_id: T.nilable(String), + quantity: T.nilable(Float) } ) end diff --git a/rbi/openai/models/chat/chat_completion_token_logprob.rbi b/rbi/openai/models/chat/chat_completion_token_logprob.rbi index 0cca0836..c1816f8d 100644 --- a/rbi/openai/models/chat/chat_completion_token_logprob.rbi +++ b/rbi/openai/models/chat/chat_completion_token_logprob.rbi @@ -32,8 +32,7 @@ module OpenAI attr_accessor :logprob # List of the most likely tokens and their log probability, at this token - # position. In rare cases, there may be fewer than the number of requested - # `top_logprobs` returned. + # position. The number of entries may be fewer than the requested `top_logprobs`. sig do returns( T::Array[OpenAI::Chat::ChatCompletionTokenLogprob::TopLogprob] @@ -65,8 +64,7 @@ module OpenAI # unlikely. logprob:, # List of the most likely tokens and their log probability, at this token - # position. In rare cases, there may be fewer than the number of requested - # `top_logprobs` returned. + # position. The number of entries may be fewer than the requested `top_logprobs`. top_logprobs: ) end diff --git a/rbi/openai/models/chat/completion_create_params.rbi b/rbi/openai/models/chat/completion_create_params.rbi index 4763a24f..3aa4a454 100644 --- a/rbi/openai/models/chat/completion_create_params.rbi +++ b/rbi/openai/models/chat/completion_create_params.rbi @@ -441,8 +441,9 @@ module OpenAI end attr_writer :tools - # An integer between 0 and 20 specifying the number of most likely tokens to - # return at each token position, each with an associated log probability. + # An integer between 0 and 20 specifying the maximum number of most likely tokens + # to return at each token position, each with an associated log probability. In + # some cases, the number of returned tokens may be fewer than requested. # `logprobs` must be set to `true` if this parameter is used. sig { returns(T.nilable(Integer)) } attr_accessor :top_logprobs @@ -780,8 +781,9 @@ module OpenAI # [custom tools](https://platform.openai.com/docs/guides/function-calling#custom-tools) # or [function tools](https://platform.openai.com/docs/guides/function-calling). tools: nil, - # An integer between 0 and 20 specifying the number of most likely tokens to - # return at each token position, each with an associated log probability. + # An integer between 0 and 20 specifying the maximum number of most likely tokens + # to return at each token position, each with an associated log probability. In + # some cases, the number of returned tokens may be fewer than requested. # `logprobs` must be set to `true` if this parameter is used. top_logprobs: nil, # An alternative to sampling with temperature, called nucleus sampling, where the diff --git a/rbi/openai/models/responses/response.rbi b/rbi/openai/models/responses/response.rbi index c5ef5613..a235b22a 100644 --- a/rbi/openai/models/responses/response.rbi +++ b/rbi/openai/models/responses/response.rbi @@ -277,8 +277,9 @@ module OpenAI sig { params(text: OpenAI::Responses::ResponseTextConfig::OrHash).void } attr_writer :text - # An integer between 0 and 20 specifying the number of most likely tokens to - # return at each token position, each with an associated log probability. + # An integer between 0 and 20 specifying the maximum number of most likely tokens + # to return at each token position, each with an associated log probability. In + # some cases, the number of returned tokens may be fewer than requested. sig { returns(T.nilable(Integer)) } attr_accessor :top_logprobs @@ -568,8 +569,9 @@ module OpenAI # - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) # - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) text: nil, - # An integer between 0 and 20 specifying the number of most likely tokens to - # return at each token position, each with an associated log probability. + # An integer between 0 and 20 specifying the maximum number of most likely tokens + # to return at each token position, each with an associated log probability. In + # some cases, the number of returned tokens may be fewer than requested. top_logprobs: nil, # The truncation strategy to use for the model response. # diff --git a/rbi/openai/models/responses/response_create_params.rbi b/rbi/openai/models/responses/response_create_params.rbi index f557a5b0..57da74fb 100644 --- a/rbi/openai/models/responses/response_create_params.rbi +++ b/rbi/openai/models/responses/response_create_params.rbi @@ -403,8 +403,9 @@ module OpenAI end attr_writer :tools - # An integer between 0 and 20 specifying the number of most likely tokens to - # return at each token position, each with an associated log probability. + # An integer between 0 and 20 specifying the maximum number of most likely tokens + # to return at each token position, each with an associated log probability. In + # some cases, the number of returned tokens may be fewer than requested. sig { returns(T.nilable(Integer)) } attr_accessor :top_logprobs @@ -691,8 +692,9 @@ module OpenAI # [function calling](https://platform.openai.com/docs/guides/function-calling). # You can also use custom tools to call your own code. tools: nil, - # An integer between 0 and 20 specifying the number of most likely tokens to - # return at each token position, each with an associated log probability. + # An integer between 0 and 20 specifying the maximum number of most likely tokens + # to return at each token position, each with an associated log probability. In + # some cases, the number of returned tokens may be fewer than requested. top_logprobs: nil, # An alternative to sampling with temperature, called nucleus sampling, where the # model considers the results of the tokens with top_p probability mass. So 0.1 diff --git a/rbi/openai/models/responses/response_text_delta_event.rbi b/rbi/openai/models/responses/response_text_delta_event.rbi index bd438476..2a1d9684 100644 --- a/rbi/openai/models/responses/response_text_delta_event.rbi +++ b/rbi/openai/models/responses/response_text_delta_event.rbi @@ -109,7 +109,7 @@ module OpenAI sig { returns(Float) } attr_accessor :logprob - # The log probability of the top 20 most likely tokens. + # The log probabilities of up to 20 of the most likely tokens. sig do returns( T.nilable( @@ -149,7 +149,7 @@ module OpenAI token:, # The log probability of this token. logprob:, - # The log probability of the top 20 most likely tokens. + # The log probabilities of up to 20 of the most likely tokens. top_logprobs: nil ) end diff --git a/rbi/openai/models/responses/response_text_done_event.rbi b/rbi/openai/models/responses/response_text_done_event.rbi index 2fe91762..daa80967 100644 --- a/rbi/openai/models/responses/response_text_done_event.rbi +++ b/rbi/openai/models/responses/response_text_done_event.rbi @@ -109,7 +109,7 @@ module OpenAI sig { returns(Float) } attr_accessor :logprob - # The log probability of the top 20 most likely tokens. + # The log probabilities of up to 20 of the most likely tokens. sig do returns( T.nilable( @@ -149,7 +149,7 @@ module OpenAI token:, # The log probability of this token. logprob:, - # The log probability of the top 20 most likely tokens. + # The log probabilities of up to 20 of the most likely tokens. top_logprobs: nil ) end diff --git a/rbi/openai/models/responses/responses_client_event.rbi b/rbi/openai/models/responses/responses_client_event.rbi index 61f86a3c..09d725d0 100644 --- a/rbi/openai/models/responses/responses_client_event.rbi +++ b/rbi/openai/models/responses/responses_client_event.rbi @@ -405,8 +405,9 @@ module OpenAI end attr_writer :tools - # An integer between 0 and 20 specifying the number of most likely tokens to - # return at each token position, each with an associated log probability. + # An integer between 0 and 20 specifying the maximum number of most likely tokens + # to return at each token position, each with an associated log probability. In + # some cases, the number of returned tokens may be fewer than requested. sig { returns(T.nilable(Integer)) } attr_accessor :top_logprobs @@ -701,8 +702,9 @@ module OpenAI # [function calling](https://platform.openai.com/docs/guides/function-calling). # You can also use custom tools to call your own code. tools: nil, - # An integer between 0 and 20 specifying the number of most likely tokens to - # return at each token position, each with an associated log probability. + # An integer between 0 and 20 specifying the maximum number of most likely tokens + # to return at each token position, each with an associated log probability. In + # some cases, the number of returned tokens may be fewer than requested. top_logprobs: nil, # An alternative to sampling with temperature, called nucleus sampling, where the # model considers the results of the tokens with top_p probability mass. So 0.1 diff --git a/rbi/openai/resources/chat/completions.rbi b/rbi/openai/resources/chat/completions.rbi index 5ffddaac..c2aa9146 100644 --- a/rbi/openai/resources/chat/completions.rbi +++ b/rbi/openai/resources/chat/completions.rbi @@ -320,8 +320,9 @@ module OpenAI # [custom tools](https://platform.openai.com/docs/guides/function-calling#custom-tools) # or [function tools](https://platform.openai.com/docs/guides/function-calling). tools: nil, - # An integer between 0 and 20 specifying the number of most likely tokens to - # return at each token position, each with an associated log probability. + # An integer between 0 and 20 specifying the maximum number of most likely tokens + # to return at each token position, each with an associated log probability. In + # some cases, the number of returned tokens may be fewer than requested. # `logprobs` must be set to `true` if this parameter is used. top_logprobs: nil, # An alternative to sampling with temperature, called nucleus sampling, where the @@ -658,8 +659,9 @@ module OpenAI # [custom tools](https://platform.openai.com/docs/guides/function-calling#custom-tools) # or [function tools](https://platform.openai.com/docs/guides/function-calling). tools: nil, - # An integer between 0 and 20 specifying the number of most likely tokens to - # return at each token position, each with an associated log probability. + # An integer between 0 and 20 specifying the maximum number of most likely tokens + # to return at each token position, each with an associated log probability. In + # some cases, the number of returned tokens may be fewer than requested. # `logprobs` must be set to `true` if this parameter is used. top_logprobs: nil, # An alternative to sampling with temperature, called nucleus sampling, where the diff --git a/rbi/openai/resources/responses.rbi b/rbi/openai/resources/responses.rbi index caee6fe3..6542cb5a 100644 --- a/rbi/openai/resources/responses.rbi +++ b/rbi/openai/resources/responses.rbi @@ -275,8 +275,9 @@ module OpenAI # [function calling](https://platform.openai.com/docs/guides/function-calling). # You can also use custom tools to call your own code. tools: nil, - # An integer between 0 and 20 specifying the number of most likely tokens to - # return at each token position, each with an associated log probability. + # An integer between 0 and 20 specifying the maximum number of most likely tokens + # to return at each token position, each with an associated log probability. In + # some cases, the number of returned tokens may be fewer than requested. top_logprobs: nil, # An alternative to sampling with temperature, called nucleus sampling, where the # model considers the results of the tokens with top_p probability mass. So 0.1 @@ -577,8 +578,9 @@ module OpenAI # [function calling](https://platform.openai.com/docs/guides/function-calling). # You can also use custom tools to call your own code. tools: nil, - # An integer between 0 and 20 specifying the number of most likely tokens to - # return at each token position, each with an associated log probability. + # An integer between 0 and 20 specifying the maximum number of most likely tokens + # to return at each token position, each with an associated log probability. In + # some cases, the number of returned tokens may be fewer than requested. top_logprobs: nil, # An alternative to sampling with temperature, called nucleus sampling, where the # model considers the results of the tokens with top_p probability mass. So 0.1 diff --git a/sig/openai/models/admin/organization/usage_audio_speeches_response.rbs b/sig/openai/models/admin/organization/usage_audio_speeches_response.rbs index 648e35d0..6ec2b5f9 100644 --- a/sig/openai/models/admin/organization/usage_audio_speeches_response.rbs +++ b/sig/openai/models/admin/organization/usage_audio_speeches_response.rbs @@ -466,7 +466,8 @@ module OpenAI amount: OpenAI::Models::Admin::Organization::UsageAudioSpeechesResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: String?, line_item: String?, - project_id: String? + project_id: String?, + quantity: Float? } class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel @@ -484,11 +485,14 @@ module OpenAI attr_accessor project_id: String? + attr_accessor quantity: Float? + def initialize: ( ?amount: OpenAI::Models::Admin::Organization::UsageAudioSpeechesResponse::Data::Result::OrganizationCostsResult::Amount, ?api_key_id: String?, ?line_item: String?, ?project_id: String?, + ?quantity: Float?, ?object: :"organization.costs.result" ) -> void @@ -497,7 +501,8 @@ module OpenAI amount: OpenAI::Models::Admin::Organization::UsageAudioSpeechesResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: String?, line_item: String?, - project_id: String? + project_id: String?, + quantity: Float? } type amount = { currency: String, value: Float } diff --git a/sig/openai/models/admin/organization/usage_audio_transcriptions_response.rbs b/sig/openai/models/admin/organization/usage_audio_transcriptions_response.rbs index 61ae7a65..5185c757 100644 --- a/sig/openai/models/admin/organization/usage_audio_transcriptions_response.rbs +++ b/sig/openai/models/admin/organization/usage_audio_transcriptions_response.rbs @@ -466,7 +466,8 @@ module OpenAI amount: OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: String?, line_item: String?, - project_id: String? + project_id: String?, + quantity: Float? } class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel @@ -484,11 +485,14 @@ module OpenAI attr_accessor project_id: String? + attr_accessor quantity: Float? + def initialize: ( ?amount: OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse::Data::Result::OrganizationCostsResult::Amount, ?api_key_id: String?, ?line_item: String?, ?project_id: String?, + ?quantity: Float?, ?object: :"organization.costs.result" ) -> void @@ -497,7 +501,8 @@ module OpenAI amount: OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: String?, line_item: String?, - project_id: String? + project_id: String?, + quantity: Float? } type amount = { currency: String, value: Float } diff --git a/sig/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbs b/sig/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbs index f7a329ed..37a85869 100644 --- a/sig/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbs +++ b/sig/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbs @@ -466,7 +466,8 @@ module OpenAI amount: OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: String?, line_item: String?, - project_id: String? + project_id: String?, + quantity: Float? } class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel @@ -484,11 +485,14 @@ module OpenAI attr_accessor project_id: String? + attr_accessor quantity: Float? + def initialize: ( ?amount: OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationCostsResult::Amount, ?api_key_id: String?, ?line_item: String?, ?project_id: String?, + ?quantity: Float?, ?object: :"organization.costs.result" ) -> void @@ -497,7 +501,8 @@ module OpenAI amount: OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: String?, line_item: String?, - project_id: String? + project_id: String?, + quantity: Float? } type amount = { currency: String, value: Float } diff --git a/sig/openai/models/admin/organization/usage_completions_response.rbs b/sig/openai/models/admin/organization/usage_completions_response.rbs index d9e08104..0eaea083 100644 --- a/sig/openai/models/admin/organization/usage_completions_response.rbs +++ b/sig/openai/models/admin/organization/usage_completions_response.rbs @@ -466,7 +466,8 @@ module OpenAI amount: OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: String?, line_item: String?, - project_id: String? + project_id: String?, + quantity: Float? } class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel @@ -484,11 +485,14 @@ module OpenAI attr_accessor project_id: String? + attr_accessor quantity: Float? + def initialize: ( ?amount: OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationCostsResult::Amount, ?api_key_id: String?, ?line_item: String?, ?project_id: String?, + ?quantity: Float?, ?object: :"organization.costs.result" ) -> void @@ -497,7 +501,8 @@ module OpenAI amount: OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: String?, line_item: String?, - project_id: String? + project_id: String?, + quantity: Float? } type amount = { currency: String, value: Float } diff --git a/sig/openai/models/admin/organization/usage_costs_response.rbs b/sig/openai/models/admin/organization/usage_costs_response.rbs index ccd334f5..b1041872 100644 --- a/sig/openai/models/admin/organization/usage_costs_response.rbs +++ b/sig/openai/models/admin/organization/usage_costs_response.rbs @@ -466,7 +466,8 @@ module OpenAI amount: OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: String?, line_item: String?, - project_id: String? + project_id: String?, + quantity: Float? } class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel @@ -484,11 +485,14 @@ module OpenAI attr_accessor project_id: String? + attr_accessor quantity: Float? + def initialize: ( ?amount: OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult::Amount, ?api_key_id: String?, ?line_item: String?, ?project_id: String?, + ?quantity: Float?, ?object: :"organization.costs.result" ) -> void @@ -497,7 +501,8 @@ module OpenAI amount: OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: String?, line_item: String?, - project_id: String? + project_id: String?, + quantity: Float? } type amount = { currency: String, value: Float } diff --git a/sig/openai/models/admin/organization/usage_embeddings_response.rbs b/sig/openai/models/admin/organization/usage_embeddings_response.rbs index b4d194a7..bbcffb67 100644 --- a/sig/openai/models/admin/organization/usage_embeddings_response.rbs +++ b/sig/openai/models/admin/organization/usage_embeddings_response.rbs @@ -466,7 +466,8 @@ module OpenAI amount: OpenAI::Models::Admin::Organization::UsageEmbeddingsResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: String?, line_item: String?, - project_id: String? + project_id: String?, + quantity: Float? } class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel @@ -484,11 +485,14 @@ module OpenAI attr_accessor project_id: String? + attr_accessor quantity: Float? + def initialize: ( ?amount: OpenAI::Models::Admin::Organization::UsageEmbeddingsResponse::Data::Result::OrganizationCostsResult::Amount, ?api_key_id: String?, ?line_item: String?, ?project_id: String?, + ?quantity: Float?, ?object: :"organization.costs.result" ) -> void @@ -497,7 +501,8 @@ module OpenAI amount: OpenAI::Models::Admin::Organization::UsageEmbeddingsResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: String?, line_item: String?, - project_id: String? + project_id: String?, + quantity: Float? } type amount = { currency: String, value: Float } diff --git a/sig/openai/models/admin/organization/usage_images_response.rbs b/sig/openai/models/admin/organization/usage_images_response.rbs index bd6315a3..d8946d70 100644 --- a/sig/openai/models/admin/organization/usage_images_response.rbs +++ b/sig/openai/models/admin/organization/usage_images_response.rbs @@ -466,7 +466,8 @@ module OpenAI amount: OpenAI::Models::Admin::Organization::UsageImagesResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: String?, line_item: String?, - project_id: String? + project_id: String?, + quantity: Float? } class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel @@ -484,11 +485,14 @@ module OpenAI attr_accessor project_id: String? + attr_accessor quantity: Float? + def initialize: ( ?amount: OpenAI::Models::Admin::Organization::UsageImagesResponse::Data::Result::OrganizationCostsResult::Amount, ?api_key_id: String?, ?line_item: String?, ?project_id: String?, + ?quantity: Float?, ?object: :"organization.costs.result" ) -> void @@ -497,7 +501,8 @@ module OpenAI amount: OpenAI::Models::Admin::Organization::UsageImagesResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: String?, line_item: String?, - project_id: String? + project_id: String?, + quantity: Float? } type amount = { currency: String, value: Float } diff --git a/sig/openai/models/admin/organization/usage_moderations_response.rbs b/sig/openai/models/admin/organization/usage_moderations_response.rbs index 9f9e0195..5cdc0845 100644 --- a/sig/openai/models/admin/organization/usage_moderations_response.rbs +++ b/sig/openai/models/admin/organization/usage_moderations_response.rbs @@ -466,7 +466,8 @@ module OpenAI amount: OpenAI::Models::Admin::Organization::UsageModerationsResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: String?, line_item: String?, - project_id: String? + project_id: String?, + quantity: Float? } class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel @@ -484,11 +485,14 @@ module OpenAI attr_accessor project_id: String? + attr_accessor quantity: Float? + def initialize: ( ?amount: OpenAI::Models::Admin::Organization::UsageModerationsResponse::Data::Result::OrganizationCostsResult::Amount, ?api_key_id: String?, ?line_item: String?, ?project_id: String?, + ?quantity: Float?, ?object: :"organization.costs.result" ) -> void @@ -497,7 +501,8 @@ module OpenAI amount: OpenAI::Models::Admin::Organization::UsageModerationsResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: String?, line_item: String?, - project_id: String? + project_id: String?, + quantity: Float? } type amount = { currency: String, value: Float } diff --git a/sig/openai/models/admin/organization/usage_vector_stores_response.rbs b/sig/openai/models/admin/organization/usage_vector_stores_response.rbs index 996976ff..f72653a2 100644 --- a/sig/openai/models/admin/organization/usage_vector_stores_response.rbs +++ b/sig/openai/models/admin/organization/usage_vector_stores_response.rbs @@ -466,7 +466,8 @@ module OpenAI amount: OpenAI::Models::Admin::Organization::UsageVectorStoresResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: String?, line_item: String?, - project_id: String? + project_id: String?, + quantity: Float? } class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel @@ -484,11 +485,14 @@ module OpenAI attr_accessor project_id: String? + attr_accessor quantity: Float? + def initialize: ( ?amount: OpenAI::Models::Admin::Organization::UsageVectorStoresResponse::Data::Result::OrganizationCostsResult::Amount, ?api_key_id: String?, ?line_item: String?, ?project_id: String?, + ?quantity: Float?, ?object: :"organization.costs.result" ) -> void @@ -497,7 +501,8 @@ module OpenAI amount: OpenAI::Models::Admin::Organization::UsageVectorStoresResponse::Data::Result::OrganizationCostsResult::Amount, api_key_id: String?, line_item: String?, - project_id: String? + project_id: String?, + quantity: Float? } type amount = { currency: String, value: Float } From 79a543fc83b754012f77dbed1486bc119a0723a3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 May 2026 20:58:33 +0000 Subject: [PATCH 09/16] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 3ffa289b..e8baa6d2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 232 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-578515408e7ee6ac115f3768b358ff2cd4f5699cbfb527fe58b19806e7d1f713.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-feda36af0554900ba4ab2b74d82db104f65cfcddf1eef391c55fec82182414f3.yml openapi_spec_hash: b2df68d6233a18b475590978f5682c04 -config_hash: c6cf65d9b19a16ce4313602a2204d48f +config_hash: 632ca30e38686c90bef7622b1a2009ce From 51548cd04ab8f3a16e980bd2318ddb42ee75ce6c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 May 2026 21:26:13 +0000 Subject: [PATCH 10/16] fix(api): fix imagegen `size` enum regression --- .stats.yml | 6 +- lib/openai/models/image_edit_params.rb | 53 +++++++++++- lib/openai/models/image_generate_params.rb | 59 ++++++++++++- lib/openai/models/responses/tool.rb | 49 ++++++++++- lib/openai/resources/images.rb | 8 +- rbi/openai/models/image_edit_params.rbi | 54 +++++++++++- rbi/openai/models/image_generate_params.rbi | 64 +++++++++++++- rbi/openai/models/responses/tool.rbi | 93 ++++++++++++++++++++- rbi/openai/resources/images.rbi | 16 +++- sig/openai/models/image_edit_params.rbs | 30 ++++++- sig/openai/models/image_generate_params.rbs | 34 +++++++- sig/openai/models/responses/tool.rbs | 26 ++++-- sig/openai/resources/images.rbs | 8 +- 13 files changed, 453 insertions(+), 47 deletions(-) diff --git a/.stats.yml b/.stats.yml index e8baa6d2..6170a9ee 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 232 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-feda36af0554900ba4ab2b74d82db104f65cfcddf1eef391c55fec82182414f3.yml -openapi_spec_hash: b2df68d6233a18b475590978f5682c04 -config_hash: 632ca30e38686c90bef7622b1a2009ce +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-84d31411083374ec6cdb4a722f8b8b83c1230741157306b1ca7ba1a3cf246672.yml +openapi_spec_hash: 051fce676f959b8207e2317225ec4bdc +config_hash: a2916f18a94ff65c8116ca2fe3256f10 diff --git a/lib/openai/models/image_edit_params.rb b/lib/openai/models/image_edit_params.rb index 75866770..2666c5ad 100644 --- a/lib/openai/models/image_edit_params.rb +++ b/lib/openai/models/image_edit_params.rb @@ -136,8 +136,8 @@ class ImageEditParams < OpenAI::Internal::Type::BaseModel # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or # `1024x1792`. # - # @return [String, nil] - optional :size, String, nil?: true + # @return [String, Symbol, OpenAI::Models::ImageEditParams::Size, nil] + optional :size, union: -> { OpenAI::ImageEditParams::Size }, nil?: true # @!attribute user # A unique identifier representing your end-user, which can help OpenAI to monitor @@ -175,7 +175,7 @@ class ImageEditParams < OpenAI::Internal::Type::BaseModel # # @param response_format [Symbol, OpenAI::Models::ImageEditParams::ResponseFormat, nil] The format in which the generated images are returned. Must be one of `url` or ` # - # @param size [String, nil] The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21` + # @param size [String, Symbol, OpenAI::Models::ImageEditParams::Size, nil] The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21` # # @param user [String] A unique identifier representing your end-user, which can help OpenAI to monitor # @@ -299,6 +299,53 @@ module ResponseFormat # @!method self.values # @return [Array] end + + # The size of the generated images. For `gpt-image-2` and + # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` + # strings, for example `1536x864`. Width and height must both be divisible by 16 + # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above + # `2560x1440` are experimental, and the maximum supported resolution is + # `3840x2160`. The requested size must also satisfy the model's current pixel and + # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are + # supported by the GPT image models; `auto` is supported for models that allow + # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or + # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or + # `1024x1792`. + module Size + extend OpenAI::Internal::Type::Union + + variant String + + variant const: -> { OpenAI::Models::ImageEditParams::Size::SIZE_256X256 } + + variant const: -> { OpenAI::Models::ImageEditParams::Size::SIZE_512X512 } + + variant const: -> { OpenAI::Models::ImageEditParams::Size::SIZE_1024X1024 } + + variant const: -> { OpenAI::Models::ImageEditParams::Size::SIZE_1536X1024 } + + variant const: -> { OpenAI::Models::ImageEditParams::Size::SIZE_1024X1536 } + + variant const: -> { OpenAI::Models::ImageEditParams::Size::AUTO } + + # @!method self.variants + # @return [Array(String, Symbol)] + + define_sorbet_constant!(:Variants) do + T.type_alias { T.any(String, OpenAI::ImageEditParams::Size::TaggedSymbol) } + end + + # @!group + + SIZE_256X256 = :"256x256" + SIZE_512X512 = :"512x512" + SIZE_1024X1024 = :"1024x1024" + SIZE_1536X1024 = :"1536x1024" + SIZE_1024X1536 = :"1024x1536" + AUTO = :auto + + # @!endgroup + end end end end diff --git a/lib/openai/models/image_generate_params.rb b/lib/openai/models/image_generate_params.rb index 189c7788..837350e0 100644 --- a/lib/openai/models/image_generate_params.rb +++ b/lib/openai/models/image_generate_params.rb @@ -118,8 +118,8 @@ class ImageGenerateParams < OpenAI::Internal::Type::BaseModel # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or # `1024x1792`. # - # @return [String, nil] - optional :size, String, nil?: true + # @return [String, Symbol, OpenAI::Models::ImageGenerateParams::Size, nil] + optional :size, union: -> { OpenAI::ImageGenerateParams::Size }, nil?: true # @!attribute style # The style of the generated images. This parameter is only supported for @@ -162,7 +162,7 @@ class ImageGenerateParams < OpenAI::Internal::Type::BaseModel # # @param response_format [Symbol, OpenAI::Models::ImageGenerateParams::ResponseFormat, nil] The format in which generated images with `dall-e-2` and `dall-e-3` are returned # - # @param size [String, nil] The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21` + # @param size [String, Symbol, OpenAI::Models::ImageGenerateParams::Size, nil] The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21` # # @param style [Symbol, OpenAI::Models::ImageGenerateParams::Style, nil] The style of the generated images. This parameter is only supported for `dall-e- # @@ -270,6 +270,59 @@ module ResponseFormat # @return [Array] end + # The size of the generated images. For `gpt-image-2` and + # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` + # strings, for example `1536x864`. Width and height must both be divisible by 16 + # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above + # `2560x1440` are experimental, and the maximum supported resolution is + # `3840x2160`. The requested size must also satisfy the model's current pixel and + # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are + # supported by the GPT image models; `auto` is supported for models that allow + # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or + # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or + # `1024x1792`. + module Size + extend OpenAI::Internal::Type::Union + + variant String + + variant const: -> { OpenAI::Models::ImageGenerateParams::Size::AUTO } + + variant const: -> { OpenAI::Models::ImageGenerateParams::Size::SIZE_1024X1024 } + + variant const: -> { OpenAI::Models::ImageGenerateParams::Size::SIZE_1536X1024 } + + variant const: -> { OpenAI::Models::ImageGenerateParams::Size::SIZE_1024X1536 } + + variant const: -> { OpenAI::Models::ImageGenerateParams::Size::SIZE_256X256 } + + variant const: -> { OpenAI::Models::ImageGenerateParams::Size::SIZE_512X512 } + + variant const: -> { OpenAI::Models::ImageGenerateParams::Size::SIZE_1792X1024 } + + variant const: -> { OpenAI::Models::ImageGenerateParams::Size::SIZE_1024X1792 } + + # @!method self.variants + # @return [Array(String, Symbol)] + + define_sorbet_constant!(:Variants) do + T.type_alias { T.any(String, OpenAI::ImageGenerateParams::Size::TaggedSymbol) } + end + + # @!group + + AUTO = :auto + SIZE_1024X1024 = :"1024x1024" + SIZE_1536X1024 = :"1536x1024" + SIZE_1024X1536 = :"1024x1536" + SIZE_256X256 = :"256x256" + SIZE_512X512 = :"512x512" + SIZE_1792X1024 = :"1792x1024" + SIZE_1024X1792 = :"1024x1792" + + # @!endgroup + end + # The style of the generated images. This parameter is only supported for # `dall-e-3`. Must be one of `vivid` or `natural`. Vivid causes the model to lean # towards generating hyper-real and dramatic images. Natural causes the model to diff --git a/lib/openai/models/responses/tool.rb b/lib/openai/models/responses/tool.rb index 4213ce8e..5d675f35 100644 --- a/lib/openai/models/responses/tool.rb +++ b/lib/openai/models/responses/tool.rb @@ -583,8 +583,8 @@ class ImageGeneration < OpenAI::Internal::Type::BaseModel # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or # `1024x1792`. # - # @return [String, nil] - optional :size, String + # @return [String, Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::Size, nil] + optional :size, union: -> { OpenAI::Responses::Tool::ImageGeneration::Size } # @!method initialize(action: nil, background: nil, input_fidelity: nil, input_image_mask: nil, model: nil, moderation: nil, output_compression: nil, output_format: nil, partial_images: nil, quality: nil, size: nil, type: :image_generation) # Some parameter documentations has been truncated, see @@ -612,7 +612,7 @@ class ImageGeneration < OpenAI::Internal::Type::BaseModel # # @param quality [Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::Quality] The quality of the generated image. One of `low`, `medium`, `high`, # - # @param size [String] The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21` + # @param size [String, Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::Size] The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21` # # @param type [Symbol, :image_generation] The type of the image generation tool. Always `image_generation`. @@ -780,6 +780,49 @@ module Quality # @!method self.values # @return [Array] end + + # The size of the generated images. For `gpt-image-2` and + # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` + # strings, for example `1536x864`. Width and height must both be divisible by 16 + # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above + # `2560x1440` are experimental, and the maximum supported resolution is + # `3840x2160`. The requested size must also satisfy the model's current pixel and + # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are + # supported by the GPT image models; `auto` is supported for models that allow + # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or + # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or + # `1024x1792`. + # + # @see OpenAI::Models::Responses::Tool::ImageGeneration#size + module Size + extend OpenAI::Internal::Type::Union + + variant String + + variant const: -> { OpenAI::Models::Responses::Tool::ImageGeneration::Size::SIZE_1024X1024 } + + variant const: -> { OpenAI::Models::Responses::Tool::ImageGeneration::Size::SIZE_1024X1536 } + + variant const: -> { OpenAI::Models::Responses::Tool::ImageGeneration::Size::SIZE_1536X1024 } + + variant const: -> { OpenAI::Models::Responses::Tool::ImageGeneration::Size::AUTO } + + # @!method self.variants + # @return [Array(String, Symbol)] + + define_sorbet_constant!(:Variants) do + T.type_alias { T.any(String, OpenAI::Responses::Tool::ImageGeneration::Size::TaggedSymbol) } + end + + # @!group + + SIZE_1024X1024 = :"1024x1024" + SIZE_1024X1536 = :"1024x1536" + SIZE_1536X1024 = :"1536x1024" + AUTO = :auto + + # @!endgroup + end end class LocalShell < OpenAI::Internal::Type::BaseModel diff --git a/lib/openai/resources/images.rb b/lib/openai/resources/images.rb index ed51ab94..f4f0c5f0 100644 --- a/lib/openai/resources/images.rb +++ b/lib/openai/resources/images.rb @@ -76,7 +76,7 @@ def create_variation(params) # # @param response_format [Symbol, OpenAI::Models::ImageEditParams::ResponseFormat, nil] The format in which the generated images are returned. Must be one of `url` or ` # - # @param size [String, nil] The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21` + # @param size [String, Symbol, OpenAI::Models::ImageEditParams::Size, nil] The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21` # # @param user [String] A unique identifier representing your end-user, which can help OpenAI to monitor # @@ -137,7 +137,7 @@ def edit(params) # # @param response_format [Symbol, OpenAI::Models::ImageEditParams::ResponseFormat, nil] The format in which the generated images are returned. Must be one of `url` or ` # - # @param size [String, nil] The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21` + # @param size [String, Symbol, OpenAI::Models::ImageEditParams::Size, nil] The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21` # # @param user [String] A unique identifier representing your end-user, which can help OpenAI to monitor # @@ -199,7 +199,7 @@ def edit_stream_raw(params) # # @param response_format [Symbol, OpenAI::Models::ImageGenerateParams::ResponseFormat, nil] The format in which generated images with `dall-e-2` and `dall-e-3` are returned # - # @param size [String, nil] The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21` + # @param size [String, Symbol, OpenAI::Models::ImageGenerateParams::Size, nil] The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21` # # @param style [Symbol, OpenAI::Models::ImageGenerateParams::Style, nil] The style of the generated images. This parameter is only supported for `dall-e- # @@ -256,7 +256,7 @@ def generate(params) # # @param response_format [Symbol, OpenAI::Models::ImageGenerateParams::ResponseFormat, nil] The format in which generated images with `dall-e-2` and `dall-e-3` are returned # - # @param size [String, nil] The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21` + # @param size [String, Symbol, OpenAI::Models::ImageGenerateParams::Size, nil] The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21` # # @param style [Symbol, OpenAI::Models::ImageGenerateParams::Style, nil] The style of the generated images. This parameter is only supported for `dall-e- # diff --git a/rbi/openai/models/image_edit_params.rbi b/rbi/openai/models/image_edit_params.rbi index c0119949..8957c29a 100644 --- a/rbi/openai/models/image_edit_params.rbi +++ b/rbi/openai/models/image_edit_params.rbi @@ -121,7 +121,11 @@ module OpenAI # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or # `1024x1792`. - sig { returns(T.nilable(String)) } + sig do + returns( + T.nilable(T.any(String, OpenAI::ImageEditParams::Size::OrSymbol)) + ) + end attr_accessor :size # A unique identifier representing your end-user, which can help OpenAI to monitor @@ -150,7 +154,8 @@ module OpenAI quality: T.nilable(OpenAI::ImageEditParams::Quality::OrSymbol), response_format: T.nilable(OpenAI::ImageEditParams::ResponseFormat::OrSymbol), - size: T.nilable(String), + size: + T.nilable(T.any(String, OpenAI::ImageEditParams::Size::OrSymbol)), user: String, request_options: OpenAI::RequestOptions::OrHash ).returns(T.attached_class) @@ -261,7 +266,8 @@ module OpenAI quality: T.nilable(OpenAI::ImageEditParams::Quality::OrSymbol), response_format: T.nilable(OpenAI::ImageEditParams::ResponseFormat::OrSymbol), - size: T.nilable(String), + size: + T.nilable(T.any(String, OpenAI::ImageEditParams::Size::OrSymbol)), user: String, request_options: OpenAI::RequestOptions } @@ -448,6 +454,48 @@ module OpenAI def self.values end end + + # The size of the generated images. For `gpt-image-2` and + # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` + # strings, for example `1536x864`. Width and height must both be divisible by 16 + # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above + # `2560x1440` are experimental, and the maximum supported resolution is + # `3840x2160`. The requested size must also satisfy the model's current pixel and + # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are + # supported by the GPT image models; `auto` is supported for models that allow + # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or + # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or + # `1024x1792`. + module Size + extend OpenAI::Internal::Type::Union + + Variants = + T.type_alias do + T.any(String, OpenAI::ImageEditParams::Size::TaggedSymbol) + end + + sig do + override.returns(T::Array[OpenAI::ImageEditParams::Size::Variants]) + end + def self.variants + end + + TaggedSymbol = + T.type_alias { T.all(Symbol, OpenAI::ImageEditParams::Size) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SIZE_256X256 = + T.let(:"256x256", OpenAI::ImageEditParams::Size::TaggedSymbol) + SIZE_512X512 = + T.let(:"512x512", OpenAI::ImageEditParams::Size::TaggedSymbol) + SIZE_1024X1024 = + T.let(:"1024x1024", OpenAI::ImageEditParams::Size::TaggedSymbol) + SIZE_1536X1024 = + T.let(:"1536x1024", OpenAI::ImageEditParams::Size::TaggedSymbol) + SIZE_1024X1536 = + T.let(:"1024x1536", OpenAI::ImageEditParams::Size::TaggedSymbol) + AUTO = T.let(:auto, OpenAI::ImageEditParams::Size::TaggedSymbol) + end end end end diff --git a/rbi/openai/models/image_generate_params.rbi b/rbi/openai/models/image_generate_params.rbi index 781e70e9..972a769e 100644 --- a/rbi/openai/models/image_generate_params.rbi +++ b/rbi/openai/models/image_generate_params.rbi @@ -108,7 +108,11 @@ module OpenAI # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or # `1024x1792`. - sig { returns(T.nilable(String)) } + sig do + returns( + T.nilable(T.any(String, OpenAI::ImageGenerateParams::Size::OrSymbol)) + ) + end attr_accessor :size # The style of the generated images. This parameter is only supported for @@ -143,7 +147,10 @@ module OpenAI quality: T.nilable(OpenAI::ImageGenerateParams::Quality::OrSymbol), response_format: T.nilable(OpenAI::ImageGenerateParams::ResponseFormat::OrSymbol), - size: T.nilable(String), + size: + T.nilable( + T.any(String, OpenAI::ImageGenerateParams::Size::OrSymbol) + ), style: T.nilable(OpenAI::ImageGenerateParams::Style::OrSymbol), user: String, request_options: OpenAI::RequestOptions::OrHash @@ -248,7 +255,10 @@ module OpenAI quality: T.nilable(OpenAI::ImageGenerateParams::Quality::OrSymbol), response_format: T.nilable(OpenAI::ImageGenerateParams::ResponseFormat::OrSymbol), - size: T.nilable(String), + size: + T.nilable( + T.any(String, OpenAI::ImageGenerateParams::Size::OrSymbol) + ), style: T.nilable(OpenAI::ImageGenerateParams::Style::OrSymbol), user: String, request_options: OpenAI::RequestOptions @@ -431,6 +441,54 @@ module OpenAI end end + # The size of the generated images. For `gpt-image-2` and + # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` + # strings, for example `1536x864`. Width and height must both be divisible by 16 + # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above + # `2560x1440` are experimental, and the maximum supported resolution is + # `3840x2160`. The requested size must also satisfy the model's current pixel and + # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are + # supported by the GPT image models; `auto` is supported for models that allow + # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or + # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or + # `1024x1792`. + module Size + extend OpenAI::Internal::Type::Union + + Variants = + T.type_alias do + T.any(String, OpenAI::ImageGenerateParams::Size::TaggedSymbol) + end + + sig do + override.returns( + T::Array[OpenAI::ImageGenerateParams::Size::Variants] + ) + end + def self.variants + end + + TaggedSymbol = + T.type_alias { T.all(Symbol, OpenAI::ImageGenerateParams::Size) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + AUTO = T.let(:auto, OpenAI::ImageGenerateParams::Size::TaggedSymbol) + SIZE_1024X1024 = + T.let(:"1024x1024", OpenAI::ImageGenerateParams::Size::TaggedSymbol) + SIZE_1536X1024 = + T.let(:"1536x1024", OpenAI::ImageGenerateParams::Size::TaggedSymbol) + SIZE_1024X1536 = + T.let(:"1024x1536", OpenAI::ImageGenerateParams::Size::TaggedSymbol) + SIZE_256X256 = + T.let(:"256x256", OpenAI::ImageGenerateParams::Size::TaggedSymbol) + SIZE_512X512 = + T.let(:"512x512", OpenAI::ImageGenerateParams::Size::TaggedSymbol) + SIZE_1792X1024 = + T.let(:"1792x1024", OpenAI::ImageGenerateParams::Size::TaggedSymbol) + SIZE_1024X1792 = + T.let(:"1024x1792", OpenAI::ImageGenerateParams::Size::TaggedSymbol) + end + # The style of the generated images. This parameter is only supported for # `dall-e-3`. Must be one of `vivid` or `natural`. Vivid causes the model to lean # towards generating hyper-real and dramatic images. Natural causes the model to diff --git a/rbi/openai/models/responses/tool.rbi b/rbi/openai/models/responses/tool.rbi index 4a72f96b..d1ee40dc 100644 --- a/rbi/openai/models/responses/tool.rbi +++ b/rbi/openai/models/responses/tool.rbi @@ -1093,10 +1093,27 @@ module OpenAI # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or # `1024x1792`. - sig { returns(T.nilable(String)) } + sig do + returns( + T.nilable( + T.any( + String, + OpenAI::Responses::Tool::ImageGeneration::Size::OrSymbol + ) + ) + ) + end attr_reader :size - sig { params(size: String).void } + sig do + params( + size: + T.any( + String, + OpenAI::Responses::Tool::ImageGeneration::Size::OrSymbol + ) + ).void + end attr_writer :size # A tool that generates images using the GPT image models. @@ -1125,7 +1142,11 @@ module OpenAI partial_images: Integer, quality: OpenAI::Responses::Tool::ImageGeneration::Quality::OrSymbol, - size: String, + size: + T.any( + String, + OpenAI::Responses::Tool::ImageGeneration::Size::OrSymbol + ), type: Symbol ).returns(T.attached_class) end @@ -1212,7 +1233,11 @@ module OpenAI partial_images: Integer, quality: OpenAI::Responses::Tool::ImageGeneration::Quality::OrSymbol, - size: String + size: + T.any( + String, + OpenAI::Responses::Tool::ImageGeneration::Size::OrSymbol + ) } ) end @@ -1566,6 +1591,66 @@ module OpenAI def self.values end end + + # The size of the generated images. For `gpt-image-2` and + # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` + # strings, for example `1536x864`. Width and height must both be divisible by 16 + # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above + # `2560x1440` are experimental, and the maximum supported resolution is + # `3840x2160`. The requested size must also satisfy the model's current pixel and + # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are + # supported by the GPT image models; `auto` is supported for models that allow + # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or + # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or + # `1024x1792`. + module Size + extend OpenAI::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + String, + OpenAI::Responses::Tool::ImageGeneration::Size::TaggedSymbol + ) + end + + sig do + override.returns( + T::Array[ + OpenAI::Responses::Tool::ImageGeneration::Size::Variants + ] + ) + end + def self.variants + end + + TaggedSymbol = + T.type_alias do + T.all(Symbol, OpenAI::Responses::Tool::ImageGeneration::Size) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SIZE_1024X1024 = + T.let( + :"1024x1024", + OpenAI::Responses::Tool::ImageGeneration::Size::TaggedSymbol + ) + SIZE_1024X1536 = + T.let( + :"1024x1536", + OpenAI::Responses::Tool::ImageGeneration::Size::TaggedSymbol + ) + SIZE_1536X1024 = + T.let( + :"1536x1024", + OpenAI::Responses::Tool::ImageGeneration::Size::TaggedSymbol + ) + AUTO = + T.let( + :auto, + OpenAI::Responses::Tool::ImageGeneration::Size::TaggedSymbol + ) + end end class LocalShell < OpenAI::Internal::Type::BaseModel diff --git a/rbi/openai/resources/images.rbi b/rbi/openai/resources/images.rbi index 20142713..f3cc4b5d 100644 --- a/rbi/openai/resources/images.rbi +++ b/rbi/openai/resources/images.rbi @@ -65,7 +65,8 @@ module OpenAI quality: T.nilable(OpenAI::ImageEditParams::Quality::OrSymbol), response_format: T.nilable(OpenAI::ImageEditParams::ResponseFormat::OrSymbol), - size: T.nilable(String), + size: + T.nilable(T.any(String, OpenAI::ImageEditParams::Size::OrSymbol)), user: String, stream: T.noreturn, request_options: OpenAI::RequestOptions::OrHash @@ -183,7 +184,8 @@ module OpenAI quality: T.nilable(OpenAI::ImageEditParams::Quality::OrSymbol), response_format: T.nilable(OpenAI::ImageEditParams::ResponseFormat::OrSymbol), - size: T.nilable(String), + size: + T.nilable(T.any(String, OpenAI::ImageEditParams::Size::OrSymbol)), user: String, stream: T.noreturn, request_options: OpenAI::RequestOptions::OrHash @@ -301,7 +303,10 @@ module OpenAI quality: T.nilable(OpenAI::ImageGenerateParams::Quality::OrSymbol), response_format: T.nilable(OpenAI::ImageGenerateParams::ResponseFormat::OrSymbol), - size: T.nilable(String), + size: + T.nilable( + T.any(String, OpenAI::ImageGenerateParams::Size::OrSymbol) + ), style: T.nilable(OpenAI::ImageGenerateParams::Style::OrSymbol), user: String, stream: T.noreturn, @@ -413,7 +418,10 @@ module OpenAI quality: T.nilable(OpenAI::ImageGenerateParams::Quality::OrSymbol), response_format: T.nilable(OpenAI::ImageGenerateParams::ResponseFormat::OrSymbol), - size: T.nilable(String), + size: + T.nilable( + T.any(String, OpenAI::ImageGenerateParams::Size::OrSymbol) + ), style: T.nilable(OpenAI::ImageGenerateParams::Style::OrSymbol), user: String, stream: T.noreturn, diff --git a/sig/openai/models/image_edit_params.rbs b/sig/openai/models/image_edit_params.rbs index 0b789808..a8ce696b 100644 --- a/sig/openai/models/image_edit_params.rbs +++ b/sig/openai/models/image_edit_params.rbs @@ -14,7 +14,7 @@ module OpenAI partial_images: Integer?, quality: OpenAI::Models::ImageEditParams::quality?, response_format: OpenAI::Models::ImageEditParams::response_format?, - size: String?, + size: OpenAI::Models::ImageEditParams::size?, user: String } & OpenAI::Internal::Type::request_parameters @@ -49,7 +49,7 @@ module OpenAI attr_accessor response_format: OpenAI::Models::ImageEditParams::response_format? - attr_accessor size: String? + attr_accessor size: OpenAI::Models::ImageEditParams::size? attr_reader user: String? @@ -68,7 +68,7 @@ module OpenAI ?partial_images: Integer?, ?quality: OpenAI::Models::ImageEditParams::quality?, ?response_format: OpenAI::Models::ImageEditParams::response_format?, - ?size: String?, + ?size: OpenAI::Models::ImageEditParams::size?, ?user: String, ?request_options: OpenAI::request_opts ) -> void @@ -86,7 +86,7 @@ module OpenAI partial_images: Integer?, quality: OpenAI::Models::ImageEditParams::quality?, response_format: OpenAI::Models::ImageEditParams::response_format?, - size: String?, + size: OpenAI::Models::ImageEditParams::size?, user: String, request_options: OpenAI::RequestOptions } @@ -169,6 +169,28 @@ module OpenAI def self?.values: -> ::Array[OpenAI::Models::ImageEditParams::response_format] end + + type size = + String + | :"256x256" + | :"512x512" + | :"1024x1024" + | :"1536x1024" + | :"1024x1536" + | :auto + + module Size + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::ImageEditParams::size] + + SIZE_256X256: :"256x256" + SIZE_512X512: :"512x512" + SIZE_1024X1024: :"1024x1024" + SIZE_1536X1024: :"1536x1024" + SIZE_1024X1536: :"1024x1536" + AUTO: :auto + end end end end diff --git a/sig/openai/models/image_generate_params.rbs b/sig/openai/models/image_generate_params.rbs index 8208f7c9..82c73a26 100644 --- a/sig/openai/models/image_generate_params.rbs +++ b/sig/openai/models/image_generate_params.rbs @@ -12,7 +12,7 @@ module OpenAI partial_images: Integer?, quality: OpenAI::Models::ImageGenerateParams::quality?, response_format: OpenAI::Models::ImageGenerateParams::response_format?, - size: String?, + size: OpenAI::Models::ImageGenerateParams::size?, style: OpenAI::Models::ImageGenerateParams::style?, user: String } @@ -42,7 +42,7 @@ module OpenAI attr_accessor response_format: OpenAI::Models::ImageGenerateParams::response_format? - attr_accessor size: String? + attr_accessor size: OpenAI::Models::ImageGenerateParams::size? attr_accessor style: OpenAI::Models::ImageGenerateParams::style? @@ -61,7 +61,7 @@ module OpenAI ?partial_images: Integer?, ?quality: OpenAI::Models::ImageGenerateParams::quality?, ?response_format: OpenAI::Models::ImageGenerateParams::response_format?, - ?size: String?, + ?size: OpenAI::Models::ImageGenerateParams::size?, ?style: OpenAI::Models::ImageGenerateParams::style?, ?user: String, ?request_options: OpenAI::request_opts @@ -78,7 +78,7 @@ module OpenAI partial_images: Integer?, quality: OpenAI::Models::ImageGenerateParams::quality?, response_format: OpenAI::Models::ImageGenerateParams::response_format?, - size: String?, + size: OpenAI::Models::ImageGenerateParams::size?, style: OpenAI::Models::ImageGenerateParams::style?, user: String, request_options: OpenAI::RequestOptions @@ -153,6 +153,32 @@ module OpenAI def self?.values: -> ::Array[OpenAI::Models::ImageGenerateParams::response_format] end + type size = + String + | :auto + | :"1024x1024" + | :"1536x1024" + | :"1024x1536" + | :"256x256" + | :"512x512" + | :"1792x1024" + | :"1024x1792" + + module Size + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::ImageGenerateParams::size] + + AUTO: :auto + SIZE_1024X1024: :"1024x1024" + SIZE_1536X1024: :"1536x1024" + SIZE_1024X1536: :"1024x1536" + SIZE_256X256: :"256x256" + SIZE_512X512: :"512x512" + SIZE_1792X1024: :"1792x1024" + SIZE_1024X1792: :"1024x1792" + end + type style = :vivid | :natural module Style diff --git a/sig/openai/models/responses/tool.rbs b/sig/openai/models/responses/tool.rbs index f17e752d..80aa4563 100644 --- a/sig/openai/models/responses/tool.rbs +++ b/sig/openai/models/responses/tool.rbs @@ -347,7 +347,7 @@ module OpenAI output_format: OpenAI::Models::Responses::Tool::ImageGeneration::output_format, partial_images: Integer, quality: OpenAI::Models::Responses::Tool::ImageGeneration::quality, - size: String + size: OpenAI::Models::Responses::Tool::ImageGeneration::size } class ImageGeneration < OpenAI::Internal::Type::BaseModel @@ -405,9 +405,11 @@ module OpenAI OpenAI::Models::Responses::Tool::ImageGeneration::quality ) -> OpenAI::Models::Responses::Tool::ImageGeneration::quality - attr_reader size: String? + attr_reader size: OpenAI::Models::Responses::Tool::ImageGeneration::size? - def size=: (String) -> String + def size=: ( + OpenAI::Models::Responses::Tool::ImageGeneration::size + ) -> OpenAI::Models::Responses::Tool::ImageGeneration::size def initialize: ( ?action: OpenAI::Models::Responses::Tool::ImageGeneration::action, @@ -420,7 +422,7 @@ module OpenAI ?output_format: OpenAI::Models::Responses::Tool::ImageGeneration::output_format, ?partial_images: Integer, ?quality: OpenAI::Models::Responses::Tool::ImageGeneration::quality, - ?size: String, + ?size: OpenAI::Models::Responses::Tool::ImageGeneration::size, ?type: :image_generation ) -> void @@ -436,7 +438,7 @@ module OpenAI output_format: OpenAI::Models::Responses::Tool::ImageGeneration::output_format, partial_images: Integer, quality: OpenAI::Models::Responses::Tool::ImageGeneration::quality, - size: String + size: OpenAI::Models::Responses::Tool::ImageGeneration::size } type action = :generate | :edit | :auto @@ -547,6 +549,20 @@ module OpenAI def self?.values: -> ::Array[OpenAI::Models::Responses::Tool::ImageGeneration::quality] end + + type size = + String | :"1024x1024" | :"1024x1536" | :"1536x1024" | :auto + + module Size + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::Responses::Tool::ImageGeneration::size] + + SIZE_1024X1024: :"1024x1024" + SIZE_1024X1536: :"1024x1536" + SIZE_1536X1024: :"1536x1024" + AUTO: :auto + end end type local_shell = { type: :local_shell } diff --git a/sig/openai/resources/images.rbs b/sig/openai/resources/images.rbs index 6ee6a4a0..bd5dfbcf 100644 --- a/sig/openai/resources/images.rbs +++ b/sig/openai/resources/images.rbs @@ -24,7 +24,7 @@ module OpenAI ?partial_images: Integer?, ?quality: OpenAI::Models::ImageEditParams::quality?, ?response_format: OpenAI::Models::ImageEditParams::response_format?, - ?size: String?, + ?size: OpenAI::Models::ImageEditParams::size?, ?user: String, ?request_options: OpenAI::request_opts ) -> OpenAI::ImagesResponse @@ -42,7 +42,7 @@ module OpenAI ?partial_images: Integer?, ?quality: OpenAI::Models::ImageEditParams::quality?, ?response_format: OpenAI::Models::ImageEditParams::response_format?, - ?size: String?, + ?size: OpenAI::Models::ImageEditParams::size?, ?user: String, ?request_options: OpenAI::request_opts ) -> OpenAI::Internal::Stream[OpenAI::Models::image_edit_stream_event] @@ -58,7 +58,7 @@ module OpenAI ?partial_images: Integer?, ?quality: OpenAI::Models::ImageGenerateParams::quality?, ?response_format: OpenAI::Models::ImageGenerateParams::response_format?, - ?size: String?, + ?size: OpenAI::Models::ImageGenerateParams::size?, ?style: OpenAI::Models::ImageGenerateParams::style?, ?user: String, ?request_options: OpenAI::request_opts @@ -75,7 +75,7 @@ module OpenAI ?partial_images: Integer?, ?quality: OpenAI::Models::ImageGenerateParams::quality?, ?response_format: OpenAI::Models::ImageGenerateParams::response_format?, - ?size: String?, + ?size: OpenAI::Models::ImageGenerateParams::size?, ?style: OpenAI::Models::ImageGenerateParams::style?, ?user: String, ?request_options: OpenAI::request_opts From c847b238d52ac0cb97244fb764ca5151a4d31ce4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 May 2026 21:54:16 +0000 Subject: [PATCH 11/16] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 6170a9ee..6cbe62f7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 232 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-84d31411083374ec6cdb4a722f8b8b83c1230741157306b1ca7ba1a3cf246672.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-3c2b379de00a99101907866ecbe816bff4957f949691e641c6a4e809559386db.yml openapi_spec_hash: 051fce676f959b8207e2317225ec4bdc -config_hash: a2916f18a94ff65c8116ca2fe3256f10 +config_hash: 0970c9a530a7880eb4ca75ff96bcf61b From 4c71b6fae3846b82923d7de2dd2598af381e3786 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 May 2026 22:21:18 +0000 Subject: [PATCH 12/16] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 6cbe62f7..a601bad9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 232 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-3c2b379de00a99101907866ecbe816bff4957f949691e641c6a4e809559386db.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-2388e437ea21ac4b945762c2c3d65d276f26014e7aee70e173e921193362b2b9.yml openapi_spec_hash: 051fce676f959b8207e2317225ec4bdc -config_hash: 0970c9a530a7880eb4ca75ff96bcf61b +config_hash: c8fd630a06acd84b4384186b926e3277 From 7b54463e487c0817cdbaf06bcbc6695c32fa3dba Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 May 2026 22:31:46 +0000 Subject: [PATCH 13/16] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index a601bad9..3c0d5984 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 232 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-2388e437ea21ac4b945762c2c3d65d276f26014e7aee70e173e921193362b2b9.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-2f2e274f51df9ef4e7531b9e5c597bb9cd182fc56bb87ca617e2677a6abda72c.yml openapi_spec_hash: 051fce676f959b8207e2317225ec4bdc -config_hash: c8fd630a06acd84b4384186b926e3277 +config_hash: 5238a19104ff62c65ed1cb4b0aa46f4f From 4baf155ef74ffdf533dfba330e15f7accf1e5351 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 7 May 2026 14:52:33 +0000 Subject: [PATCH 14/16] feat(api): manual updates --- .stats.yml | 6 +- lib/openai.rb | 16 + .../realtime_translation_client_event.rb | 45 +++ ...ranslation_client_secret_create_request.rb | 85 +++++ ...anslation_client_secret_create_response.rb | 42 +++ ...slation_input_audio_buffer_append_event.rb | 51 +++ ...ranslation_input_transcript_delta_event.rb | 55 +++ ...me_translation_output_audio_delta_event.rb | 89 +++++ ...anslation_output_transcript_delta_event.rb | 54 +++ .../realtime_translation_server_event.rb | 53 +++ .../realtime/realtime_translation_session.rb | 158 ++++++++ ...ealtime_translation_session_close_event.rb | 30 ++ ...altime_translation_session_closed_event.rb | 28 ++ ...time_translation_session_create_request.rb | 138 +++++++ ...ltime_translation_session_created_event.rb | 38 ++ ...altime_translation_session_update_event.rb | 43 +++ ...time_translation_session_update_request.rb | 129 +++++++ ...ltime_translation_session_updated_event.rb | 37 ++ .../realtime_translation_client_event.rbi | 29 ++ ...anslation_client_secret_create_request.rbi | 193 ++++++++++ ...nslation_client_secret_create_response.rbi | 69 ++++ ...lation_input_audio_buffer_append_event.rbi | 69 ++++ ...anslation_input_transcript_delta_event.rbi | 77 ++++ ...e_translation_output_audio_delta_event.rbi | 148 ++++++++ ...nslation_output_transcript_delta_event.rbi | 76 ++++ .../realtime_translation_server_event.rbi | 33 ++ .../realtime/realtime_translation_session.rbi | 339 ++++++++++++++++++ ...altime_translation_session_close_event.rbi | 44 +++ ...ltime_translation_session_closed_event.rbi | 39 ++ ...ime_translation_session_create_request.rbi | 322 +++++++++++++++++ ...time_translation_session_created_event.rbi | 68 ++++ ...ltime_translation_session_update_event.rbi | 78 ++++ ...ime_translation_session_update_request.rbi | 313 ++++++++++++++++ ...time_translation_session_updated_event.rbi | 67 ++++ .../realtime_translation_client_event.rbs | 16 + ...anslation_client_secret_create_request.rbs | 69 ++++ ...nslation_client_secret_create_response.rbs | 32 ++ ...lation_input_audio_buffer_append_event.rbs | 34 ++ ...anslation_input_transcript_delta_event.rbs | 37 ++ ...e_translation_output_audio_delta_event.rbs | 70 ++++ ...nslation_output_transcript_delta_event.rbs | 37 ++ .../realtime_translation_server_event.rbs | 20 ++ .../realtime/realtime_translation_session.rbs | 131 +++++++ ...altime_translation_session_close_event.rbs | 20 ++ ...ltime_translation_session_closed_event.rbs | 18 + ...ime_translation_session_create_request.rbs | 120 +++++++ ...time_translation_session_created_event.rbs | 32 ++ ...ltime_translation_session_update_event.rbs | 34 ++ ...ime_translation_session_update_request.rbs | 115 ++++++ ...time_translation_session_updated_event.rbs | 32 ++ 50 files changed, 3875 insertions(+), 3 deletions(-) create mode 100644 lib/openai/models/realtime/realtime_translation_client_event.rb create mode 100644 lib/openai/models/realtime/realtime_translation_client_secret_create_request.rb create mode 100644 lib/openai/models/realtime/realtime_translation_client_secret_create_response.rb create mode 100644 lib/openai/models/realtime/realtime_translation_input_audio_buffer_append_event.rb create mode 100644 lib/openai/models/realtime/realtime_translation_input_transcript_delta_event.rb create mode 100644 lib/openai/models/realtime/realtime_translation_output_audio_delta_event.rb create mode 100644 lib/openai/models/realtime/realtime_translation_output_transcript_delta_event.rb create mode 100644 lib/openai/models/realtime/realtime_translation_server_event.rb create mode 100644 lib/openai/models/realtime/realtime_translation_session.rb create mode 100644 lib/openai/models/realtime/realtime_translation_session_close_event.rb create mode 100644 lib/openai/models/realtime/realtime_translation_session_closed_event.rb create mode 100644 lib/openai/models/realtime/realtime_translation_session_create_request.rb create mode 100644 lib/openai/models/realtime/realtime_translation_session_created_event.rb create mode 100644 lib/openai/models/realtime/realtime_translation_session_update_event.rb create mode 100644 lib/openai/models/realtime/realtime_translation_session_update_request.rb create mode 100644 lib/openai/models/realtime/realtime_translation_session_updated_event.rb create mode 100644 rbi/openai/models/realtime/realtime_translation_client_event.rbi create mode 100644 rbi/openai/models/realtime/realtime_translation_client_secret_create_request.rbi create mode 100644 rbi/openai/models/realtime/realtime_translation_client_secret_create_response.rbi create mode 100644 rbi/openai/models/realtime/realtime_translation_input_audio_buffer_append_event.rbi create mode 100644 rbi/openai/models/realtime/realtime_translation_input_transcript_delta_event.rbi create mode 100644 rbi/openai/models/realtime/realtime_translation_output_audio_delta_event.rbi create mode 100644 rbi/openai/models/realtime/realtime_translation_output_transcript_delta_event.rbi create mode 100644 rbi/openai/models/realtime/realtime_translation_server_event.rbi create mode 100644 rbi/openai/models/realtime/realtime_translation_session.rbi create mode 100644 rbi/openai/models/realtime/realtime_translation_session_close_event.rbi create mode 100644 rbi/openai/models/realtime/realtime_translation_session_closed_event.rbi create mode 100644 rbi/openai/models/realtime/realtime_translation_session_create_request.rbi create mode 100644 rbi/openai/models/realtime/realtime_translation_session_created_event.rbi create mode 100644 rbi/openai/models/realtime/realtime_translation_session_update_event.rbi create mode 100644 rbi/openai/models/realtime/realtime_translation_session_update_request.rbi create mode 100644 rbi/openai/models/realtime/realtime_translation_session_updated_event.rbi create mode 100644 sig/openai/models/realtime/realtime_translation_client_event.rbs create mode 100644 sig/openai/models/realtime/realtime_translation_client_secret_create_request.rbs create mode 100644 sig/openai/models/realtime/realtime_translation_client_secret_create_response.rbs create mode 100644 sig/openai/models/realtime/realtime_translation_input_audio_buffer_append_event.rbs create mode 100644 sig/openai/models/realtime/realtime_translation_input_transcript_delta_event.rbs create mode 100644 sig/openai/models/realtime/realtime_translation_output_audio_delta_event.rbs create mode 100644 sig/openai/models/realtime/realtime_translation_output_transcript_delta_event.rbs create mode 100644 sig/openai/models/realtime/realtime_translation_server_event.rbs create mode 100644 sig/openai/models/realtime/realtime_translation_session.rbs create mode 100644 sig/openai/models/realtime/realtime_translation_session_close_event.rbs create mode 100644 sig/openai/models/realtime/realtime_translation_session_closed_event.rbs create mode 100644 sig/openai/models/realtime/realtime_translation_session_create_request.rbs create mode 100644 sig/openai/models/realtime/realtime_translation_session_created_event.rbs create mode 100644 sig/openai/models/realtime/realtime_translation_session_update_event.rbs create mode 100644 sig/openai/models/realtime/realtime_translation_session_update_request.rbs create mode 100644 sig/openai/models/realtime/realtime_translation_session_updated_event.rbs diff --git a/.stats.yml b/.stats.yml index 3c0d5984..74bb7cc4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 232 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-2f2e274f51df9ef4e7531b9e5c597bb9cd182fc56bb87ca617e2677a6abda72c.yml -openapi_spec_hash: 051fce676f959b8207e2317225ec4bdc -config_hash: 5238a19104ff62c65ed1cb4b0aa46f4f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-08cb8ed18dfe4a9fa518e278576d3cfe5710cb5c22789cf80826c900569bcf56.yml +openapi_spec_hash: 20f820c94f54741b75d719f6a7371c12 +config_hash: f291a449469edfe61a28424e548899b2 diff --git a/lib/openai.rb b/lib/openai.rb index b57fdc78..53fab3f9 100644 --- a/lib/openai.rb +++ b/lib/openai.rb @@ -651,6 +651,22 @@ require_relative "openai/models/realtime/realtime_transcription_session_create_request" require_relative "openai/models/realtime/realtime_transcription_session_create_response" require_relative "openai/models/realtime/realtime_transcription_session_turn_detection" +require_relative "openai/models/realtime/realtime_translation_client_event" +require_relative "openai/models/realtime/realtime_translation_client_secret_create_request" +require_relative "openai/models/realtime/realtime_translation_client_secret_create_response" +require_relative "openai/models/realtime/realtime_translation_input_audio_buffer_append_event" +require_relative "openai/models/realtime/realtime_translation_input_transcript_delta_event" +require_relative "openai/models/realtime/realtime_translation_output_audio_delta_event" +require_relative "openai/models/realtime/realtime_translation_output_transcript_delta_event" +require_relative "openai/models/realtime/realtime_translation_server_event" +require_relative "openai/models/realtime/realtime_translation_session" +require_relative "openai/models/realtime/realtime_translation_session_closed_event" +require_relative "openai/models/realtime/realtime_translation_session_close_event" +require_relative "openai/models/realtime/realtime_translation_session_created_event" +require_relative "openai/models/realtime/realtime_translation_session_create_request" +require_relative "openai/models/realtime/realtime_translation_session_updated_event" +require_relative "openai/models/realtime/realtime_translation_session_update_event" +require_relative "openai/models/realtime/realtime_translation_session_update_request" require_relative "openai/models/realtime/realtime_truncation" require_relative "openai/models/realtime/realtime_truncation_retention_ratio" require_relative "openai/models/realtime/response_audio_delta_event" diff --git a/lib/openai/models/realtime/realtime_translation_client_event.rb b/lib/openai/models/realtime/realtime_translation_client_event.rb new file mode 100644 index 00000000..c91335ae --- /dev/null +++ b/lib/openai/models/realtime/realtime_translation_client_event.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Realtime + # A Realtime translation client event. + module RealtimeTranslationClientEvent + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Send this event to update the translation session configuration. Translation + # sessions support updates to `audio.output.language`, `audio.input.transcription`, + # and `audio.input.noise_reduction`. + variant :"session.update", -> { OpenAI::Realtime::RealtimeTranslationSessionUpdateEvent } + + # Send this event to append audio bytes to the translation session input audio buffer. + # + # WebSocket translation sessions accept base64-encoded 24 kHz PCM16 mono + # little-endian raw audio bytes. Unsupported websocket audio formats return a + # validation error because lower-quality audio materially degrades translation + # quality. + # + # Translation consumes 200 ms engine frames. For best realtime behavior, append + # audio in 200 ms chunks. If a chunk is shorter, the server buffers it until it + # has enough audio for one frame. If a chunk is longer, the server splits it into + # 200 ms frames and enqueues them back-to-back. + # + # Keep appending silence while the session is active. If a client stops sending + # audio and later resumes, model time treats the resumed audio as contiguous with + # the previous audio rather than as a real-world pause. + variant :"session.input_audio_buffer.append", + -> { OpenAI::Realtime::RealtimeTranslationInputAudioBufferAppendEvent } + + # Gracefully close the realtime translation session. The server flushes pending + # input audio and emits any remaining translated output before closing the + # session. + variant :"session.close", -> { OpenAI::Realtime::RealtimeTranslationSessionCloseEvent } + + # @!method self.variants + # @return [Array(OpenAI::Models::Realtime::RealtimeTranslationSessionUpdateEvent, OpenAI::Models::Realtime::RealtimeTranslationInputAudioBufferAppendEvent, OpenAI::Models::Realtime::RealtimeTranslationSessionCloseEvent)] + end + end + end +end diff --git a/lib/openai/models/realtime/realtime_translation_client_secret_create_request.rb b/lib/openai/models/realtime/realtime_translation_client_secret_create_request.rb new file mode 100644 index 00000000..3df3eab0 --- /dev/null +++ b/lib/openai/models/realtime/realtime_translation_client_secret_create_request.rb @@ -0,0 +1,85 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Realtime + class RealtimeTranslationClientSecretCreateRequest < OpenAI::Internal::Type::BaseModel + # @!attribute session + # Realtime translation session configuration. Translation sessions stream source + # audio in and translated audio plus transcript deltas out continuously. + # + # @return [OpenAI::Models::Realtime::RealtimeTranslationSessionCreateRequest] + required :session, -> { OpenAI::Realtime::RealtimeTranslationSessionCreateRequest } + + # @!attribute expires_after + # Configuration for the client secret expiration. Expiration refers to the time + # after which a client secret will no longer be valid for creating sessions. The + # session itself may continue after that time once started. A secret can be used + # to create multiple sessions until it expires. + # + # @return [OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter, nil] + optional :expires_after, + -> { OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter } + + # @!method initialize(session:, expires_after: nil) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest} for + # more details. + # + # Create a translation session and client secret for the Realtime API. + # + # @param session [OpenAI::Models::Realtime::RealtimeTranslationSessionCreateRequest] Realtime translation session configuration. Translation sessions stream source + # + # @param expires_after [OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter] Configuration for the client secret expiration. Expiration refers to the time af + + # @see OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest#expires_after + class ExpiresAfter < OpenAI::Internal::Type::BaseModel + # @!attribute anchor + # The anchor point for the client secret expiration, meaning that `seconds` will + # be added to the `created_at` time of the client secret to produce an expiration + # timestamp. Only `created_at` is currently supported. + # + # @return [Symbol, OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::Anchor, nil] + optional :anchor, + enum: -> { OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::Anchor } + + # @!attribute seconds + # The number of seconds from the anchor point to the expiration. Select a value + # between `10` and `7200` (2 hours). This default to 600 seconds (10 minutes) if + # not specified. + # + # @return [Integer, nil] + optional :seconds, Integer + + # @!method initialize(anchor: nil, seconds: nil) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter} + # for more details. + # + # Configuration for the client secret expiration. Expiration refers to the time + # after which a client secret will no longer be valid for creating sessions. The + # session itself may continue after that time once started. A secret can be used + # to create multiple sessions until it expires. + # + # @param anchor [Symbol, OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::Anchor] The anchor point for the client secret expiration, meaning that `seconds` will b + # + # @param seconds [Integer] The number of seconds from the anchor point to the expiration. Select a value be + + # The anchor point for the client secret expiration, meaning that `seconds` will + # be added to the `created_at` time of the client secret to produce an expiration + # timestamp. Only `created_at` is currently supported. + # + # @see OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter#anchor + module Anchor + extend OpenAI::Internal::Type::Enum + + CREATED_AT = :created_at + + # @!method self.values + # @return [Array] + end + end + end + end + end +end diff --git a/lib/openai/models/realtime/realtime_translation_client_secret_create_response.rb b/lib/openai/models/realtime/realtime_translation_client_secret_create_response.rb new file mode 100644 index 00000000..64223f78 --- /dev/null +++ b/lib/openai/models/realtime/realtime_translation_client_secret_create_response.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Realtime + class RealtimeTranslationClientSecretCreateResponse < OpenAI::Internal::Type::BaseModel + # @!attribute expires_at + # Expiration timestamp for the client secret, in seconds since epoch. + # + # @return [Integer] + required :expires_at, Integer + + # @!attribute session + # A Realtime translation session. Translation sessions continuously translate + # input audio into the configured output language. + # + # @return [OpenAI::Models::Realtime::RealtimeTranslationSession] + required :session, -> { OpenAI::Realtime::RealtimeTranslationSession } + + # @!attribute value + # The generated client secret value. + # + # @return [String] + required :value, String + + # @!method initialize(expires_at:, session:, value:) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateResponse} for + # more details. + # + # Response from creating a translation session and client secret for the Realtime + # API. + # + # @param expires_at [Integer] Expiration timestamp for the client secret, in seconds since epoch. + # + # @param session [OpenAI::Models::Realtime::RealtimeTranslationSession] A Realtime translation session. Translation sessions continuously translate inpu + # + # @param value [String] The generated client secret value. + end + end + end +end diff --git a/lib/openai/models/realtime/realtime_translation_input_audio_buffer_append_event.rb b/lib/openai/models/realtime/realtime_translation_input_audio_buffer_append_event.rb new file mode 100644 index 00000000..7cd7d3fb --- /dev/null +++ b/lib/openai/models/realtime/realtime_translation_input_audio_buffer_append_event.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Realtime + class RealtimeTranslationInputAudioBufferAppendEvent < OpenAI::Internal::Type::BaseModel + # @!attribute audio + # Base64-encoded 24 kHz PCM16 mono audio bytes. + # + # @return [String] + required :audio, String + + # @!attribute type + # The event type, must be `session.input_audio_buffer.append`. + # + # @return [Symbol, :"session.input_audio_buffer.append"] + required :type, const: :"session.input_audio_buffer.append" + + # @!attribute event_id + # Optional client-generated ID used to identify this event. + # + # @return [String, nil] + optional :event_id, String + + # @!method initialize(audio:, event_id: nil, type: :"session.input_audio_buffer.append") + # Send this event to append audio bytes to the translation session input audio + # buffer. + # + # WebSocket translation sessions accept base64-encoded 24 kHz PCM16 mono + # little-endian raw audio bytes. Unsupported websocket audio formats return a + # validation error because lower-quality audio materially degrades translation + # quality. + # + # Translation consumes 200 ms engine frames. For best realtime behavior, append + # audio in 200 ms chunks. If a chunk is shorter, the server buffers it until it + # has enough audio for one frame. If a chunk is longer, the server splits it into + # 200 ms frames and enqueues them back-to-back. + # + # Keep appending silence while the session is active. If a client stops sending + # audio and later resumes, model time treats the resumed audio as contiguous with + # the previous audio rather than as a real-world pause. + # + # @param audio [String] Base64-encoded 24 kHz PCM16 mono audio bytes. + # + # @param event_id [String] Optional client-generated ID used to identify this event. + # + # @param type [Symbol, :"session.input_audio_buffer.append"] The event type, must be `session.input_audio_buffer.append`. + end + end + end +end diff --git a/lib/openai/models/realtime/realtime_translation_input_transcript_delta_event.rb b/lib/openai/models/realtime/realtime_translation_input_transcript_delta_event.rb new file mode 100644 index 00000000..d005e56d --- /dev/null +++ b/lib/openai/models/realtime/realtime_translation_input_transcript_delta_event.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Realtime + class RealtimeTranslationInputTranscriptDeltaEvent < OpenAI::Internal::Type::BaseModel + # @!attribute delta + # Append-only source-language transcript text. + # + # @return [String] + required :delta, String + + # @!attribute event_id + # The unique ID of the server event. + # + # @return [String] + required :event_id, String + + # @!attribute type + # The event type, must be `session.input_transcript.delta`. + # + # @return [Symbol, :"session.input_transcript.delta"] + required :type, const: :"session.input_transcript.delta" + + # @!attribute elapsed_ms + # Timing metadata for stream alignment, derived from the translation frame when + # available. It advances in 200 ms increments, but multiple transcript deltas may + # share the same `elapsed_ms`. Treat it as alignment metadata, not a unique + # transcript-delta identifier. + # + # @return [Integer, nil] + optional :elapsed_ms, Integer, nil?: true + + # @!method initialize(delta:, event_id:, elapsed_ms: nil, type: :"session.input_transcript.delta") + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Realtime::RealtimeTranslationInputTranscriptDeltaEvent} for + # more details. + # + # Returned when optional source-language transcript text is available. This event + # is emitted only when `audio.input.transcription` is configured. + # + # Transcript deltas are append-only text fragments. Clients should not insert + # unconditional spaces between deltas. + # + # @param delta [String] Append-only source-language transcript text. + # + # @param event_id [String] The unique ID of the server event. + # + # @param elapsed_ms [Integer, nil] Timing metadata for stream alignment, derived from the translation frame + # + # @param type [Symbol, :"session.input_transcript.delta"] The event type, must be `session.input_transcript.delta`. + end + end + end +end diff --git a/lib/openai/models/realtime/realtime_translation_output_audio_delta_event.rb b/lib/openai/models/realtime/realtime_translation_output_audio_delta_event.rb new file mode 100644 index 00000000..2b0d67a3 --- /dev/null +++ b/lib/openai/models/realtime/realtime_translation_output_audio_delta_event.rb @@ -0,0 +1,89 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Realtime + class RealtimeTranslationOutputAudioDeltaEvent < OpenAI::Internal::Type::BaseModel + # @!attribute delta + # Base64-encoded translated audio data. + # + # @return [String] + required :delta, String + + # @!attribute event_id + # The unique ID of the server event. + # + # @return [String] + required :event_id, String + + # @!attribute type + # The event type, must be `session.output_audio.delta`. + # + # @return [Symbol, :"session.output_audio.delta"] + required :type, const: :"session.output_audio.delta" + + # @!attribute channels + # Number of audio channels. + # + # @return [Integer, nil] + optional :channels, Integer + + # @!attribute elapsed_ms + # Timing metadata for stream alignment, derived from the translation frame when + # available. Treat `elapsed_ms` as alignment metadata, not a unique event + # identifier. + # + # @return [Integer, nil] + optional :elapsed_ms, Integer, nil?: true + + # @!attribute format_ + # Audio encoding for `delta`. + # + # @return [Symbol, OpenAI::Models::Realtime::RealtimeTranslationOutputAudioDeltaEvent::Format, nil] + optional :format_, + enum: -> { OpenAI::Realtime::RealtimeTranslationOutputAudioDeltaEvent::Format }, + api_name: :format + + # @!attribute sample_rate + # Sample rate of the audio delta. + # + # @return [Integer, nil] + optional :sample_rate, Integer + + # @!method initialize(delta:, event_id:, channels: nil, elapsed_ms: nil, format_: nil, sample_rate: nil, type: :"session.output_audio.delta") + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Realtime::RealtimeTranslationOutputAudioDeltaEvent} for more + # details. + # + # Returned when translated output audio is available. Output audio deltas are 200 + # ms frames of PCM16 audio. + # + # @param delta [String] Base64-encoded translated audio data. + # + # @param event_id [String] The unique ID of the server event. + # + # @param channels [Integer] Number of audio channels. + # + # @param elapsed_ms [Integer, nil] Timing metadata for stream alignment, derived from the translation frame + # + # @param format_ [Symbol, OpenAI::Models::Realtime::RealtimeTranslationOutputAudioDeltaEvent::Format] Audio encoding for `delta`. + # + # @param sample_rate [Integer] Sample rate of the audio delta. + # + # @param type [Symbol, :"session.output_audio.delta"] The event type, must be `session.output_audio.delta`. + + # Audio encoding for `delta`. + # + # @see OpenAI::Models::Realtime::RealtimeTranslationOutputAudioDeltaEvent#format_ + module Format + extend OpenAI::Internal::Type::Enum + + PCM16 = :pcm16 + + # @!method self.values + # @return [Array] + end + end + end + end +end diff --git a/lib/openai/models/realtime/realtime_translation_output_transcript_delta_event.rb b/lib/openai/models/realtime/realtime_translation_output_transcript_delta_event.rb new file mode 100644 index 00000000..ad26de0d --- /dev/null +++ b/lib/openai/models/realtime/realtime_translation_output_transcript_delta_event.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Realtime + class RealtimeTranslationOutputTranscriptDeltaEvent < OpenAI::Internal::Type::BaseModel + # @!attribute delta + # Append-only transcript text for the translated output audio. + # + # @return [String] + required :delta, String + + # @!attribute event_id + # The unique ID of the server event. + # + # @return [String] + required :event_id, String + + # @!attribute type + # The event type, must be `session.output_transcript.delta`. + # + # @return [Symbol, :"session.output_transcript.delta"] + required :type, const: :"session.output_transcript.delta" + + # @!attribute elapsed_ms + # Timing metadata for stream alignment, derived from the translation frame when + # available. It advances in 200 ms increments, but multiple transcript deltas may + # share the same `elapsed_ms`. Treat it as alignment metadata, not a unique + # transcript-delta identifier. + # + # @return [Integer, nil] + optional :elapsed_ms, Integer, nil?: true + + # @!method initialize(delta:, event_id:, elapsed_ms: nil, type: :"session.output_transcript.delta") + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Realtime::RealtimeTranslationOutputTranscriptDeltaEvent} for + # more details. + # + # Returned when translated transcript text is available. + # + # Transcript deltas are append-only text fragments. Clients should not insert + # unconditional spaces between deltas. + # + # @param delta [String] Append-only transcript text for the translated output audio. + # + # @param event_id [String] The unique ID of the server event. + # + # @param elapsed_ms [Integer, nil] Timing metadata for stream alignment, derived from the translation frame + # + # @param type [Symbol, :"session.output_transcript.delta"] The event type, must be `session.output_transcript.delta`. + end + end + end +end diff --git a/lib/openai/models/realtime/realtime_translation_server_event.rb b/lib/openai/models/realtime/realtime_translation_server_event.rb new file mode 100644 index 00000000..cc4569c7 --- /dev/null +++ b/lib/openai/models/realtime/realtime_translation_server_event.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Realtime + # A Realtime translation server event. + module RealtimeTranslationServerEvent + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Returned when an error occurs, which could be a client problem or a server + # problem. Most errors are recoverable and the session will stay open, we + # recommend to implementors to monitor and log error messages by default. + variant :error, -> { OpenAI::Realtime::RealtimeErrorEvent } + + # Returned when a translation session is created. Emitted automatically when a + # new connection is established as the first server event. This event contains + # the default translation session configuration. + variant :"session.created", -> { OpenAI::Realtime::RealtimeTranslationSessionCreatedEvent } + + # Returned when a translation session is updated with a `session.update` event, + # unless there is an error. + variant :"session.updated", -> { OpenAI::Realtime::RealtimeTranslationSessionUpdatedEvent } + + # Returned when a realtime translation session is closed. + variant :"session.closed", -> { OpenAI::Realtime::RealtimeTranslationSessionClosedEvent } + + # Returned when optional source-language transcript text is available. This event + # is emitted only when `audio.input.transcription` is configured. + # + # Transcript deltas are append-only text fragments. Clients should not insert + # unconditional spaces between deltas. + variant :"session.input_transcript.delta", + -> { OpenAI::Realtime::RealtimeTranslationInputTranscriptDeltaEvent } + + # Returned when translated transcript text is available. + # + # Transcript deltas are append-only text fragments. Clients should not insert + # unconditional spaces between deltas. + variant :"session.output_transcript.delta", + -> { OpenAI::Realtime::RealtimeTranslationOutputTranscriptDeltaEvent } + + # Returned when translated output audio is available. Output audio deltas are + # 200 ms frames of PCM16 audio. + variant :"session.output_audio.delta", -> { OpenAI::Realtime::RealtimeTranslationOutputAudioDeltaEvent } + + # @!method self.variants + # @return [Array(OpenAI::Models::Realtime::RealtimeErrorEvent, OpenAI::Models::Realtime::RealtimeTranslationSessionCreatedEvent, OpenAI::Models::Realtime::RealtimeTranslationSessionUpdatedEvent, OpenAI::Models::Realtime::RealtimeTranslationSessionClosedEvent, OpenAI::Models::Realtime::RealtimeTranslationInputTranscriptDeltaEvent, OpenAI::Models::Realtime::RealtimeTranslationOutputTranscriptDeltaEvent, OpenAI::Models::Realtime::RealtimeTranslationOutputAudioDeltaEvent)] + end + end + end +end diff --git a/lib/openai/models/realtime/realtime_translation_session.rb b/lib/openai/models/realtime/realtime_translation_session.rb new file mode 100644 index 00000000..e7855200 --- /dev/null +++ b/lib/openai/models/realtime/realtime_translation_session.rb @@ -0,0 +1,158 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Realtime + class RealtimeTranslationSession < OpenAI::Internal::Type::BaseModel + # @!attribute id + # Unique identifier for the session that looks like `sess_1234567890abcdef`. + # + # @return [String] + required :id, String + + # @!attribute audio + # Configuration for translation input and output audio. + # + # @return [OpenAI::Models::Realtime::RealtimeTranslationSession::Audio] + required :audio, -> { OpenAI::Realtime::RealtimeTranslationSession::Audio } + + # @!attribute expires_at + # Expiration timestamp for the session, in seconds since epoch. + # + # @return [Integer] + required :expires_at, Integer + + # @!attribute model + # The Realtime translation model used for this session. This field is set at + # session creation and cannot be changed with `session.update`. + # + # @return [String] + required :model, String + + # @!attribute type + # The session type. Always `translation` for Realtime translation sessions. + # + # @return [Symbol, :translation] + required :type, const: :translation + + # @!method initialize(id:, audio:, expires_at:, model:, type: :translation) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Realtime::RealtimeTranslationSession} for more details. + # + # A Realtime translation session. Translation sessions continuously translate + # input audio into the configured output language. + # + # @param id [String] Unique identifier for the session that looks like `sess_1234567890abcdef`. + # + # @param audio [OpenAI::Models::Realtime::RealtimeTranslationSession::Audio] Configuration for translation input and output audio. + # + # @param expires_at [Integer] Expiration timestamp for the session, in seconds since epoch. + # + # @param model [String] The Realtime translation model used for this session. This field is set at + # + # @param type [Symbol, :translation] The session type. Always `translation` for Realtime translation sessions. + + # @see OpenAI::Models::Realtime::RealtimeTranslationSession#audio + class Audio < OpenAI::Internal::Type::BaseModel + # @!attribute input + # + # @return [OpenAI::Models::Realtime::RealtimeTranslationSession::Audio::Input, nil] + optional :input, -> { OpenAI::Realtime::RealtimeTranslationSession::Audio::Input } + + # @!attribute output + # + # @return [OpenAI::Models::Realtime::RealtimeTranslationSession::Audio::Output, nil] + optional :output, -> { OpenAI::Realtime::RealtimeTranslationSession::Audio::Output } + + # @!method initialize(input: nil, output: nil) + # Configuration for translation input and output audio. + # + # @param input [OpenAI::Models::Realtime::RealtimeTranslationSession::Audio::Input] + # @param output [OpenAI::Models::Realtime::RealtimeTranslationSession::Audio::Output] + + # @see OpenAI::Models::Realtime::RealtimeTranslationSession::Audio#input + class Input < OpenAI::Internal::Type::BaseModel + # @!attribute noise_reduction + # Optional input noise reduction. + # + # @return [OpenAI::Models::Realtime::RealtimeTranslationSession::Audio::Input::NoiseReduction, nil] + optional :noise_reduction, + -> { OpenAI::Realtime::RealtimeTranslationSession::Audio::Input::NoiseReduction }, + nil?: true + + # @!attribute transcription + # Optional source-language transcription. When configured, the server emits + # `session.input_transcript.delta` events. Translation itself still runs from the + # input audio stream. + # + # @return [OpenAI::Models::Realtime::RealtimeTranslationSession::Audio::Input::Transcription, nil] + optional :transcription, + -> { OpenAI::Realtime::RealtimeTranslationSession::Audio::Input::Transcription }, + nil?: true + + # @!method initialize(noise_reduction: nil, transcription: nil) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Realtime::RealtimeTranslationSession::Audio::Input} for more + # details. + # + # @param noise_reduction [OpenAI::Models::Realtime::RealtimeTranslationSession::Audio::Input::NoiseReduction, nil] Optional input noise reduction. + # + # @param transcription [OpenAI::Models::Realtime::RealtimeTranslationSession::Audio::Input::Transcription, nil] Optional source-language transcription. When configured, the server emits + + # @see OpenAI::Models::Realtime::RealtimeTranslationSession::Audio::Input#noise_reduction + class NoiseReduction < OpenAI::Internal::Type::BaseModel + # @!attribute type + # Type of noise reduction. `near_field` is for close-talking microphones such as + # headphones, `far_field` is for far-field microphones such as laptop or + # conference room microphones. + # + # @return [Symbol, OpenAI::Models::Realtime::NoiseReductionType] + required :type, enum: -> { OpenAI::Realtime::NoiseReductionType } + + # @!method initialize(type:) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Realtime::RealtimeTranslationSession::Audio::Input::NoiseReduction} + # for more details. + # + # Optional input noise reduction. + # + # @param type [Symbol, OpenAI::Models::Realtime::NoiseReductionType] Type of noise reduction. `near_field` is for close-talking microphones such as h + end + + # @see OpenAI::Models::Realtime::RealtimeTranslationSession::Audio::Input#transcription + class Transcription < OpenAI::Internal::Type::BaseModel + # @!attribute model + # The transcription model used for source transcript deltas. + # + # @return [String] + required :model, String + + # @!method initialize(model:) + # Optional source-language transcription. When configured, the server emits + # `session.input_transcript.delta` events. Translation itself still runs from the + # input audio stream. + # + # @param model [String] The transcription model used for source transcript deltas. + end + end + + # @see OpenAI::Models::Realtime::RealtimeTranslationSession::Audio#output + class Output < OpenAI::Internal::Type::BaseModel + # @!attribute language + # Target language for translated output audio and transcript deltas. + # + # @return [String, nil] + optional :language, String + + # @!method initialize(language: nil) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Realtime::RealtimeTranslationSession::Audio::Output} for more + # details. + # + # @param language [String] Target language for translated output audio and transcript deltas. + end + end + end + end + end +end diff --git a/lib/openai/models/realtime/realtime_translation_session_close_event.rb b/lib/openai/models/realtime/realtime_translation_session_close_event.rb new file mode 100644 index 00000000..d73347bf --- /dev/null +++ b/lib/openai/models/realtime/realtime_translation_session_close_event.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Realtime + class RealtimeTranslationSessionCloseEvent < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The event type, must be `session.close`. + # + # @return [Symbol, :"session.close"] + required :type, const: :"session.close" + + # @!attribute event_id + # Optional client-generated ID used to identify this event. + # + # @return [String, nil] + optional :event_id, String + + # @!method initialize(event_id: nil, type: :"session.close") + # Gracefully close the realtime translation session. The server flushes pending + # input audio and emits any remaining translated output before closing the + # session. + # + # @param event_id [String] Optional client-generated ID used to identify this event. + # + # @param type [Symbol, :"session.close"] The event type, must be `session.close`. + end + end + end +end diff --git a/lib/openai/models/realtime/realtime_translation_session_closed_event.rb b/lib/openai/models/realtime/realtime_translation_session_closed_event.rb new file mode 100644 index 00000000..9061cf85 --- /dev/null +++ b/lib/openai/models/realtime/realtime_translation_session_closed_event.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Realtime + class RealtimeTranslationSessionClosedEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the server event. + # + # @return [String] + required :event_id, String + + # @!attribute type + # The event type, must be `session.closed`. + # + # @return [Symbol, :"session.closed"] + required :type, const: :"session.closed" + + # @!method initialize(event_id:, type: :"session.closed") + # Returned when a realtime translation session is closed. + # + # @param event_id [String] The unique ID of the server event. + # + # @param type [Symbol, :"session.closed"] The event type, must be `session.closed`. + end + end + end +end diff --git a/lib/openai/models/realtime/realtime_translation_session_create_request.rb b/lib/openai/models/realtime/realtime_translation_session_create_request.rb new file mode 100644 index 00000000..05d3cfc5 --- /dev/null +++ b/lib/openai/models/realtime/realtime_translation_session_create_request.rb @@ -0,0 +1,138 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Realtime + class RealtimeTranslationSessionCreateRequest < OpenAI::Internal::Type::BaseModel + # @!attribute model + # The Realtime translation model used for this session. + # + # @return [String] + required :model, String + + # @!attribute audio + # Configuration for translation input and output audio. + # + # @return [OpenAI::Models::Realtime::RealtimeTranslationSessionCreateRequest::Audio, nil] + optional :audio, -> { OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio } + + # @!method initialize(model:, audio: nil) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Realtime::RealtimeTranslationSessionCreateRequest} for more + # details. + # + # Realtime translation session configuration. Translation sessions stream source + # audio in and translated audio plus transcript deltas out continuously. + # + # @param model [String] The Realtime translation model used for this session. + # + # @param audio [OpenAI::Models::Realtime::RealtimeTranslationSessionCreateRequest::Audio] Configuration for translation input and output audio. + + # @see OpenAI::Models::Realtime::RealtimeTranslationSessionCreateRequest#audio + class Audio < OpenAI::Internal::Type::BaseModel + # @!attribute input + # + # @return [OpenAI::Models::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input, nil] + optional :input, -> { OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input } + + # @!attribute output + # + # @return [OpenAI::Models::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Output, nil] + optional :output, -> { OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Output } + + # @!method initialize(input: nil, output: nil) + # Configuration for translation input and output audio. + # + # @param input [OpenAI::Models::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input] + # @param output [OpenAI::Models::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Output] + + # @see OpenAI::Models::Realtime::RealtimeTranslationSessionCreateRequest::Audio#input + class Input < OpenAI::Internal::Type::BaseModel + # @!attribute noise_reduction + # Optional input noise reduction. Set to `null` to disable it. + # + # @return [OpenAI::Models::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::NoiseReduction, nil] + optional :noise_reduction, + -> { + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::NoiseReduction + }, + nil?: true + + # @!attribute transcription + # Optional source-language transcription. When configured, the server emits + # `session.input_transcript.delta` events. Translation itself still runs from the + # input audio stream. + # + # @return [OpenAI::Models::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::Transcription, nil] + optional :transcription, + -> { + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::Transcription + }, + nil?: true + + # @!method initialize(noise_reduction: nil, transcription: nil) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input} + # for more details. + # + # @param noise_reduction [OpenAI::Models::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::NoiseReduction, nil] Optional input noise reduction. Set to `null` to disable it. + # + # @param transcription [OpenAI::Models::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::Transcription, nil] Optional source-language transcription. When configured, the server emits + + # @see OpenAI::Models::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input#noise_reduction + class NoiseReduction < OpenAI::Internal::Type::BaseModel + # @!attribute type + # Type of noise reduction. `near_field` is for close-talking microphones such as + # headphones, `far_field` is for far-field microphones such as laptop or + # conference room microphones. + # + # @return [Symbol, OpenAI::Models::Realtime::NoiseReductionType] + required :type, enum: -> { OpenAI::Realtime::NoiseReductionType } + + # @!method initialize(type:) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::NoiseReduction} + # for more details. + # + # Optional input noise reduction. Set to `null` to disable it. + # + # @param type [Symbol, OpenAI::Models::Realtime::NoiseReductionType] Type of noise reduction. `near_field` is for close-talking microphones such as h + end + + # @see OpenAI::Models::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input#transcription + class Transcription < OpenAI::Internal::Type::BaseModel + # @!attribute model + # The transcription model to use for source transcript deltas. + # + # @return [String] + required :model, String + + # @!method initialize(model:) + # Optional source-language transcription. When configured, the server emits + # `session.input_transcript.delta` events. Translation itself still runs from the + # input audio stream. + # + # @param model [String] The transcription model to use for source transcript deltas. + end + end + + # @see OpenAI::Models::Realtime::RealtimeTranslationSessionCreateRequest::Audio#output + class Output < OpenAI::Internal::Type::BaseModel + # @!attribute language + # Target language for translated output audio and transcript deltas. + # + # @return [String, nil] + optional :language, String + + # @!method initialize(language: nil) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Output} + # for more details. + # + # @param language [String] Target language for translated output audio and transcript deltas. + end + end + end + end + end +end diff --git a/lib/openai/models/realtime/realtime_translation_session_created_event.rb b/lib/openai/models/realtime/realtime_translation_session_created_event.rb new file mode 100644 index 00000000..f6b3b693 --- /dev/null +++ b/lib/openai/models/realtime/realtime_translation_session_created_event.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Realtime + class RealtimeTranslationSessionCreatedEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the server event. + # + # @return [String] + required :event_id, String + + # @!attribute session + # The translation session configuration. + # + # @return [OpenAI::Models::Realtime::RealtimeTranslationSession] + required :session, -> { OpenAI::Realtime::RealtimeTranslationSession } + + # @!attribute type + # The event type, must be `session.created`. + # + # @return [Symbol, :"session.created"] + required :type, const: :"session.created" + + # @!method initialize(event_id:, session:, type: :"session.created") + # Returned when a translation session is created. Emitted automatically when a new + # connection is established as the first server event. This event contains the + # default translation session configuration. + # + # @param event_id [String] The unique ID of the server event. + # + # @param session [OpenAI::Models::Realtime::RealtimeTranslationSession] The translation session configuration. + # + # @param type [Symbol, :"session.created"] The event type, must be `session.created`. + end + end + end +end diff --git a/lib/openai/models/realtime/realtime_translation_session_update_event.rb b/lib/openai/models/realtime/realtime_translation_session_update_event.rb new file mode 100644 index 00000000..0ca5525b --- /dev/null +++ b/lib/openai/models/realtime/realtime_translation_session_update_event.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Realtime + class RealtimeTranslationSessionUpdateEvent < OpenAI::Internal::Type::BaseModel + # @!attribute session + # Translation session fields to update. The session `type` and `model` are set at + # creation and cannot be changed with `session.update`. + # + # @return [OpenAI::Models::Realtime::RealtimeTranslationSessionUpdateRequest] + required :session, -> { OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest } + + # @!attribute type + # The event type, must be `session.update`. + # + # @return [Symbol, :"session.update"] + required :type, const: :"session.update" + + # @!attribute event_id + # Optional client-generated ID used to identify this event. + # + # @return [String, nil] + optional :event_id, String + + # @!method initialize(session:, event_id: nil, type: :"session.update") + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Realtime::RealtimeTranslationSessionUpdateEvent} for more + # details. + # + # Send this event to update the translation session configuration. Translation + # sessions support updates to `audio.output.language`, + # `audio.input.transcription`, and `audio.input.noise_reduction`. + # + # @param session [OpenAI::Models::Realtime::RealtimeTranslationSessionUpdateRequest] Translation session fields to update. The session `type` and `model` are set + # + # @param event_id [String] Optional client-generated ID used to identify this event. + # + # @param type [Symbol, :"session.update"] The event type, must be `session.update`. + end + end + end +end diff --git a/lib/openai/models/realtime/realtime_translation_session_update_request.rb b/lib/openai/models/realtime/realtime_translation_session_update_request.rb new file mode 100644 index 00000000..05bd6d45 --- /dev/null +++ b/lib/openai/models/realtime/realtime_translation_session_update_request.rb @@ -0,0 +1,129 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Realtime + class RealtimeTranslationSessionUpdateRequest < OpenAI::Internal::Type::BaseModel + # @!attribute audio + # Configuration for translation input and output audio. + # + # @return [OpenAI::Models::Realtime::RealtimeTranslationSessionUpdateRequest::Audio, nil] + optional :audio, -> { OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio } + + # @!method initialize(audio: nil) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Realtime::RealtimeTranslationSessionUpdateRequest} for more + # details. + # + # Realtime translation session fields that can be updated with `session.update`. + # + # @param audio [OpenAI::Models::Realtime::RealtimeTranslationSessionUpdateRequest::Audio] Configuration for translation input and output audio. + + # @see OpenAI::Models::Realtime::RealtimeTranslationSessionUpdateRequest#audio + class Audio < OpenAI::Internal::Type::BaseModel + # @!attribute input + # + # @return [OpenAI::Models::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input, nil] + optional :input, -> { OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input } + + # @!attribute output + # + # @return [OpenAI::Models::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Output, nil] + optional :output, -> { OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Output } + + # @!method initialize(input: nil, output: nil) + # Configuration for translation input and output audio. + # + # @param input [OpenAI::Models::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input] + # @param output [OpenAI::Models::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Output] + + # @see OpenAI::Models::Realtime::RealtimeTranslationSessionUpdateRequest::Audio#input + class Input < OpenAI::Internal::Type::BaseModel + # @!attribute noise_reduction + # Optional input noise reduction. Set to `null` to disable it. + # + # @return [OpenAI::Models::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::NoiseReduction, nil] + optional :noise_reduction, + -> { + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::NoiseReduction + }, + nil?: true + + # @!attribute transcription + # Optional source-language transcription. When configured, the server emits + # `session.input_transcript.delta` events. Translation itself still runs from the + # input audio stream. + # + # @return [OpenAI::Models::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::Transcription, nil] + optional :transcription, + -> { + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::Transcription + }, + nil?: true + + # @!method initialize(noise_reduction: nil, transcription: nil) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input} + # for more details. + # + # @param noise_reduction [OpenAI::Models::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::NoiseReduction, nil] Optional input noise reduction. Set to `null` to disable it. + # + # @param transcription [OpenAI::Models::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::Transcription, nil] Optional source-language transcription. When configured, the server emits + + # @see OpenAI::Models::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input#noise_reduction + class NoiseReduction < OpenAI::Internal::Type::BaseModel + # @!attribute type + # Type of noise reduction. `near_field` is for close-talking microphones such as + # headphones, `far_field` is for far-field microphones such as laptop or + # conference room microphones. + # + # @return [Symbol, OpenAI::Models::Realtime::NoiseReductionType] + required :type, enum: -> { OpenAI::Realtime::NoiseReductionType } + + # @!method initialize(type:) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::NoiseReduction} + # for more details. + # + # Optional input noise reduction. Set to `null` to disable it. + # + # @param type [Symbol, OpenAI::Models::Realtime::NoiseReductionType] Type of noise reduction. `near_field` is for close-talking microphones such as h + end + + # @see OpenAI::Models::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input#transcription + class Transcription < OpenAI::Internal::Type::BaseModel + # @!attribute model + # The transcription model to use for source transcript deltas. + # + # @return [String] + required :model, String + + # @!method initialize(model:) + # Optional source-language transcription. When configured, the server emits + # `session.input_transcript.delta` events. Translation itself still runs from the + # input audio stream. + # + # @param model [String] The transcription model to use for source transcript deltas. + end + end + + # @see OpenAI::Models::Realtime::RealtimeTranslationSessionUpdateRequest::Audio#output + class Output < OpenAI::Internal::Type::BaseModel + # @!attribute language + # Target language for translated output audio and transcript deltas. + # + # @return [String, nil] + optional :language, String + + # @!method initialize(language: nil) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Output} + # for more details. + # + # @param language [String] Target language for translated output audio and transcript deltas. + end + end + end + end + end +end diff --git a/lib/openai/models/realtime/realtime_translation_session_updated_event.rb b/lib/openai/models/realtime/realtime_translation_session_updated_event.rb new file mode 100644 index 00000000..2b26248a --- /dev/null +++ b/lib/openai/models/realtime/realtime_translation_session_updated_event.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Realtime + class RealtimeTranslationSessionUpdatedEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the server event. + # + # @return [String] + required :event_id, String + + # @!attribute session + # The translation session configuration. + # + # @return [OpenAI::Models::Realtime::RealtimeTranslationSession] + required :session, -> { OpenAI::Realtime::RealtimeTranslationSession } + + # @!attribute type + # The event type, must be `session.updated`. + # + # @return [Symbol, :"session.updated"] + required :type, const: :"session.updated" + + # @!method initialize(event_id:, session:, type: :"session.updated") + # Returned when a translation session is updated with a `session.update` event, + # unless there is an error. + # + # @param event_id [String] The unique ID of the server event. + # + # @param session [OpenAI::Models::Realtime::RealtimeTranslationSession] The translation session configuration. + # + # @param type [Symbol, :"session.updated"] The event type, must be `session.updated`. + end + end + end +end diff --git a/rbi/openai/models/realtime/realtime_translation_client_event.rbi b/rbi/openai/models/realtime/realtime_translation_client_event.rbi new file mode 100644 index 00000000..c2cc1843 --- /dev/null +++ b/rbi/openai/models/realtime/realtime_translation_client_event.rbi @@ -0,0 +1,29 @@ +# typed: strong + +module OpenAI + module Models + module Realtime + # A Realtime translation client event. + module RealtimeTranslationClientEvent + extend OpenAI::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationSessionUpdateEvent, + OpenAI::Realtime::RealtimeTranslationInputAudioBufferAppendEvent, + OpenAI::Realtime::RealtimeTranslationSessionCloseEvent + ) + end + + sig do + override.returns( + T::Array[OpenAI::Realtime::RealtimeTranslationClientEvent::Variants] + ) + end + def self.variants + end + end + end + end +end diff --git a/rbi/openai/models/realtime/realtime_translation_client_secret_create_request.rbi b/rbi/openai/models/realtime/realtime_translation_client_secret_create_request.rbi new file mode 100644 index 00000000..77ad3423 --- /dev/null +++ b/rbi/openai/models/realtime/realtime_translation_client_secret_create_request.rbi @@ -0,0 +1,193 @@ +# typed: strong + +module OpenAI + module Models + module Realtime + class RealtimeTranslationClientSecretCreateRequest < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest, + OpenAI::Internal::AnyHash + ) + end + + # Realtime translation session configuration. Translation sessions stream source + # audio in and translated audio plus transcript deltas out continuously. + sig do + returns(OpenAI::Realtime::RealtimeTranslationSessionCreateRequest) + end + attr_reader :session + + sig do + params( + session: + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::OrHash + ).void + end + attr_writer :session + + # Configuration for the client secret expiration. Expiration refers to the time + # after which a client secret will no longer be valid for creating sessions. The + # session itself may continue after that time once started. A secret can be used + # to create multiple sessions until it expires. + sig do + returns( + T.nilable( + OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter + ) + ) + end + attr_reader :expires_after + + sig do + params( + expires_after: + OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::OrHash + ).void + end + attr_writer :expires_after + + # Create a translation session and client secret for the Realtime API. + sig do + params( + session: + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::OrHash, + expires_after: + OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::OrHash + ).returns(T.attached_class) + end + def self.new( + # Realtime translation session configuration. Translation sessions stream source + # audio in and translated audio plus transcript deltas out continuously. + session:, + # Configuration for the client secret expiration. Expiration refers to the time + # after which a client secret will no longer be valid for creating sessions. The + # session itself may continue after that time once started. A secret can be used + # to create multiple sessions until it expires. + expires_after: nil + ) + end + + sig do + override.returns( + { + session: + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest, + expires_after: + OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter + } + ) + end + def to_hash + end + + class ExpiresAfter < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter, + OpenAI::Internal::AnyHash + ) + end + + # The anchor point for the client secret expiration, meaning that `seconds` will + # be added to the `created_at` time of the client secret to produce an expiration + # timestamp. Only `created_at` is currently supported. + sig do + returns( + T.nilable( + OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::Anchor::OrSymbol + ) + ) + end + attr_reader :anchor + + sig do + params( + anchor: + OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::Anchor::OrSymbol + ).void + end + attr_writer :anchor + + # The number of seconds from the anchor point to the expiration. Select a value + # between `10` and `7200` (2 hours). This default to 600 seconds (10 minutes) if + # not specified. + sig { returns(T.nilable(Integer)) } + attr_reader :seconds + + sig { params(seconds: Integer).void } + attr_writer :seconds + + # Configuration for the client secret expiration. Expiration refers to the time + # after which a client secret will no longer be valid for creating sessions. The + # session itself may continue after that time once started. A secret can be used + # to create multiple sessions until it expires. + sig do + params( + anchor: + OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::Anchor::OrSymbol, + seconds: Integer + ).returns(T.attached_class) + end + def self.new( + # The anchor point for the client secret expiration, meaning that `seconds` will + # be added to the `created_at` time of the client secret to produce an expiration + # timestamp. Only `created_at` is currently supported. + anchor: nil, + # The number of seconds from the anchor point to the expiration. Select a value + # between `10` and `7200` (2 hours). This default to 600 seconds (10 minutes) if + # not specified. + seconds: nil + ) + end + + sig do + override.returns( + { + anchor: + OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::Anchor::OrSymbol, + seconds: Integer + } + ) + end + def to_hash + end + + # The anchor point for the client secret expiration, meaning that `seconds` will + # be added to the `created_at` time of the client secret to produce an expiration + # timestamp. Only `created_at` is currently supported. + module Anchor + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::Anchor + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + CREATED_AT = + T.let( + :created_at, + OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::Anchor::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::Anchor::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + end + end +end diff --git a/rbi/openai/models/realtime/realtime_translation_client_secret_create_response.rbi b/rbi/openai/models/realtime/realtime_translation_client_secret_create_response.rbi new file mode 100644 index 00000000..22149ffb --- /dev/null +++ b/rbi/openai/models/realtime/realtime_translation_client_secret_create_response.rbi @@ -0,0 +1,69 @@ +# typed: strong + +module OpenAI + module Models + module Realtime + class RealtimeTranslationClientSecretCreateResponse < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationClientSecretCreateResponse, + OpenAI::Internal::AnyHash + ) + end + + # Expiration timestamp for the client secret, in seconds since epoch. + sig { returns(Integer) } + attr_accessor :expires_at + + # A Realtime translation session. Translation sessions continuously translate + # input audio into the configured output language. + sig { returns(OpenAI::Realtime::RealtimeTranslationSession) } + attr_reader :session + + sig do + params( + session: OpenAI::Realtime::RealtimeTranslationSession::OrHash + ).void + end + attr_writer :session + + # The generated client secret value. + sig { returns(String) } + attr_accessor :value + + # Response from creating a translation session and client secret for the Realtime + # API. + sig do + params( + expires_at: Integer, + session: OpenAI::Realtime::RealtimeTranslationSession::OrHash, + value: String + ).returns(T.attached_class) + end + def self.new( + # Expiration timestamp for the client secret, in seconds since epoch. + expires_at:, + # A Realtime translation session. Translation sessions continuously translate + # input audio into the configured output language. + session:, + # The generated client secret value. + value: + ) + end + + sig do + override.returns( + { + expires_at: Integer, + session: OpenAI::Realtime::RealtimeTranslationSession, + value: String + } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/openai/models/realtime/realtime_translation_input_audio_buffer_append_event.rbi b/rbi/openai/models/realtime/realtime_translation_input_audio_buffer_append_event.rbi new file mode 100644 index 00000000..6fb681ed --- /dev/null +++ b/rbi/openai/models/realtime/realtime_translation_input_audio_buffer_append_event.rbi @@ -0,0 +1,69 @@ +# typed: strong + +module OpenAI + module Models + module Realtime + class RealtimeTranslationInputAudioBufferAppendEvent < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationInputAudioBufferAppendEvent, + OpenAI::Internal::AnyHash + ) + end + + # Base64-encoded 24 kHz PCM16 mono audio bytes. + sig { returns(String) } + attr_accessor :audio + + # The event type, must be `session.input_audio_buffer.append`. + sig { returns(Symbol) } + attr_accessor :type + + # Optional client-generated ID used to identify this event. + sig { returns(T.nilable(String)) } + attr_reader :event_id + + sig { params(event_id: String).void } + attr_writer :event_id + + # Send this event to append audio bytes to the translation session input audio + # buffer. + # + # WebSocket translation sessions accept base64-encoded 24 kHz PCM16 mono + # little-endian raw audio bytes. Unsupported websocket audio formats return a + # validation error because lower-quality audio materially degrades translation + # quality. + # + # Translation consumes 200 ms engine frames. For best realtime behavior, append + # audio in 200 ms chunks. If a chunk is shorter, the server buffers it until it + # has enough audio for one frame. If a chunk is longer, the server splits it into + # 200 ms frames and enqueues them back-to-back. + # + # Keep appending silence while the session is active. If a client stops sending + # audio and later resumes, model time treats the resumed audio as contiguous with + # the previous audio rather than as a real-world pause. + sig do + params(audio: String, event_id: String, type: Symbol).returns( + T.attached_class + ) + end + def self.new( + # Base64-encoded 24 kHz PCM16 mono audio bytes. + audio:, + # Optional client-generated ID used to identify this event. + event_id: nil, + # The event type, must be `session.input_audio_buffer.append`. + type: :"session.input_audio_buffer.append" + ) + end + + sig do + override.returns({ audio: String, type: Symbol, event_id: String }) + end + def to_hash + end + end + end + end +end diff --git a/rbi/openai/models/realtime/realtime_translation_input_transcript_delta_event.rbi b/rbi/openai/models/realtime/realtime_translation_input_transcript_delta_event.rbi new file mode 100644 index 00000000..e5df15eb --- /dev/null +++ b/rbi/openai/models/realtime/realtime_translation_input_transcript_delta_event.rbi @@ -0,0 +1,77 @@ +# typed: strong + +module OpenAI + module Models + module Realtime + class RealtimeTranslationInputTranscriptDeltaEvent < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationInputTranscriptDeltaEvent, + OpenAI::Internal::AnyHash + ) + end + + # Append-only source-language transcript text. + sig { returns(String) } + attr_accessor :delta + + # The unique ID of the server event. + sig { returns(String) } + attr_accessor :event_id + + # The event type, must be `session.input_transcript.delta`. + sig { returns(Symbol) } + attr_accessor :type + + # Timing metadata for stream alignment, derived from the translation frame when + # available. It advances in 200 ms increments, but multiple transcript deltas may + # share the same `elapsed_ms`. Treat it as alignment metadata, not a unique + # transcript-delta identifier. + sig { returns(T.nilable(Integer)) } + attr_accessor :elapsed_ms + + # Returned when optional source-language transcript text is available. This event + # is emitted only when `audio.input.transcription` is configured. + # + # Transcript deltas are append-only text fragments. Clients should not insert + # unconditional spaces between deltas. + sig do + params( + delta: String, + event_id: String, + elapsed_ms: T.nilable(Integer), + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Append-only source-language transcript text. + delta:, + # The unique ID of the server event. + event_id:, + # Timing metadata for stream alignment, derived from the translation frame when + # available. It advances in 200 ms increments, but multiple transcript deltas may + # share the same `elapsed_ms`. Treat it as alignment metadata, not a unique + # transcript-delta identifier. + elapsed_ms: nil, + # The event type, must be `session.input_transcript.delta`. + type: :"session.input_transcript.delta" + ) + end + + sig do + override.returns( + { + delta: String, + event_id: String, + type: Symbol, + elapsed_ms: T.nilable(Integer) + } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/openai/models/realtime/realtime_translation_output_audio_delta_event.rbi b/rbi/openai/models/realtime/realtime_translation_output_audio_delta_event.rbi new file mode 100644 index 00000000..b08f1b88 --- /dev/null +++ b/rbi/openai/models/realtime/realtime_translation_output_audio_delta_event.rbi @@ -0,0 +1,148 @@ +# typed: strong + +module OpenAI + module Models + module Realtime + class RealtimeTranslationOutputAudioDeltaEvent < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationOutputAudioDeltaEvent, + OpenAI::Internal::AnyHash + ) + end + + # Base64-encoded translated audio data. + sig { returns(String) } + attr_accessor :delta + + # The unique ID of the server event. + sig { returns(String) } + attr_accessor :event_id + + # The event type, must be `session.output_audio.delta`. + sig { returns(Symbol) } + attr_accessor :type + + # Number of audio channels. + sig { returns(T.nilable(Integer)) } + attr_reader :channels + + sig { params(channels: Integer).void } + attr_writer :channels + + # Timing metadata for stream alignment, derived from the translation frame when + # available. Treat `elapsed_ms` as alignment metadata, not a unique event + # identifier. + sig { returns(T.nilable(Integer)) } + attr_accessor :elapsed_ms + + # Audio encoding for `delta`. + sig do + returns( + T.nilable( + OpenAI::Realtime::RealtimeTranslationOutputAudioDeltaEvent::Format::OrSymbol + ) + ) + end + attr_reader :format_ + + sig do + params( + format_: + OpenAI::Realtime::RealtimeTranslationOutputAudioDeltaEvent::Format::OrSymbol + ).void + end + attr_writer :format_ + + # Sample rate of the audio delta. + sig { returns(T.nilable(Integer)) } + attr_reader :sample_rate + + sig { params(sample_rate: Integer).void } + attr_writer :sample_rate + + # Returned when translated output audio is available. Output audio deltas are 200 + # ms frames of PCM16 audio. + sig do + params( + delta: String, + event_id: String, + channels: Integer, + elapsed_ms: T.nilable(Integer), + format_: + OpenAI::Realtime::RealtimeTranslationOutputAudioDeltaEvent::Format::OrSymbol, + sample_rate: Integer, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Base64-encoded translated audio data. + delta:, + # The unique ID of the server event. + event_id:, + # Number of audio channels. + channels: nil, + # Timing metadata for stream alignment, derived from the translation frame when + # available. Treat `elapsed_ms` as alignment metadata, not a unique event + # identifier. + elapsed_ms: nil, + # Audio encoding for `delta`. + format_: nil, + # Sample rate of the audio delta. + sample_rate: nil, + # The event type, must be `session.output_audio.delta`. + type: :"session.output_audio.delta" + ) + end + + sig do + override.returns( + { + delta: String, + event_id: String, + type: Symbol, + channels: Integer, + elapsed_ms: T.nilable(Integer), + format_: + OpenAI::Realtime::RealtimeTranslationOutputAudioDeltaEvent::Format::OrSymbol, + sample_rate: Integer + } + ) + end + def to_hash + end + + # Audio encoding for `delta`. + module Format + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + OpenAI::Realtime::RealtimeTranslationOutputAudioDeltaEvent::Format + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PCM16 = + T.let( + :pcm16, + OpenAI::Realtime::RealtimeTranslationOutputAudioDeltaEvent::Format::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + OpenAI::Realtime::RealtimeTranslationOutputAudioDeltaEvent::Format::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + end +end diff --git a/rbi/openai/models/realtime/realtime_translation_output_transcript_delta_event.rbi b/rbi/openai/models/realtime/realtime_translation_output_transcript_delta_event.rbi new file mode 100644 index 00000000..a5ca475f --- /dev/null +++ b/rbi/openai/models/realtime/realtime_translation_output_transcript_delta_event.rbi @@ -0,0 +1,76 @@ +# typed: strong + +module OpenAI + module Models + module Realtime + class RealtimeTranslationOutputTranscriptDeltaEvent < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationOutputTranscriptDeltaEvent, + OpenAI::Internal::AnyHash + ) + end + + # Append-only transcript text for the translated output audio. + sig { returns(String) } + attr_accessor :delta + + # The unique ID of the server event. + sig { returns(String) } + attr_accessor :event_id + + # The event type, must be `session.output_transcript.delta`. + sig { returns(Symbol) } + attr_accessor :type + + # Timing metadata for stream alignment, derived from the translation frame when + # available. It advances in 200 ms increments, but multiple transcript deltas may + # share the same `elapsed_ms`. Treat it as alignment metadata, not a unique + # transcript-delta identifier. + sig { returns(T.nilable(Integer)) } + attr_accessor :elapsed_ms + + # Returned when translated transcript text is available. + # + # Transcript deltas are append-only text fragments. Clients should not insert + # unconditional spaces between deltas. + sig do + params( + delta: String, + event_id: String, + elapsed_ms: T.nilable(Integer), + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Append-only transcript text for the translated output audio. + delta:, + # The unique ID of the server event. + event_id:, + # Timing metadata for stream alignment, derived from the translation frame when + # available. It advances in 200 ms increments, but multiple transcript deltas may + # share the same `elapsed_ms`. Treat it as alignment metadata, not a unique + # transcript-delta identifier. + elapsed_ms: nil, + # The event type, must be `session.output_transcript.delta`. + type: :"session.output_transcript.delta" + ) + end + + sig do + override.returns( + { + delta: String, + event_id: String, + type: Symbol, + elapsed_ms: T.nilable(Integer) + } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/openai/models/realtime/realtime_translation_server_event.rbi b/rbi/openai/models/realtime/realtime_translation_server_event.rbi new file mode 100644 index 00000000..a048820c --- /dev/null +++ b/rbi/openai/models/realtime/realtime_translation_server_event.rbi @@ -0,0 +1,33 @@ +# typed: strong + +module OpenAI + module Models + module Realtime + # A Realtime translation server event. + module RealtimeTranslationServerEvent + extend OpenAI::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeErrorEvent, + OpenAI::Realtime::RealtimeTranslationSessionCreatedEvent, + OpenAI::Realtime::RealtimeTranslationSessionUpdatedEvent, + OpenAI::Realtime::RealtimeTranslationSessionClosedEvent, + OpenAI::Realtime::RealtimeTranslationInputTranscriptDeltaEvent, + OpenAI::Realtime::RealtimeTranslationOutputTranscriptDeltaEvent, + OpenAI::Realtime::RealtimeTranslationOutputAudioDeltaEvent + ) + end + + sig do + override.returns( + T::Array[OpenAI::Realtime::RealtimeTranslationServerEvent::Variants] + ) + end + def self.variants + end + end + end + end +end diff --git a/rbi/openai/models/realtime/realtime_translation_session.rbi b/rbi/openai/models/realtime/realtime_translation_session.rbi new file mode 100644 index 00000000..32028ec0 --- /dev/null +++ b/rbi/openai/models/realtime/realtime_translation_session.rbi @@ -0,0 +1,339 @@ +# typed: strong + +module OpenAI + module Models + module Realtime + class RealtimeTranslationSession < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationSession, + OpenAI::Internal::AnyHash + ) + end + + # Unique identifier for the session that looks like `sess_1234567890abcdef`. + sig { returns(String) } + attr_accessor :id + + # Configuration for translation input and output audio. + sig { returns(OpenAI::Realtime::RealtimeTranslationSession::Audio) } + attr_reader :audio + + sig do + params( + audio: OpenAI::Realtime::RealtimeTranslationSession::Audio::OrHash + ).void + end + attr_writer :audio + + # Expiration timestamp for the session, in seconds since epoch. + sig { returns(Integer) } + attr_accessor :expires_at + + # The Realtime translation model used for this session. This field is set at + # session creation and cannot be changed with `session.update`. + sig { returns(String) } + attr_accessor :model + + # The session type. Always `translation` for Realtime translation sessions. + sig { returns(Symbol) } + attr_accessor :type + + # A Realtime translation session. Translation sessions continuously translate + # input audio into the configured output language. + sig do + params( + id: String, + audio: OpenAI::Realtime::RealtimeTranslationSession::Audio::OrHash, + expires_at: Integer, + model: String, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Unique identifier for the session that looks like `sess_1234567890abcdef`. + id:, + # Configuration for translation input and output audio. + audio:, + # Expiration timestamp for the session, in seconds since epoch. + expires_at:, + # The Realtime translation model used for this session. This field is set at + # session creation and cannot be changed with `session.update`. + model:, + # The session type. Always `translation` for Realtime translation sessions. + type: :translation + ) + end + + sig do + override.returns( + { + id: String, + audio: OpenAI::Realtime::RealtimeTranslationSession::Audio, + expires_at: Integer, + model: String, + type: Symbol + } + ) + end + def to_hash + end + + class Audio < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationSession::Audio, + OpenAI::Internal::AnyHash + ) + end + + sig do + returns( + T.nilable( + OpenAI::Realtime::RealtimeTranslationSession::Audio::Input + ) + ) + end + attr_reader :input + + sig do + params( + input: + OpenAI::Realtime::RealtimeTranslationSession::Audio::Input::OrHash + ).void + end + attr_writer :input + + sig do + returns( + T.nilable( + OpenAI::Realtime::RealtimeTranslationSession::Audio::Output + ) + ) + end + attr_reader :output + + sig do + params( + output: + OpenAI::Realtime::RealtimeTranslationSession::Audio::Output::OrHash + ).void + end + attr_writer :output + + # Configuration for translation input and output audio. + sig do + params( + input: + OpenAI::Realtime::RealtimeTranslationSession::Audio::Input::OrHash, + output: + OpenAI::Realtime::RealtimeTranslationSession::Audio::Output::OrHash + ).returns(T.attached_class) + end + def self.new(input: nil, output: nil) + end + + sig do + override.returns( + { + input: + OpenAI::Realtime::RealtimeTranslationSession::Audio::Input, + output: + OpenAI::Realtime::RealtimeTranslationSession::Audio::Output + } + ) + end + def to_hash + end + + class Input < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationSession::Audio::Input, + OpenAI::Internal::AnyHash + ) + end + + # Optional input noise reduction. + sig do + returns( + T.nilable( + OpenAI::Realtime::RealtimeTranslationSession::Audio::Input::NoiseReduction + ) + ) + end + attr_reader :noise_reduction + + sig do + params( + noise_reduction: + T.nilable( + OpenAI::Realtime::RealtimeTranslationSession::Audio::Input::NoiseReduction::OrHash + ) + ).void + end + attr_writer :noise_reduction + + # Optional source-language transcription. When configured, the server emits + # `session.input_transcript.delta` events. Translation itself still runs from the + # input audio stream. + sig do + returns( + T.nilable( + OpenAI::Realtime::RealtimeTranslationSession::Audio::Input::Transcription + ) + ) + end + attr_reader :transcription + + sig do + params( + transcription: + T.nilable( + OpenAI::Realtime::RealtimeTranslationSession::Audio::Input::Transcription::OrHash + ) + ).void + end + attr_writer :transcription + + sig do + params( + noise_reduction: + T.nilable( + OpenAI::Realtime::RealtimeTranslationSession::Audio::Input::NoiseReduction::OrHash + ), + transcription: + T.nilable( + OpenAI::Realtime::RealtimeTranslationSession::Audio::Input::Transcription::OrHash + ) + ).returns(T.attached_class) + end + def self.new( + # Optional input noise reduction. + noise_reduction: nil, + # Optional source-language transcription. When configured, the server emits + # `session.input_transcript.delta` events. Translation itself still runs from the + # input audio stream. + transcription: nil + ) + end + + sig do + override.returns( + { + noise_reduction: + T.nilable( + OpenAI::Realtime::RealtimeTranslationSession::Audio::Input::NoiseReduction + ), + transcription: + T.nilable( + OpenAI::Realtime::RealtimeTranslationSession::Audio::Input::Transcription + ) + } + ) + end + def to_hash + end + + class NoiseReduction < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationSession::Audio::Input::NoiseReduction, + OpenAI::Internal::AnyHash + ) + end + + # Type of noise reduction. `near_field` is for close-talking microphones such as + # headphones, `far_field` is for far-field microphones such as laptop or + # conference room microphones. + sig { returns(OpenAI::Realtime::NoiseReductionType::OrSymbol) } + attr_accessor :type + + # Optional input noise reduction. + sig do + params( + type: OpenAI::Realtime::NoiseReductionType::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Type of noise reduction. `near_field` is for close-talking microphones such as + # headphones, `far_field` is for far-field microphones such as laptop or + # conference room microphones. + type: + ) + end + + sig do + override.returns( + { type: OpenAI::Realtime::NoiseReductionType::OrSymbol } + ) + end + def to_hash + end + end + + class Transcription < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationSession::Audio::Input::Transcription, + OpenAI::Internal::AnyHash + ) + end + + # The transcription model used for source transcript deltas. + sig { returns(String) } + attr_accessor :model + + # Optional source-language transcription. When configured, the server emits + # `session.input_transcript.delta` events. Translation itself still runs from the + # input audio stream. + sig { params(model: String).returns(T.attached_class) } + def self.new( + # The transcription model used for source transcript deltas. + model: + ) + end + + sig { override.returns({ model: String }) } + def to_hash + end + end + end + + class Output < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationSession::Audio::Output, + OpenAI::Internal::AnyHash + ) + end + + # Target language for translated output audio and transcript deltas. + sig { returns(T.nilable(String)) } + attr_reader :language + + sig { params(language: String).void } + attr_writer :language + + sig { params(language: String).returns(T.attached_class) } + def self.new( + # Target language for translated output audio and transcript deltas. + language: nil + ) + end + + sig { override.returns({ language: String }) } + def to_hash + end + end + end + end + end + end +end diff --git a/rbi/openai/models/realtime/realtime_translation_session_close_event.rbi b/rbi/openai/models/realtime/realtime_translation_session_close_event.rbi new file mode 100644 index 00000000..21a014ac --- /dev/null +++ b/rbi/openai/models/realtime/realtime_translation_session_close_event.rbi @@ -0,0 +1,44 @@ +# typed: strong + +module OpenAI + module Models + module Realtime + class RealtimeTranslationSessionCloseEvent < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationSessionCloseEvent, + OpenAI::Internal::AnyHash + ) + end + + # The event type, must be `session.close`. + sig { returns(Symbol) } + attr_accessor :type + + # Optional client-generated ID used to identify this event. + sig { returns(T.nilable(String)) } + attr_reader :event_id + + sig { params(event_id: String).void } + attr_writer :event_id + + # Gracefully close the realtime translation session. The server flushes pending + # input audio and emits any remaining translated output before closing the + # session. + sig { params(event_id: String, type: Symbol).returns(T.attached_class) } + def self.new( + # Optional client-generated ID used to identify this event. + event_id: nil, + # The event type, must be `session.close`. + type: :"session.close" + ) + end + + sig { override.returns({ type: Symbol, event_id: String }) } + def to_hash + end + end + end + end +end diff --git a/rbi/openai/models/realtime/realtime_translation_session_closed_event.rbi b/rbi/openai/models/realtime/realtime_translation_session_closed_event.rbi new file mode 100644 index 00000000..024d8dc0 --- /dev/null +++ b/rbi/openai/models/realtime/realtime_translation_session_closed_event.rbi @@ -0,0 +1,39 @@ +# typed: strong + +module OpenAI + module Models + module Realtime + class RealtimeTranslationSessionClosedEvent < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationSessionClosedEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the server event. + sig { returns(String) } + attr_accessor :event_id + + # The event type, must be `session.closed`. + sig { returns(Symbol) } + attr_accessor :type + + # Returned when a realtime translation session is closed. + sig { params(event_id: String, type: Symbol).returns(T.attached_class) } + def self.new( + # The unique ID of the server event. + event_id:, + # The event type, must be `session.closed`. + type: :"session.closed" + ) + end + + sig { override.returns({ event_id: String, type: Symbol }) } + def to_hash + end + end + end + end +end diff --git a/rbi/openai/models/realtime/realtime_translation_session_create_request.rbi b/rbi/openai/models/realtime/realtime_translation_session_create_request.rbi new file mode 100644 index 00000000..1e11650d --- /dev/null +++ b/rbi/openai/models/realtime/realtime_translation_session_create_request.rbi @@ -0,0 +1,322 @@ +# typed: strong + +module OpenAI + module Models + module Realtime + class RealtimeTranslationSessionCreateRequest < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest, + OpenAI::Internal::AnyHash + ) + end + + # The Realtime translation model used for this session. + sig { returns(String) } + attr_accessor :model + + # Configuration for translation input and output audio. + sig do + returns( + T.nilable( + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio + ) + ) + end + attr_reader :audio + + sig do + params( + audio: + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::OrHash + ).void + end + attr_writer :audio + + # Realtime translation session configuration. Translation sessions stream source + # audio in and translated audio plus transcript deltas out continuously. + sig do + params( + model: String, + audio: + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::OrHash + ).returns(T.attached_class) + end + def self.new( + # The Realtime translation model used for this session. + model:, + # Configuration for translation input and output audio. + audio: nil + ) + end + + sig do + override.returns( + { + model: String, + audio: + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio + } + ) + end + def to_hash + end + + class Audio < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio, + OpenAI::Internal::AnyHash + ) + end + + sig do + returns( + T.nilable( + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input + ) + ) + end + attr_reader :input + + sig do + params( + input: + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::OrHash + ).void + end + attr_writer :input + + sig do + returns( + T.nilable( + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Output + ) + ) + end + attr_reader :output + + sig do + params( + output: + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Output::OrHash + ).void + end + attr_writer :output + + # Configuration for translation input and output audio. + sig do + params( + input: + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::OrHash, + output: + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Output::OrHash + ).returns(T.attached_class) + end + def self.new(input: nil, output: nil) + end + + sig do + override.returns( + { + input: + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input, + output: + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Output + } + ) + end + def to_hash + end + + class Input < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input, + OpenAI::Internal::AnyHash + ) + end + + # Optional input noise reduction. Set to `null` to disable it. + sig do + returns( + T.nilable( + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::NoiseReduction + ) + ) + end + attr_reader :noise_reduction + + sig do + params( + noise_reduction: + T.nilable( + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::NoiseReduction::OrHash + ) + ).void + end + attr_writer :noise_reduction + + # Optional source-language transcription. When configured, the server emits + # `session.input_transcript.delta` events. Translation itself still runs from the + # input audio stream. + sig do + returns( + T.nilable( + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::Transcription + ) + ) + end + attr_reader :transcription + + sig do + params( + transcription: + T.nilable( + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::Transcription::OrHash + ) + ).void + end + attr_writer :transcription + + sig do + params( + noise_reduction: + T.nilable( + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::NoiseReduction::OrHash + ), + transcription: + T.nilable( + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::Transcription::OrHash + ) + ).returns(T.attached_class) + end + def self.new( + # Optional input noise reduction. Set to `null` to disable it. + noise_reduction: nil, + # Optional source-language transcription. When configured, the server emits + # `session.input_transcript.delta` events. Translation itself still runs from the + # input audio stream. + transcription: nil + ) + end + + sig do + override.returns( + { + noise_reduction: + T.nilable( + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::NoiseReduction + ), + transcription: + T.nilable( + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::Transcription + ) + } + ) + end + def to_hash + end + + class NoiseReduction < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::NoiseReduction, + OpenAI::Internal::AnyHash + ) + end + + # Type of noise reduction. `near_field` is for close-talking microphones such as + # headphones, `far_field` is for far-field microphones such as laptop or + # conference room microphones. + sig { returns(OpenAI::Realtime::NoiseReductionType::OrSymbol) } + attr_accessor :type + + # Optional input noise reduction. Set to `null` to disable it. + sig do + params( + type: OpenAI::Realtime::NoiseReductionType::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Type of noise reduction. `near_field` is for close-talking microphones such as + # headphones, `far_field` is for far-field microphones such as laptop or + # conference room microphones. + type: + ) + end + + sig do + override.returns( + { type: OpenAI::Realtime::NoiseReductionType::OrSymbol } + ) + end + def to_hash + end + end + + class Transcription < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::Transcription, + OpenAI::Internal::AnyHash + ) + end + + # The transcription model to use for source transcript deltas. + sig { returns(String) } + attr_accessor :model + + # Optional source-language transcription. When configured, the server emits + # `session.input_transcript.delta` events. Translation itself still runs from the + # input audio stream. + sig { params(model: String).returns(T.attached_class) } + def self.new( + # The transcription model to use for source transcript deltas. + model: + ) + end + + sig { override.returns({ model: String }) } + def to_hash + end + end + end + + class Output < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Output, + OpenAI::Internal::AnyHash + ) + end + + # Target language for translated output audio and transcript deltas. + sig { returns(T.nilable(String)) } + attr_reader :language + + sig { params(language: String).void } + attr_writer :language + + sig { params(language: String).returns(T.attached_class) } + def self.new( + # Target language for translated output audio and transcript deltas. + language: nil + ) + end + + sig { override.returns({ language: String }) } + def to_hash + end + end + end + end + end + end +end diff --git a/rbi/openai/models/realtime/realtime_translation_session_created_event.rbi b/rbi/openai/models/realtime/realtime_translation_session_created_event.rbi new file mode 100644 index 00000000..c4523e3a --- /dev/null +++ b/rbi/openai/models/realtime/realtime_translation_session_created_event.rbi @@ -0,0 +1,68 @@ +# typed: strong + +module OpenAI + module Models + module Realtime + class RealtimeTranslationSessionCreatedEvent < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationSessionCreatedEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the server event. + sig { returns(String) } + attr_accessor :event_id + + # The translation session configuration. + sig { returns(OpenAI::Realtime::RealtimeTranslationSession) } + attr_reader :session + + sig do + params( + session: OpenAI::Realtime::RealtimeTranslationSession::OrHash + ).void + end + attr_writer :session + + # The event type, must be `session.created`. + sig { returns(Symbol) } + attr_accessor :type + + # Returned when a translation session is created. Emitted automatically when a new + # connection is established as the first server event. This event contains the + # default translation session configuration. + sig do + params( + event_id: String, + session: OpenAI::Realtime::RealtimeTranslationSession::OrHash, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # The unique ID of the server event. + event_id:, + # The translation session configuration. + session:, + # The event type, must be `session.created`. + type: :"session.created" + ) + end + + sig do + override.returns( + { + event_id: String, + session: OpenAI::Realtime::RealtimeTranslationSession, + type: Symbol + } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/openai/models/realtime/realtime_translation_session_update_event.rbi b/rbi/openai/models/realtime/realtime_translation_session_update_event.rbi new file mode 100644 index 00000000..b765cabc --- /dev/null +++ b/rbi/openai/models/realtime/realtime_translation_session_update_event.rbi @@ -0,0 +1,78 @@ +# typed: strong + +module OpenAI + module Models + module Realtime + class RealtimeTranslationSessionUpdateEvent < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationSessionUpdateEvent, + OpenAI::Internal::AnyHash + ) + end + + # Translation session fields to update. The session `type` and `model` are set at + # creation and cannot be changed with `session.update`. + sig do + returns(OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest) + end + attr_reader :session + + sig do + params( + session: + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::OrHash + ).void + end + attr_writer :session + + # The event type, must be `session.update`. + sig { returns(Symbol) } + attr_accessor :type + + # Optional client-generated ID used to identify this event. + sig { returns(T.nilable(String)) } + attr_reader :event_id + + sig { params(event_id: String).void } + attr_writer :event_id + + # Send this event to update the translation session configuration. Translation + # sessions support updates to `audio.output.language`, + # `audio.input.transcription`, and `audio.input.noise_reduction`. + sig do + params( + session: + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::OrHash, + event_id: String, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Translation session fields to update. The session `type` and `model` are set at + # creation and cannot be changed with `session.update`. + session:, + # Optional client-generated ID used to identify this event. + event_id: nil, + # The event type, must be `session.update`. + type: :"session.update" + ) + end + + sig do + override.returns( + { + session: + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest, + type: Symbol, + event_id: String + } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/openai/models/realtime/realtime_translation_session_update_request.rbi b/rbi/openai/models/realtime/realtime_translation_session_update_request.rbi new file mode 100644 index 00000000..e3acffd2 --- /dev/null +++ b/rbi/openai/models/realtime/realtime_translation_session_update_request.rbi @@ -0,0 +1,313 @@ +# typed: strong + +module OpenAI + module Models + module Realtime + class RealtimeTranslationSessionUpdateRequest < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest, + OpenAI::Internal::AnyHash + ) + end + + # Configuration for translation input and output audio. + sig do + returns( + T.nilable( + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio + ) + ) + end + attr_reader :audio + + sig do + params( + audio: + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::OrHash + ).void + end + attr_writer :audio + + # Realtime translation session fields that can be updated with `session.update`. + sig do + params( + audio: + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::OrHash + ).returns(T.attached_class) + end + def self.new( + # Configuration for translation input and output audio. + audio: nil + ) + end + + sig do + override.returns( + { + audio: + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio + } + ) + end + def to_hash + end + + class Audio < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio, + OpenAI::Internal::AnyHash + ) + end + + sig do + returns( + T.nilable( + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input + ) + ) + end + attr_reader :input + + sig do + params( + input: + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::OrHash + ).void + end + attr_writer :input + + sig do + returns( + T.nilable( + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Output + ) + ) + end + attr_reader :output + + sig do + params( + output: + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Output::OrHash + ).void + end + attr_writer :output + + # Configuration for translation input and output audio. + sig do + params( + input: + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::OrHash, + output: + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Output::OrHash + ).returns(T.attached_class) + end + def self.new(input: nil, output: nil) + end + + sig do + override.returns( + { + input: + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input, + output: + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Output + } + ) + end + def to_hash + end + + class Input < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input, + OpenAI::Internal::AnyHash + ) + end + + # Optional input noise reduction. Set to `null` to disable it. + sig do + returns( + T.nilable( + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::NoiseReduction + ) + ) + end + attr_reader :noise_reduction + + sig do + params( + noise_reduction: + T.nilable( + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::NoiseReduction::OrHash + ) + ).void + end + attr_writer :noise_reduction + + # Optional source-language transcription. When configured, the server emits + # `session.input_transcript.delta` events. Translation itself still runs from the + # input audio stream. + sig do + returns( + T.nilable( + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::Transcription + ) + ) + end + attr_reader :transcription + + sig do + params( + transcription: + T.nilable( + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::Transcription::OrHash + ) + ).void + end + attr_writer :transcription + + sig do + params( + noise_reduction: + T.nilable( + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::NoiseReduction::OrHash + ), + transcription: + T.nilable( + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::Transcription::OrHash + ) + ).returns(T.attached_class) + end + def self.new( + # Optional input noise reduction. Set to `null` to disable it. + noise_reduction: nil, + # Optional source-language transcription. When configured, the server emits + # `session.input_transcript.delta` events. Translation itself still runs from the + # input audio stream. + transcription: nil + ) + end + + sig do + override.returns( + { + noise_reduction: + T.nilable( + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::NoiseReduction + ), + transcription: + T.nilable( + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::Transcription + ) + } + ) + end + def to_hash + end + + class NoiseReduction < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::NoiseReduction, + OpenAI::Internal::AnyHash + ) + end + + # Type of noise reduction. `near_field` is for close-talking microphones such as + # headphones, `far_field` is for far-field microphones such as laptop or + # conference room microphones. + sig { returns(OpenAI::Realtime::NoiseReductionType::OrSymbol) } + attr_accessor :type + + # Optional input noise reduction. Set to `null` to disable it. + sig do + params( + type: OpenAI::Realtime::NoiseReductionType::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Type of noise reduction. `near_field` is for close-talking microphones such as + # headphones, `far_field` is for far-field microphones such as laptop or + # conference room microphones. + type: + ) + end + + sig do + override.returns( + { type: OpenAI::Realtime::NoiseReductionType::OrSymbol } + ) + end + def to_hash + end + end + + class Transcription < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::Transcription, + OpenAI::Internal::AnyHash + ) + end + + # The transcription model to use for source transcript deltas. + sig { returns(String) } + attr_accessor :model + + # Optional source-language transcription. When configured, the server emits + # `session.input_transcript.delta` events. Translation itself still runs from the + # input audio stream. + sig { params(model: String).returns(T.attached_class) } + def self.new( + # The transcription model to use for source transcript deltas. + model: + ) + end + + sig { override.returns({ model: String }) } + def to_hash + end + end + end + + class Output < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Output, + OpenAI::Internal::AnyHash + ) + end + + # Target language for translated output audio and transcript deltas. + sig { returns(T.nilable(String)) } + attr_reader :language + + sig { params(language: String).void } + attr_writer :language + + sig { params(language: String).returns(T.attached_class) } + def self.new( + # Target language for translated output audio and transcript deltas. + language: nil + ) + end + + sig { override.returns({ language: String }) } + def to_hash + end + end + end + end + end + end +end diff --git a/rbi/openai/models/realtime/realtime_translation_session_updated_event.rbi b/rbi/openai/models/realtime/realtime_translation_session_updated_event.rbi new file mode 100644 index 00000000..4b5f0aac --- /dev/null +++ b/rbi/openai/models/realtime/realtime_translation_session_updated_event.rbi @@ -0,0 +1,67 @@ +# typed: strong + +module OpenAI + module Models + module Realtime + class RealtimeTranslationSessionUpdatedEvent < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeTranslationSessionUpdatedEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the server event. + sig { returns(String) } + attr_accessor :event_id + + # The translation session configuration. + sig { returns(OpenAI::Realtime::RealtimeTranslationSession) } + attr_reader :session + + sig do + params( + session: OpenAI::Realtime::RealtimeTranslationSession::OrHash + ).void + end + attr_writer :session + + # The event type, must be `session.updated`. + sig { returns(Symbol) } + attr_accessor :type + + # Returned when a translation session is updated with a `session.update` event, + # unless there is an error. + sig do + params( + event_id: String, + session: OpenAI::Realtime::RealtimeTranslationSession::OrHash, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # The unique ID of the server event. + event_id:, + # The translation session configuration. + session:, + # The event type, must be `session.updated`. + type: :"session.updated" + ) + end + + sig do + override.returns( + { + event_id: String, + session: OpenAI::Realtime::RealtimeTranslationSession, + type: Symbol + } + ) + end + def to_hash + end + end + end + end +end diff --git a/sig/openai/models/realtime/realtime_translation_client_event.rbs b/sig/openai/models/realtime/realtime_translation_client_event.rbs new file mode 100644 index 00000000..f385a893 --- /dev/null +++ b/sig/openai/models/realtime/realtime_translation_client_event.rbs @@ -0,0 +1,16 @@ +module OpenAI + module Models + module Realtime + type realtime_translation_client_event = + OpenAI::Realtime::RealtimeTranslationSessionUpdateEvent + | OpenAI::Realtime::RealtimeTranslationInputAudioBufferAppendEvent + | OpenAI::Realtime::RealtimeTranslationSessionCloseEvent + + module RealtimeTranslationClientEvent + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::Realtime::realtime_translation_client_event] + end + end + end +end diff --git a/sig/openai/models/realtime/realtime_translation_client_secret_create_request.rbs b/sig/openai/models/realtime/realtime_translation_client_secret_create_request.rbs new file mode 100644 index 00000000..067d096f --- /dev/null +++ b/sig/openai/models/realtime/realtime_translation_client_secret_create_request.rbs @@ -0,0 +1,69 @@ +module OpenAI + module Models + module Realtime + type realtime_translation_client_secret_create_request = + { + session: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest, + expires_after: OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter + } + + class RealtimeTranslationClientSecretCreateRequest < OpenAI::Internal::Type::BaseModel + attr_accessor session: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest + + attr_reader expires_after: OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter? + + def expires_after=: ( + OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter + ) -> OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter + + def initialize: ( + session: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest, + ?expires_after: OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter + ) -> void + + def to_hash: -> { + session: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest, + expires_after: OpenAI::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter + } + + type expires_after = + { + anchor: OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::anchor, + seconds: Integer + } + + class ExpiresAfter < OpenAI::Internal::Type::BaseModel + attr_reader anchor: OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::anchor? + + def anchor=: ( + OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::anchor + ) -> OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::anchor + + attr_reader seconds: Integer? + + def seconds=: (Integer) -> Integer + + def initialize: ( + ?anchor: OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::anchor, + ?seconds: Integer + ) -> void + + def to_hash: -> { + anchor: OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::anchor, + seconds: Integer + } + + type anchor = :created_at + + module Anchor + extend OpenAI::Internal::Type::Enum + + CREATED_AT: :created_at + + def self?.values: -> ::Array[OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter::anchor] + end + end + end + end + end +end diff --git a/sig/openai/models/realtime/realtime_translation_client_secret_create_response.rbs b/sig/openai/models/realtime/realtime_translation_client_secret_create_response.rbs new file mode 100644 index 00000000..fd53a261 --- /dev/null +++ b/sig/openai/models/realtime/realtime_translation_client_secret_create_response.rbs @@ -0,0 +1,32 @@ +module OpenAI + module Models + module Realtime + type realtime_translation_client_secret_create_response = + { + expires_at: Integer, + session: OpenAI::Realtime::RealtimeTranslationSession, + value: String + } + + class RealtimeTranslationClientSecretCreateResponse < OpenAI::Internal::Type::BaseModel + attr_accessor expires_at: Integer + + attr_accessor session: OpenAI::Realtime::RealtimeTranslationSession + + attr_accessor value: String + + def initialize: ( + expires_at: Integer, + session: OpenAI::Realtime::RealtimeTranslationSession, + value: String + ) -> void + + def to_hash: -> { + expires_at: Integer, + session: OpenAI::Realtime::RealtimeTranslationSession, + value: String + } + end + end + end +end diff --git a/sig/openai/models/realtime/realtime_translation_input_audio_buffer_append_event.rbs b/sig/openai/models/realtime/realtime_translation_input_audio_buffer_append_event.rbs new file mode 100644 index 00000000..3b41b12a --- /dev/null +++ b/sig/openai/models/realtime/realtime_translation_input_audio_buffer_append_event.rbs @@ -0,0 +1,34 @@ +module OpenAI + module Models + module Realtime + type realtime_translation_input_audio_buffer_append_event = + { + audio: String, + type: :"session.input_audio_buffer.append", + event_id: String + } + + class RealtimeTranslationInputAudioBufferAppendEvent < OpenAI::Internal::Type::BaseModel + attr_accessor audio: String + + attr_accessor type: :"session.input_audio_buffer.append" + + attr_reader event_id: String? + + def event_id=: (String) -> String + + def initialize: ( + audio: String, + ?event_id: String, + ?type: :"session.input_audio_buffer.append" + ) -> void + + def to_hash: -> { + audio: String, + type: :"session.input_audio_buffer.append", + event_id: String + } + end + end + end +end diff --git a/sig/openai/models/realtime/realtime_translation_input_transcript_delta_event.rbs b/sig/openai/models/realtime/realtime_translation_input_transcript_delta_event.rbs new file mode 100644 index 00000000..4a29b045 --- /dev/null +++ b/sig/openai/models/realtime/realtime_translation_input_transcript_delta_event.rbs @@ -0,0 +1,37 @@ +module OpenAI + module Models + module Realtime + type realtime_translation_input_transcript_delta_event = + { + delta: String, + event_id: String, + type: :"session.input_transcript.delta", + elapsed_ms: Integer? + } + + class RealtimeTranslationInputTranscriptDeltaEvent < OpenAI::Internal::Type::BaseModel + attr_accessor delta: String + + attr_accessor event_id: String + + attr_accessor type: :"session.input_transcript.delta" + + attr_accessor elapsed_ms: Integer? + + def initialize: ( + delta: String, + event_id: String, + ?elapsed_ms: Integer?, + ?type: :"session.input_transcript.delta" + ) -> void + + def to_hash: -> { + delta: String, + event_id: String, + type: :"session.input_transcript.delta", + elapsed_ms: Integer? + } + end + end + end +end diff --git a/sig/openai/models/realtime/realtime_translation_output_audio_delta_event.rbs b/sig/openai/models/realtime/realtime_translation_output_audio_delta_event.rbs new file mode 100644 index 00000000..d1ce5fae --- /dev/null +++ b/sig/openai/models/realtime/realtime_translation_output_audio_delta_event.rbs @@ -0,0 +1,70 @@ +module OpenAI + module Models + module Realtime + type realtime_translation_output_audio_delta_event = + { + delta: String, + event_id: String, + type: :"session.output_audio.delta", + channels: Integer, + elapsed_ms: Integer?, + format_: OpenAI::Models::Realtime::RealtimeTranslationOutputAudioDeltaEvent::format_, + sample_rate: Integer + } + + class RealtimeTranslationOutputAudioDeltaEvent < OpenAI::Internal::Type::BaseModel + attr_accessor delta: String + + attr_accessor event_id: String + + attr_accessor type: :"session.output_audio.delta" + + attr_reader channels: Integer? + + def channels=: (Integer) -> Integer + + attr_accessor elapsed_ms: Integer? + + attr_reader format_: OpenAI::Models::Realtime::RealtimeTranslationOutputAudioDeltaEvent::format_? + + def format_=: ( + OpenAI::Models::Realtime::RealtimeTranslationOutputAudioDeltaEvent::format_ + ) -> OpenAI::Models::Realtime::RealtimeTranslationOutputAudioDeltaEvent::format_ + + attr_reader sample_rate: Integer? + + def sample_rate=: (Integer) -> Integer + + def initialize: ( + delta: String, + event_id: String, + ?channels: Integer, + ?elapsed_ms: Integer?, + ?format_: OpenAI::Models::Realtime::RealtimeTranslationOutputAudioDeltaEvent::format_, + ?sample_rate: Integer, + ?type: :"session.output_audio.delta" + ) -> void + + def to_hash: -> { + delta: String, + event_id: String, + type: :"session.output_audio.delta", + channels: Integer, + elapsed_ms: Integer?, + format_: OpenAI::Models::Realtime::RealtimeTranslationOutputAudioDeltaEvent::format_, + sample_rate: Integer + } + + type format_ = :pcm16 + + module Format + extend OpenAI::Internal::Type::Enum + + PCM16: :pcm16 + + def self?.values: -> ::Array[OpenAI::Models::Realtime::RealtimeTranslationOutputAudioDeltaEvent::format_] + end + end + end + end +end diff --git a/sig/openai/models/realtime/realtime_translation_output_transcript_delta_event.rbs b/sig/openai/models/realtime/realtime_translation_output_transcript_delta_event.rbs new file mode 100644 index 00000000..4d14bbfb --- /dev/null +++ b/sig/openai/models/realtime/realtime_translation_output_transcript_delta_event.rbs @@ -0,0 +1,37 @@ +module OpenAI + module Models + module Realtime + type realtime_translation_output_transcript_delta_event = + { + delta: String, + event_id: String, + type: :"session.output_transcript.delta", + elapsed_ms: Integer? + } + + class RealtimeTranslationOutputTranscriptDeltaEvent < OpenAI::Internal::Type::BaseModel + attr_accessor delta: String + + attr_accessor event_id: String + + attr_accessor type: :"session.output_transcript.delta" + + attr_accessor elapsed_ms: Integer? + + def initialize: ( + delta: String, + event_id: String, + ?elapsed_ms: Integer?, + ?type: :"session.output_transcript.delta" + ) -> void + + def to_hash: -> { + delta: String, + event_id: String, + type: :"session.output_transcript.delta", + elapsed_ms: Integer? + } + end + end + end +end diff --git a/sig/openai/models/realtime/realtime_translation_server_event.rbs b/sig/openai/models/realtime/realtime_translation_server_event.rbs new file mode 100644 index 00000000..cd71e1fe --- /dev/null +++ b/sig/openai/models/realtime/realtime_translation_server_event.rbs @@ -0,0 +1,20 @@ +module OpenAI + module Models + module Realtime + type realtime_translation_server_event = + OpenAI::Realtime::RealtimeErrorEvent + | OpenAI::Realtime::RealtimeTranslationSessionCreatedEvent + | OpenAI::Realtime::RealtimeTranslationSessionUpdatedEvent + | OpenAI::Realtime::RealtimeTranslationSessionClosedEvent + | OpenAI::Realtime::RealtimeTranslationInputTranscriptDeltaEvent + | OpenAI::Realtime::RealtimeTranslationOutputTranscriptDeltaEvent + | OpenAI::Realtime::RealtimeTranslationOutputAudioDeltaEvent + + module RealtimeTranslationServerEvent + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::Realtime::realtime_translation_server_event] + end + end + end +end diff --git a/sig/openai/models/realtime/realtime_translation_session.rbs b/sig/openai/models/realtime/realtime_translation_session.rbs new file mode 100644 index 00000000..3f016962 --- /dev/null +++ b/sig/openai/models/realtime/realtime_translation_session.rbs @@ -0,0 +1,131 @@ +module OpenAI + module Models + module Realtime + type realtime_translation_session = + { + id: String, + audio: OpenAI::Realtime::RealtimeTranslationSession::Audio, + expires_at: Integer, + model: String, + type: :translation + } + + class RealtimeTranslationSession < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor audio: OpenAI::Realtime::RealtimeTranslationSession::Audio + + attr_accessor expires_at: Integer + + attr_accessor model: String + + attr_accessor type: :translation + + def initialize: ( + id: String, + audio: OpenAI::Realtime::RealtimeTranslationSession::Audio, + expires_at: Integer, + model: String, + ?type: :translation + ) -> void + + def to_hash: -> { + id: String, + audio: OpenAI::Realtime::RealtimeTranslationSession::Audio, + expires_at: Integer, + model: String, + type: :translation + } + + type audio = + { + input: OpenAI::Realtime::RealtimeTranslationSession::Audio::Input, + output: OpenAI::Realtime::RealtimeTranslationSession::Audio::Output + } + + class Audio < OpenAI::Internal::Type::BaseModel + attr_reader input: OpenAI::Realtime::RealtimeTranslationSession::Audio::Input? + + def input=: ( + OpenAI::Realtime::RealtimeTranslationSession::Audio::Input + ) -> OpenAI::Realtime::RealtimeTranslationSession::Audio::Input + + attr_reader output: OpenAI::Realtime::RealtimeTranslationSession::Audio::Output? + + def output=: ( + OpenAI::Realtime::RealtimeTranslationSession::Audio::Output + ) -> OpenAI::Realtime::RealtimeTranslationSession::Audio::Output + + def initialize: ( + ?input: OpenAI::Realtime::RealtimeTranslationSession::Audio::Input, + ?output: OpenAI::Realtime::RealtimeTranslationSession::Audio::Output + ) -> void + + def to_hash: -> { + input: OpenAI::Realtime::RealtimeTranslationSession::Audio::Input, + output: OpenAI::Realtime::RealtimeTranslationSession::Audio::Output + } + + type input = + { + noise_reduction: OpenAI::Realtime::RealtimeTranslationSession::Audio::Input::NoiseReduction?, + transcription: OpenAI::Realtime::RealtimeTranslationSession::Audio::Input::Transcription? + } + + class Input < OpenAI::Internal::Type::BaseModel + attr_accessor noise_reduction: OpenAI::Realtime::RealtimeTranslationSession::Audio::Input::NoiseReduction? + + attr_accessor transcription: OpenAI::Realtime::RealtimeTranslationSession::Audio::Input::Transcription? + + def initialize: ( + ?noise_reduction: OpenAI::Realtime::RealtimeTranslationSession::Audio::Input::NoiseReduction?, + ?transcription: OpenAI::Realtime::RealtimeTranslationSession::Audio::Input::Transcription? + ) -> void + + def to_hash: -> { + noise_reduction: OpenAI::Realtime::RealtimeTranslationSession::Audio::Input::NoiseReduction?, + transcription: OpenAI::Realtime::RealtimeTranslationSession::Audio::Input::Transcription? + } + + type noise_reduction = + { type: OpenAI::Models::Realtime::noise_reduction_type } + + class NoiseReduction < OpenAI::Internal::Type::BaseModel + attr_accessor type: OpenAI::Models::Realtime::noise_reduction_type + + def initialize: ( + type: OpenAI::Models::Realtime::noise_reduction_type + ) -> void + + def to_hash: -> { + type: OpenAI::Models::Realtime::noise_reduction_type + } + end + + type transcription = { model: String } + + class Transcription < OpenAI::Internal::Type::BaseModel + attr_accessor model: String + + def initialize: (model: String) -> void + + def to_hash: -> { model: String } + end + end + + type output = { language: String } + + class Output < OpenAI::Internal::Type::BaseModel + attr_reader language: String? + + def language=: (String) -> String + + def initialize: (?language: String) -> void + + def to_hash: -> { language: String } + end + end + end + end + end +end diff --git a/sig/openai/models/realtime/realtime_translation_session_close_event.rbs b/sig/openai/models/realtime/realtime_translation_session_close_event.rbs new file mode 100644 index 00000000..967f3649 --- /dev/null +++ b/sig/openai/models/realtime/realtime_translation_session_close_event.rbs @@ -0,0 +1,20 @@ +module OpenAI + module Models + module Realtime + type realtime_translation_session_close_event = + { type: :"session.close", event_id: String } + + class RealtimeTranslationSessionCloseEvent < OpenAI::Internal::Type::BaseModel + attr_accessor type: :"session.close" + + attr_reader event_id: String? + + def event_id=: (String) -> String + + def initialize: (?event_id: String, ?type: :"session.close") -> void + + def to_hash: -> { type: :"session.close", event_id: String } + end + end + end +end diff --git a/sig/openai/models/realtime/realtime_translation_session_closed_event.rbs b/sig/openai/models/realtime/realtime_translation_session_closed_event.rbs new file mode 100644 index 00000000..ea0ec878 --- /dev/null +++ b/sig/openai/models/realtime/realtime_translation_session_closed_event.rbs @@ -0,0 +1,18 @@ +module OpenAI + module Models + module Realtime + type realtime_translation_session_closed_event = + { event_id: String, type: :"session.closed" } + + class RealtimeTranslationSessionClosedEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor type: :"session.closed" + + def initialize: (event_id: String, ?type: :"session.closed") -> void + + def to_hash: -> { event_id: String, type: :"session.closed" } + end + end + end +end diff --git a/sig/openai/models/realtime/realtime_translation_session_create_request.rbs b/sig/openai/models/realtime/realtime_translation_session_create_request.rbs new file mode 100644 index 00000000..3116e67a --- /dev/null +++ b/sig/openai/models/realtime/realtime_translation_session_create_request.rbs @@ -0,0 +1,120 @@ +module OpenAI + module Models + module Realtime + type realtime_translation_session_create_request = + { + model: String, + audio: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio + } + + class RealtimeTranslationSessionCreateRequest < OpenAI::Internal::Type::BaseModel + attr_accessor model: String + + attr_reader audio: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio? + + def audio=: ( + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio + ) -> OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio + + def initialize: ( + model: String, + ?audio: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio + ) -> void + + def to_hash: -> { + model: String, + audio: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio + } + + type audio = + { + input: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input, + output: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Output + } + + class Audio < OpenAI::Internal::Type::BaseModel + attr_reader input: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input? + + def input=: ( + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input + ) -> OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input + + attr_reader output: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Output? + + def output=: ( + OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Output + ) -> OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Output + + def initialize: ( + ?input: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input, + ?output: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Output + ) -> void + + def to_hash: -> { + input: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input, + output: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Output + } + + type input = + { + noise_reduction: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::NoiseReduction?, + transcription: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::Transcription? + } + + class Input < OpenAI::Internal::Type::BaseModel + attr_accessor noise_reduction: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::NoiseReduction? + + attr_accessor transcription: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::Transcription? + + def initialize: ( + ?noise_reduction: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::NoiseReduction?, + ?transcription: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::Transcription? + ) -> void + + def to_hash: -> { + noise_reduction: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::NoiseReduction?, + transcription: OpenAI::Realtime::RealtimeTranslationSessionCreateRequest::Audio::Input::Transcription? + } + + type noise_reduction = + { type: OpenAI::Models::Realtime::noise_reduction_type } + + class NoiseReduction < OpenAI::Internal::Type::BaseModel + attr_accessor type: OpenAI::Models::Realtime::noise_reduction_type + + def initialize: ( + type: OpenAI::Models::Realtime::noise_reduction_type + ) -> void + + def to_hash: -> { + type: OpenAI::Models::Realtime::noise_reduction_type + } + end + + type transcription = { model: String } + + class Transcription < OpenAI::Internal::Type::BaseModel + attr_accessor model: String + + def initialize: (model: String) -> void + + def to_hash: -> { model: String } + end + end + + type output = { language: String } + + class Output < OpenAI::Internal::Type::BaseModel + attr_reader language: String? + + def language=: (String) -> String + + def initialize: (?language: String) -> void + + def to_hash: -> { language: String } + end + end + end + end + end +end diff --git a/sig/openai/models/realtime/realtime_translation_session_created_event.rbs b/sig/openai/models/realtime/realtime_translation_session_created_event.rbs new file mode 100644 index 00000000..593c6ea9 --- /dev/null +++ b/sig/openai/models/realtime/realtime_translation_session_created_event.rbs @@ -0,0 +1,32 @@ +module OpenAI + module Models + module Realtime + type realtime_translation_session_created_event = + { + event_id: String, + session: OpenAI::Realtime::RealtimeTranslationSession, + type: :"session.created" + } + + class RealtimeTranslationSessionCreatedEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor session: OpenAI::Realtime::RealtimeTranslationSession + + attr_accessor type: :"session.created" + + def initialize: ( + event_id: String, + session: OpenAI::Realtime::RealtimeTranslationSession, + ?type: :"session.created" + ) -> void + + def to_hash: -> { + event_id: String, + session: OpenAI::Realtime::RealtimeTranslationSession, + type: :"session.created" + } + end + end + end +end diff --git a/sig/openai/models/realtime/realtime_translation_session_update_event.rbs b/sig/openai/models/realtime/realtime_translation_session_update_event.rbs new file mode 100644 index 00000000..3e14aa1f --- /dev/null +++ b/sig/openai/models/realtime/realtime_translation_session_update_event.rbs @@ -0,0 +1,34 @@ +module OpenAI + module Models + module Realtime + type realtime_translation_session_update_event = + { + session: OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest, + type: :"session.update", + event_id: String + } + + class RealtimeTranslationSessionUpdateEvent < OpenAI::Internal::Type::BaseModel + attr_accessor session: OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest + + attr_accessor type: :"session.update" + + attr_reader event_id: String? + + def event_id=: (String) -> String + + def initialize: ( + session: OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest, + ?event_id: String, + ?type: :"session.update" + ) -> void + + def to_hash: -> { + session: OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest, + type: :"session.update", + event_id: String + } + end + end + end +end diff --git a/sig/openai/models/realtime/realtime_translation_session_update_request.rbs b/sig/openai/models/realtime/realtime_translation_session_update_request.rbs new file mode 100644 index 00000000..6ef216aa --- /dev/null +++ b/sig/openai/models/realtime/realtime_translation_session_update_request.rbs @@ -0,0 +1,115 @@ +module OpenAI + module Models + module Realtime + type realtime_translation_session_update_request = + { + audio: OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio + } + + class RealtimeTranslationSessionUpdateRequest < OpenAI::Internal::Type::BaseModel + attr_reader audio: OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio? + + def audio=: ( + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio + ) -> OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio + + def initialize: ( + ?audio: OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio + ) -> void + + def to_hash: -> { + audio: OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio + } + + type audio = + { + input: OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input, + output: OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Output + } + + class Audio < OpenAI::Internal::Type::BaseModel + attr_reader input: OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input? + + def input=: ( + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input + ) -> OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input + + attr_reader output: OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Output? + + def output=: ( + OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Output + ) -> OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Output + + def initialize: ( + ?input: OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input, + ?output: OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Output + ) -> void + + def to_hash: -> { + input: OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input, + output: OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Output + } + + type input = + { + noise_reduction: OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::NoiseReduction?, + transcription: OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::Transcription? + } + + class Input < OpenAI::Internal::Type::BaseModel + attr_accessor noise_reduction: OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::NoiseReduction? + + attr_accessor transcription: OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::Transcription? + + def initialize: ( + ?noise_reduction: OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::NoiseReduction?, + ?transcription: OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::Transcription? + ) -> void + + def to_hash: -> { + noise_reduction: OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::NoiseReduction?, + transcription: OpenAI::Realtime::RealtimeTranslationSessionUpdateRequest::Audio::Input::Transcription? + } + + type noise_reduction = + { type: OpenAI::Models::Realtime::noise_reduction_type } + + class NoiseReduction < OpenAI::Internal::Type::BaseModel + attr_accessor type: OpenAI::Models::Realtime::noise_reduction_type + + def initialize: ( + type: OpenAI::Models::Realtime::noise_reduction_type + ) -> void + + def to_hash: -> { + type: OpenAI::Models::Realtime::noise_reduction_type + } + end + + type transcription = { model: String } + + class Transcription < OpenAI::Internal::Type::BaseModel + attr_accessor model: String + + def initialize: (model: String) -> void + + def to_hash: -> { model: String } + end + end + + type output = { language: String } + + class Output < OpenAI::Internal::Type::BaseModel + attr_reader language: String? + + def language=: (String) -> String + + def initialize: (?language: String) -> void + + def to_hash: -> { language: String } + end + end + end + end + end +end diff --git a/sig/openai/models/realtime/realtime_translation_session_updated_event.rbs b/sig/openai/models/realtime/realtime_translation_session_updated_event.rbs new file mode 100644 index 00000000..78077f35 --- /dev/null +++ b/sig/openai/models/realtime/realtime_translation_session_updated_event.rbs @@ -0,0 +1,32 @@ +module OpenAI + module Models + module Realtime + type realtime_translation_session_updated_event = + { + event_id: String, + session: OpenAI::Realtime::RealtimeTranslationSession, + type: :"session.updated" + } + + class RealtimeTranslationSessionUpdatedEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor session: OpenAI::Realtime::RealtimeTranslationSession + + attr_accessor type: :"session.updated" + + def initialize: ( + event_id: String, + session: OpenAI::Realtime::RealtimeTranslationSession, + ?type: :"session.updated" + ) -> void + + def to_hash: -> { + event_id: String, + session: OpenAI::Realtime::RealtimeTranslationSession, + type: :"session.updated" + } + end + end + end +end From 17187817c580b642d61ea754aa63782a16af94bc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 7 May 2026 17:20:47 +0000 Subject: [PATCH 15/16] feat(api): realtime 2 --- .stats.yml | 6 +- lib/openai.rb | 3 +- .../models/realtime/audio_transcription.rb | 42 ++++++++- .../realtime/client_secret_create_response.rb | 3 +- .../realtime/realtime_audio_config_input.rb | 3 + .../realtime_audio_input_turn_detection.rb | 3 + .../models/realtime/realtime_reasoning.rb | 24 +++++ .../realtime/realtime_reasoning_effort.rb | 22 +++++ .../realtime_response_create_params.rb | 19 +++- .../models/realtime/realtime_session.rb | 6 ++ .../realtime_session_client_secret.rb | 36 -------- .../realtime_session_create_request.rb | 22 ++++- .../realtime_session_create_response.rb | 58 ++++++++---- ...ltime_transcription_session_audio_input.rb | 3 + ...tion_session_audio_input_turn_detection.rb | 3 + ...e_transcription_session_create_response.rb | 14 ++- ...me_transcription_session_turn_detection.rb | 3 +- .../transcription_session_updated_event.rb | 3 +- lib/openai/resources/realtime/calls.rb | 6 +- .../models/realtime/audio_transcription.rbi | 91 +++++++++++++++++-- .../realtime/realtime_audio_config_input.rbi | 6 ++ .../realtime_audio_input_turn_detection.rbi | 3 + .../models/realtime/realtime_reasoning.rbi | 54 +++++++++++ .../realtime/realtime_reasoning_effort.rbi | 44 +++++++++ .../realtime_response_create_params.rbi | 26 ++++++ .../models/realtime/realtime_session.rbi | 9 ++ .../realtime_session_client_secret.rbi | 49 ---------- .../realtime_session_create_request.rbi | 31 +++++++ .../realtime_session_create_response.rbi | 85 ++++++++++------- ...time_transcription_session_audio_input.rbi | 6 ++ ...ion_session_audio_input_turn_detection.rbi | 3 + ..._transcription_session_create_response.rbi | 20 ++-- ...e_transcription_session_turn_detection.rbi | 3 +- .../transcription_session_updated_event.rbi | 2 - rbi/openai/resources/realtime/calls.rbi | 7 ++ .../models/realtime/audio_transcription.rbs | 25 +++++ .../models/realtime/realtime_reasoning.rbs | 24 +++++ .../realtime/realtime_reasoning_effort.rbs | 20 ++++ .../realtime_response_create_params.rbs | 16 ++++ .../realtime_session_client_secret.rbs | 20 ---- .../realtime_session_create_request.rbs | 18 ++++ .../realtime_session_create_response.rbs | 31 ++++++- ..._transcription_session_create_response.rbs | 12 +-- sig/openai/resources/realtime/calls.rbs | 2 + 44 files changed, 682 insertions(+), 204 deletions(-) create mode 100644 lib/openai/models/realtime/realtime_reasoning.rb create mode 100644 lib/openai/models/realtime/realtime_reasoning_effort.rb delete mode 100644 lib/openai/models/realtime/realtime_session_client_secret.rb create mode 100644 rbi/openai/models/realtime/realtime_reasoning.rbi create mode 100644 rbi/openai/models/realtime/realtime_reasoning_effort.rbi delete mode 100644 rbi/openai/models/realtime/realtime_session_client_secret.rbi create mode 100644 sig/openai/models/realtime/realtime_reasoning.rbs create mode 100644 sig/openai/models/realtime/realtime_reasoning_effort.rbs delete mode 100644 sig/openai/models/realtime/realtime_session_client_secret.rbs diff --git a/.stats.yml b/.stats.yml index 74bb7cc4..ff6b8935 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 232 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-08cb8ed18dfe4a9fa518e278576d3cfe5710cb5c22789cf80826c900569bcf56.yml -openapi_spec_hash: 20f820c94f54741b75d719f6a7371c12 -config_hash: f291a449469edfe61a28424e548899b2 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-371f497afe4d6070f6e252e5febbe8f453c7058a8dff0c26a01b4d88442a4ac2.yml +openapi_spec_hash: d39f46e8fda45f77096448105efd175a +config_hash: b64135fff1fe9cf4069b9ecf59ae8b07 diff --git a/lib/openai.rb b/lib/openai.rb index 53fab3f9..44b6c4b2 100644 --- a/lib/openai.rb +++ b/lib/openai.rb @@ -629,6 +629,8 @@ require_relative "openai/models/realtime/realtime_mcp_protocol_error" require_relative "openai/models/realtime/realtime_mcp_tool_call" require_relative "openai/models/realtime/realtime_mcp_tool_execution_error" +require_relative "openai/models/realtime/realtime_reasoning" +require_relative "openai/models/realtime/realtime_reasoning_effort" require_relative "openai/models/realtime/realtime_response" require_relative "openai/models/realtime/realtime_response_create_audio_output" require_relative "openai/models/realtime/realtime_response_create_mcp_tool" @@ -639,7 +641,6 @@ require_relative "openai/models/realtime/realtime_response_usage_output_token_details" require_relative "openai/models/realtime/realtime_server_event" require_relative "openai/models/realtime/realtime_session" -require_relative "openai/models/realtime/realtime_session_client_secret" require_relative "openai/models/realtime/realtime_session_create_response" require_relative "openai/models/realtime/realtime_tool_choice_config" require_relative "openai/models/realtime/realtime_tools_config" diff --git a/lib/openai/models/realtime/audio_transcription.rb b/lib/openai/models/realtime/audio_transcription.rb index c050c137..22efb4d9 100644 --- a/lib/openai/models/realtime/audio_transcription.rb +++ b/lib/openai/models/realtime/audio_transcription.rb @@ -4,6 +4,14 @@ module OpenAI module Models module Realtime class AudioTranscription < OpenAI::Internal::Type::BaseModel + # @!attribute delay + # Controls how long the model waits before emitting transcription text. Higher + # values can improve transcription accuracy at the cost of latency. Only supported + # with `gpt-realtime-whisper` in GA Realtime sessions. + # + # @return [Symbol, OpenAI::Models::Realtime::AudioTranscription::Delay, nil] + optional :delay, enum: -> { OpenAI::Realtime::AudioTranscription::Delay } + # @!attribute language # The language of the input audio. Supplying the input language in # [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) @@ -15,8 +23,8 @@ class AudioTranscription < OpenAI::Internal::Type::BaseModel # @!attribute model # The model to use for transcription. Current options are `whisper-1`, # `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, - # `gpt-4o-transcribe`, and `gpt-4o-transcribe-diarize`. Use - # `gpt-4o-transcribe-diarize` when you need diarization with speaker labels. + # `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. + # Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels. # # @return [String, Symbol, OpenAI::Models::Realtime::AudioTranscription::Model, nil] optional :model, union: -> { OpenAI::Realtime::AudioTranscription::Model } @@ -27,24 +35,45 @@ class AudioTranscription < OpenAI::Internal::Type::BaseModel # [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting). # For `gpt-4o-transcribe` models (excluding `gpt-4o-transcribe-diarize`), the # prompt is a free text string, for example "expect words related to technology". + # Prompt is not supported with `gpt-realtime-whisper` in GA Realtime sessions. # # @return [String, nil] optional :prompt, String - # @!method initialize(language: nil, model: nil, prompt: nil) + # @!method initialize(delay: nil, language: nil, model: nil, prompt: nil) # Some parameter documentations has been truncated, see # {OpenAI::Models::Realtime::AudioTranscription} for more details. # + # @param delay [Symbol, OpenAI::Models::Realtime::AudioTranscription::Delay] Controls how long the model waits before emitting transcription text. + # # @param language [String] The language of the input audio. Supplying the input language in # # @param model [String, Symbol, OpenAI::Models::Realtime::AudioTranscription::Model] The model to use for transcription. Current options are `whisper-1`, `gpt-4o-min # # @param prompt [String] An optional text to guide the model's style or continue a previous audio + # Controls how long the model waits before emitting transcription text. Higher + # values can improve transcription accuracy at the cost of latency. Only supported + # with `gpt-realtime-whisper` in GA Realtime sessions. + # + # @see OpenAI::Models::Realtime::AudioTranscription#delay + module Delay + extend OpenAI::Internal::Type::Enum + + MINIMAL = :minimal + LOW = :low + MEDIUM = :medium + HIGH = :high + XHIGH = :xhigh + + # @!method self.values + # @return [Array] + end + # The model to use for transcription. Current options are `whisper-1`, # `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, - # `gpt-4o-transcribe`, and `gpt-4o-transcribe-diarize`. Use - # `gpt-4o-transcribe-diarize` when you need diarization with speaker labels. + # `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. + # Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels. # # @see OpenAI::Models::Realtime::AudioTranscription#model module Model @@ -62,6 +91,8 @@ module Model variant const: -> { OpenAI::Models::Realtime::AudioTranscription::Model::GPT_4O_TRANSCRIBE_DIARIZE } + variant const: -> { OpenAI::Models::Realtime::AudioTranscription::Model::GPT_REALTIME_WHISPER } + # @!method self.variants # @return [Array(String, Symbol)] @@ -76,6 +107,7 @@ module Model GPT_4O_MINI_TRANSCRIBE_2025_12_15 = :"gpt-4o-mini-transcribe-2025-12-15" GPT_4O_TRANSCRIBE = :"gpt-4o-transcribe" GPT_4O_TRANSCRIBE_DIARIZE = :"gpt-4o-transcribe-diarize" + GPT_REALTIME_WHISPER = :"gpt-realtime-whisper" # @!endgroup end diff --git a/lib/openai/models/realtime/client_secret_create_response.rb b/lib/openai/models/realtime/client_secret_create_response.rb index 11c049b8..57cf5cdb 100644 --- a/lib/openai/models/realtime/client_secret_create_response.rb +++ b/lib/openai/models/realtime/client_secret_create_response.rb @@ -43,8 +43,7 @@ module Session discriminator :type - # A new Realtime session configuration, with an ephemeral key. Default TTL - # for keys is one minute. + # A Realtime session configuration object. variant :realtime, -> { OpenAI::Realtime::RealtimeSessionCreateResponse } # A Realtime transcription session configuration object. diff --git a/lib/openai/models/realtime/realtime_audio_config_input.rb b/lib/openai/models/realtime/realtime_audio_config_input.rb index 37ca5874..d3c670fc 100644 --- a/lib/openai/models/realtime/realtime_audio_config_input.rb +++ b/lib/openai/models/realtime/realtime_audio_config_input.rb @@ -48,6 +48,9 @@ class RealtimeAudioConfigInput < OpenAI::Internal::Type::BaseModel # wait longer for the user to continue speaking. This can be useful for more # natural conversations, but may have a higher latency. # + # For `gpt-realtime-whisper` transcription sessions, turn detection must be set to + # `null`; VAD is not supported. + # # @return [OpenAI::Models::Realtime::RealtimeAudioInputTurnDetection::ServerVad, OpenAI::Models::Realtime::RealtimeAudioInputTurnDetection::SemanticVad, nil] optional :turn_detection, union: -> { OpenAI::Realtime::RealtimeAudioInputTurnDetection }, nil?: true diff --git a/lib/openai/models/realtime/realtime_audio_input_turn_detection.rb b/lib/openai/models/realtime/realtime_audio_input_turn_detection.rb index 81c55b2a..906c728b 100644 --- a/lib/openai/models/realtime/realtime_audio_input_turn_detection.rb +++ b/lib/openai/models/realtime/realtime_audio_input_turn_detection.rb @@ -16,6 +16,9 @@ module Realtime # trails off with "uhhm", the model will score a low probability of turn end and # wait longer for the user to continue speaking. This can be useful for more # natural conversations, but may have a higher latency. + # + # For `gpt-realtime-whisper` transcription sessions, turn detection must be set to + # `null`; VAD is not supported. module RealtimeAudioInputTurnDetection extend OpenAI::Internal::Type::Union diff --git a/lib/openai/models/realtime/realtime_reasoning.rb b/lib/openai/models/realtime/realtime_reasoning.rb new file mode 100644 index 00000000..ae7530f0 --- /dev/null +++ b/lib/openai/models/realtime/realtime_reasoning.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Realtime + class RealtimeReasoning < OpenAI::Internal::Type::BaseModel + # @!attribute effort + # Constrains effort on reasoning for reasoning-capable Realtime models such as + # `gpt-realtime-2`. + # + # @return [Symbol, OpenAI::Models::Realtime::RealtimeReasoningEffort, nil] + optional :effort, enum: -> { OpenAI::Realtime::RealtimeReasoningEffort } + + # @!method initialize(effort: nil) + # Some parameter documentations has been truncated, see + # {OpenAI::Models::Realtime::RealtimeReasoning} for more details. + # + # Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`. + # + # @param effort [Symbol, OpenAI::Models::Realtime::RealtimeReasoningEffort] Constrains effort on reasoning for reasoning-capable Realtime models such as + end + end + end +end diff --git a/lib/openai/models/realtime/realtime_reasoning_effort.rb b/lib/openai/models/realtime/realtime_reasoning_effort.rb new file mode 100644 index 00000000..984ae7f0 --- /dev/null +++ b/lib/openai/models/realtime/realtime_reasoning_effort.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Realtime + # Constrains effort on reasoning for reasoning-capable Realtime models such as + # `gpt-realtime-2`. + module RealtimeReasoningEffort + extend OpenAI::Internal::Type::Enum + + MINIMAL = :minimal + LOW = :low + MEDIUM = :medium + HIGH = :high + XHIGH = :xhigh + + # @!method self.values + # @return [Array] + end + end + end +end diff --git a/lib/openai/models/realtime/realtime_response_create_params.rb b/lib/openai/models/realtime/realtime_response_create_params.rb index 31378b94..8e90c87a 100644 --- a/lib/openai/models/realtime/realtime_response_create_params.rb +++ b/lib/openai/models/realtime/realtime_response_create_params.rb @@ -73,6 +73,13 @@ class RealtimeResponseCreateParams < OpenAI::Internal::Type::BaseModel optional :output_modalities, -> { OpenAI::Internal::Type::ArrayOf[enum: OpenAI::Realtime::RealtimeResponseCreateParams::OutputModality] } + # @!attribute parallel_tool_calls + # Whether the model may call multiple tools in parallel. Only supported by + # reasoning Realtime models such as `gpt-realtime-2`. + # + # @return [Boolean, nil] + optional :parallel_tool_calls, OpenAI::Internal::Type::Boolean + # @!attribute prompt # Reference to a prompt template and its variables. # [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts). @@ -80,6 +87,12 @@ class RealtimeResponseCreateParams < OpenAI::Internal::Type::BaseModel # @return [OpenAI::Models::Responses::ResponsePrompt, nil] optional :prompt, -> { OpenAI::Responses::ResponsePrompt }, nil?: true + # @!attribute reasoning + # Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`. + # + # @return [OpenAI::Models::Realtime::RealtimeReasoning, nil] + optional :reasoning, -> { OpenAI::Realtime::RealtimeReasoning } + # @!attribute tool_choice # How the model chooses tools. Provide one of the string modes or force a specific # function/MCP tool. @@ -94,7 +107,7 @@ class RealtimeResponseCreateParams < OpenAI::Internal::Type::BaseModel optional :tools, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Realtime::RealtimeResponseCreateParams::Tool] } - # @!method initialize(audio: nil, conversation: nil, input: nil, instructions: nil, max_output_tokens: nil, metadata: nil, output_modalities: nil, prompt: nil, tool_choice: nil, tools: nil) + # @!method initialize(audio: nil, conversation: nil, input: nil, instructions: nil, max_output_tokens: nil, metadata: nil, output_modalities: nil, parallel_tool_calls: nil, prompt: nil, reasoning: nil, tool_choice: nil, tools: nil) # Some parameter documentations has been truncated, see # {OpenAI::Models::Realtime::RealtimeResponseCreateParams} for more details. # @@ -114,8 +127,12 @@ class RealtimeResponseCreateParams < OpenAI::Internal::Type::BaseModel # # @param output_modalities [Array] The set of modalities the model used to respond, currently the only possible val # + # @param parallel_tool_calls [Boolean] Whether the model may call multiple tools in parallel. Only supported by + # # @param prompt [OpenAI::Models::Responses::ResponsePrompt, nil] Reference to a prompt template and its variables. # + # @param reasoning [OpenAI::Models::Realtime::RealtimeReasoning] Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`. + # # @param tool_choice [Symbol, OpenAI::Models::Responses::ToolChoiceOptions, OpenAI::Models::Responses::ToolChoiceFunction, OpenAI::Models::Responses::ToolChoiceMcp] How the model chooses tools. Provide one of the string modes or force a specific # # @param tools [Array] Tools available to the model. diff --git a/lib/openai/models/realtime/realtime_session.rb b/lib/openai/models/realtime/realtime_session.rb index 5dcf48a7..81fd4039 100644 --- a/lib/openai/models/realtime/realtime_session.rb +++ b/lib/openai/models/realtime/realtime_session.rb @@ -170,6 +170,9 @@ class RealtimeSession < OpenAI::Internal::Type::BaseModel # wait longer for the user to continue speaking. This can be useful for more # natural conversations, but may have a higher latency. # + # For `gpt-realtime-whisper` transcription sessions, turn detection must be set to + # `null`; VAD is not supported. + # # @return [OpenAI::Models::Realtime::RealtimeSession::TurnDetection::ServerVad, OpenAI::Models::Realtime::RealtimeSession::TurnDetection::SemanticVad, nil] optional :turn_detection, union: -> { OpenAI::Realtime::RealtimeSession::TurnDetection }, nil?: true @@ -468,6 +471,9 @@ class TracingConfiguration < OpenAI::Internal::Type::BaseModel # wait longer for the user to continue speaking. This can be useful for more # natural conversations, but may have a higher latency. # + # For `gpt-realtime-whisper` transcription sessions, turn detection must be set to + # `null`; VAD is not supported. + # # @see OpenAI::Models::Realtime::RealtimeSession#turn_detection module TurnDetection extend OpenAI::Internal::Type::Union diff --git a/lib/openai/models/realtime/realtime_session_client_secret.rb b/lib/openai/models/realtime/realtime_session_client_secret.rb deleted file mode 100644 index 17e6b555..00000000 --- a/lib/openai/models/realtime/realtime_session_client_secret.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -module OpenAI - module Models - module Realtime - class RealtimeSessionClientSecret < OpenAI::Internal::Type::BaseModel - # @!attribute expires_at - # Timestamp for when the token expires. Currently, all tokens expire after one - # minute. - # - # @return [Integer] - required :expires_at, Integer - - # @!attribute value - # Ephemeral key usable in client environments to authenticate connections to the - # Realtime API. Use this in client-side environments rather than a standard API - # token, which should only be used server-side. - # - # @return [String] - required :value, String - - # @!method initialize(expires_at:, value:) - # Some parameter documentations has been truncated, see - # {OpenAI::Models::Realtime::RealtimeSessionClientSecret} for more details. - # - # Ephemeral key returned by the API. - # - # @param expires_at [Integer] Timestamp for when the token expires. Currently, all tokens expire - # - # @param value [String] Ephemeral key usable in client environments to authenticate connections to the R - end - end - - RealtimeSessionClientSecret = Realtime::RealtimeSessionClientSecret - end -end diff --git a/lib/openai/models/realtime/realtime_session_create_request.rb b/lib/openai/models/realtime/realtime_session_create_request.rb index 2df8972d..1e0bb531 100644 --- a/lib/openai/models/realtime/realtime_session_create_request.rb +++ b/lib/openai/models/realtime/realtime_session_create_request.rb @@ -66,6 +66,13 @@ class RealtimeSessionCreateRequest < OpenAI::Internal::Type::BaseModel optional :output_modalities, -> { OpenAI::Internal::Type::ArrayOf[enum: OpenAI::Realtime::RealtimeSessionCreateRequest::OutputModality] } + # @!attribute parallel_tool_calls + # Whether the model may call multiple tools in parallel. Only supported by + # reasoning Realtime models such as `gpt-realtime-2`. + # + # @return [Boolean, nil] + optional :parallel_tool_calls, OpenAI::Internal::Type::Boolean + # @!attribute prompt # Reference to a prompt template and its variables. # [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts). @@ -73,6 +80,12 @@ class RealtimeSessionCreateRequest < OpenAI::Internal::Type::BaseModel # @return [OpenAI::Models::Responses::ResponsePrompt, nil] optional :prompt, -> { OpenAI::Responses::ResponsePrompt }, nil?: true + # @!attribute reasoning + # Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`. + # + # @return [OpenAI::Models::Realtime::RealtimeReasoning, nil] + optional :reasoning, -> { OpenAI::Realtime::RealtimeReasoning } + # @!attribute tool_choice # How the model chooses tools. Provide one of the string modes or force a specific # function/MCP tool. @@ -121,7 +134,7 @@ class RealtimeSessionCreateRequest < OpenAI::Internal::Type::BaseModel # @return [Symbol, OpenAI::Models::Realtime::RealtimeTruncation::RealtimeTruncationStrategy, OpenAI::Models::Realtime::RealtimeTruncationRetentionRatio, nil] optional :truncation, union: -> { OpenAI::Realtime::RealtimeTruncation } - # @!method initialize(audio: nil, include: nil, instructions: nil, max_output_tokens: nil, model: nil, output_modalities: nil, prompt: nil, tool_choice: nil, tools: nil, tracing: nil, truncation: nil, type: :realtime) + # @!method initialize(audio: nil, include: nil, instructions: nil, max_output_tokens: nil, model: nil, output_modalities: nil, parallel_tool_calls: nil, prompt: nil, reasoning: nil, tool_choice: nil, tools: nil, tracing: nil, truncation: nil, type: :realtime) # Some parameter documentations has been truncated, see # {OpenAI::Models::Realtime::RealtimeSessionCreateRequest} for more details. # @@ -139,8 +152,12 @@ class RealtimeSessionCreateRequest < OpenAI::Internal::Type::BaseModel # # @param output_modalities [Array] The set of modalities the model can respond with. It defaults to `["audio"]`, in # + # @param parallel_tool_calls [Boolean] Whether the model may call multiple tools in parallel. Only supported by + # # @param prompt [OpenAI::Models::Responses::ResponsePrompt, nil] Reference to a prompt template and its variables. # + # @param reasoning [OpenAI::Models::Realtime::RealtimeReasoning] Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`. + # # @param tool_choice [Symbol, OpenAI::Models::Responses::ToolChoiceOptions, OpenAI::Models::Responses::ToolChoiceFunction, OpenAI::Models::Responses::ToolChoiceMcp] How the model chooses tools. Provide one of the string modes or force a specific # # @param tools [Array] Tools available to the model. @@ -188,6 +205,8 @@ module Model variant const: -> { OpenAI::Models::Realtime::RealtimeSessionCreateRequest::Model::GPT_REALTIME_1_5 } + variant const: -> { OpenAI::Models::Realtime::RealtimeSessionCreateRequest::Model::GPT_REALTIME_2 } + variant const: -> { OpenAI::Models::Realtime::RealtimeSessionCreateRequest::Model::GPT_REALTIME_2025_08_28 } variant const: -> { OpenAI::Models::Realtime::RealtimeSessionCreateRequest::Model::GPT_4O_REALTIME_PREVIEW } @@ -227,6 +246,7 @@ module Model GPT_REALTIME = :"gpt-realtime" GPT_REALTIME_1_5 = :"gpt-realtime-1.5" + GPT_REALTIME_2 = :"gpt-realtime-2" GPT_REALTIME_2025_08_28 = :"gpt-realtime-2025-08-28" GPT_4O_REALTIME_PREVIEW = :"gpt-4o-realtime-preview" GPT_4O_REALTIME_PREVIEW_2024_10_01 = :"gpt-4o-realtime-preview-2024-10-01" diff --git a/lib/openai/models/realtime/realtime_session_create_response.rb b/lib/openai/models/realtime/realtime_session_create_response.rb index 28fab80c..1d6d9b84 100644 --- a/lib/openai/models/realtime/realtime_session_create_response.rb +++ b/lib/openai/models/realtime/realtime_session_create_response.rb @@ -4,11 +4,17 @@ module OpenAI module Models module Realtime class RealtimeSessionCreateResponse < OpenAI::Internal::Type::BaseModel - # @!attribute client_secret - # Ephemeral key returned by the API. + # @!attribute id + # Unique identifier for the session that looks like `sess_1234567890abcdef`. # - # @return [OpenAI::Models::Realtime::RealtimeSessionClientSecret] - required :client_secret, -> { OpenAI::Realtime::RealtimeSessionClientSecret } + # @return [String] + required :id, String + + # @!attribute object + # The object type. Always `realtime.session`. + # + # @return [Symbol, :"realtime.session"] + required :object, const: :"realtime.session" # @!attribute type # The type of session to create. Always `realtime` for the Realtime API. @@ -22,6 +28,12 @@ class RealtimeSessionCreateResponse < OpenAI::Internal::Type::BaseModel # @return [OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Audio, nil] optional :audio, -> { OpenAI::Realtime::RealtimeSessionCreateResponse::Audio } + # @!attribute expires_at + # Expiration timestamp for the session, in seconds since epoch. + # + # @return [Integer, nil] + optional :expires_at, Integer + # @!attribute include # Additional fields to include in server outputs. # @@ -80,6 +92,12 @@ class RealtimeSessionCreateResponse < OpenAI::Internal::Type::BaseModel # @return [OpenAI::Models::Responses::ResponsePrompt, nil] optional :prompt, -> { OpenAI::Responses::ResponsePrompt }, nil?: true + # @!attribute reasoning + # Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`. + # + # @return [OpenAI::Models::Realtime::RealtimeReasoning, nil] + optional :reasoning, -> { OpenAI::Realtime::RealtimeReasoning } + # @!attribute tool_choice # How the model chooses tools. Provide one of the string modes or force a specific # function/MCP tool. @@ -129,17 +147,18 @@ class RealtimeSessionCreateResponse < OpenAI::Internal::Type::BaseModel # @return [Symbol, OpenAI::Models::Realtime::RealtimeTruncation::RealtimeTruncationStrategy, OpenAI::Models::Realtime::RealtimeTruncationRetentionRatio, nil] optional :truncation, union: -> { OpenAI::Realtime::RealtimeTruncation } - # @!method initialize(client_secret:, audio: nil, include: nil, instructions: nil, max_output_tokens: nil, model: nil, output_modalities: nil, prompt: nil, tool_choice: nil, tools: nil, tracing: nil, truncation: nil, type: :realtime) + # @!method initialize(id:, audio: nil, expires_at: nil, include: nil, instructions: nil, max_output_tokens: nil, model: nil, output_modalities: nil, prompt: nil, reasoning: nil, tool_choice: nil, tools: nil, tracing: nil, truncation: nil, object: :"realtime.session", type: :realtime) # Some parameter documentations has been truncated, see # {OpenAI::Models::Realtime::RealtimeSessionCreateResponse} for more details. # - # A new Realtime session configuration, with an ephemeral key. Default TTL for - # keys is one minute. + # A Realtime session configuration object. # - # @param client_secret [OpenAI::Models::Realtime::RealtimeSessionClientSecret] Ephemeral key returned by the API. + # @param id [String] Unique identifier for the session that looks like `sess_1234567890abcdef`. # # @param audio [OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Audio] Configuration for input and output audio. # + # @param expires_at [Integer] Expiration timestamp for the session, in seconds since epoch. + # # @param include [Array] Additional fields to include in server outputs. # # @param instructions [String] The default system instructions (i.e. system message) prepended to model calls. @@ -152,6 +171,8 @@ class RealtimeSessionCreateResponse < OpenAI::Internal::Type::BaseModel # # @param prompt [OpenAI::Models::Responses::ResponsePrompt, nil] Reference to a prompt template and its variables. # + # @param reasoning [OpenAI::Models::Realtime::RealtimeReasoning] Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`. + # # @param tool_choice [Symbol, OpenAI::Models::Responses::ToolChoiceOptions, OpenAI::Models::Responses::ToolChoiceFunction, OpenAI::Models::Responses::ToolChoiceMcp] How the model chooses tools. Provide one of the string modes or force a specific # # @param tools [Array] Tools available to the model. @@ -160,6 +181,8 @@ class RealtimeSessionCreateResponse < OpenAI::Internal::Type::BaseModel # # @param truncation [Symbol, OpenAI::Models::Realtime::RealtimeTruncation::RealtimeTruncationStrategy, OpenAI::Models::Realtime::RealtimeTruncationRetentionRatio] When the number of tokens in a conversation exceeds the model's input token limi # + # @param object [Symbol, :"realtime.session"] The object type. Always `realtime.session`. + # # @param type [Symbol, :realtime] The type of session to create. Always `realtime` for the Realtime API. # @see OpenAI::Models::Realtime::RealtimeSessionCreateResponse#audio @@ -200,14 +223,6 @@ class Input < OpenAI::Internal::Type::BaseModel -> { OpenAI::Realtime::RealtimeSessionCreateResponse::Audio::Input::NoiseReduction } # @!attribute transcription - # Configuration for input audio transcription, defaults to off and can be set to - # `null` to turn off once on. Input audio transcription is not native to the - # model, since the model consumes audio directly. Transcription runs - # asynchronously through - # [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription) - # and should be treated as guidance of input audio content rather than precisely - # what the model heard. The client can optionally set the language and prompt for - # transcription, these offer additional guidance to the transcription service. # # @return [OpenAI::Models::Realtime::AudioTranscription, nil] optional :transcription, -> { OpenAI::Realtime::AudioTranscription } @@ -227,6 +242,9 @@ class Input < OpenAI::Internal::Type::BaseModel # wait longer for the user to continue speaking. This can be useful for more # natural conversations, but may have a higher latency. # + # For `gpt-realtime-whisper` transcription sessions, turn detection must be set to + # `null`; VAD is not supported. + # # @return [OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Audio::Input::TurnDetection::ServerVad, OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Audio::Input::TurnDetection::SemanticVad, nil] optional :turn_detection, union: -> { @@ -243,7 +261,7 @@ class Input < OpenAI::Internal::Type::BaseModel # # @param noise_reduction [OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Audio::Input::NoiseReduction] Configuration for input audio noise reduction. This can be set to `null` to turn # - # @param transcription [OpenAI::Models::Realtime::AudioTranscription] Configuration for input audio transcription, defaults to off and can be set to ` + # @param transcription [OpenAI::Models::Realtime::AudioTranscription] # # @param turn_detection [OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Audio::Input::TurnDetection::ServerVad, OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Audio::Input::TurnDetection::SemanticVad, nil] Configuration for turn detection, ether Server VAD or Semantic VAD. This can be @@ -285,6 +303,9 @@ class NoiseReduction < OpenAI::Internal::Type::BaseModel # wait longer for the user to continue speaking. This can be useful for more # natural conversations, but may have a higher latency. # + # For `gpt-realtime-whisper` transcription sessions, turn detection must be set to + # `null`; VAD is not supported. + # # @see OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Audio::Input#turn_detection module TurnDetection extend OpenAI::Internal::Type::Union @@ -597,6 +618,8 @@ module Model variant const: -> { OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Model::GPT_REALTIME_1_5 } + variant const: -> { OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Model::GPT_REALTIME_2 } + variant const: -> { OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Model::GPT_REALTIME_2025_08_28 } variant const: -> { OpenAI::Models::Realtime::RealtimeSessionCreateResponse::Model::GPT_4O_REALTIME_PREVIEW } @@ -636,6 +659,7 @@ module Model GPT_REALTIME = :"gpt-realtime" GPT_REALTIME_1_5 = :"gpt-realtime-1.5" + GPT_REALTIME_2 = :"gpt-realtime-2" GPT_REALTIME_2025_08_28 = :"gpt-realtime-2025-08-28" GPT_4O_REALTIME_PREVIEW = :"gpt-4o-realtime-preview" GPT_4O_REALTIME_PREVIEW_2024_10_01 = :"gpt-4o-realtime-preview-2024-10-01" diff --git a/lib/openai/models/realtime/realtime_transcription_session_audio_input.rb b/lib/openai/models/realtime/realtime_transcription_session_audio_input.rb index fc5fb231..b49f0e16 100644 --- a/lib/openai/models/realtime/realtime_transcription_session_audio_input.rb +++ b/lib/openai/models/realtime/realtime_transcription_session_audio_input.rb @@ -48,6 +48,9 @@ class RealtimeTranscriptionSessionAudioInput < OpenAI::Internal::Type::BaseModel # wait longer for the user to continue speaking. This can be useful for more # natural conversations, but may have a higher latency. # + # For `gpt-realtime-whisper` transcription sessions, turn detection must be set to + # `null`; VAD is not supported. + # # @return [OpenAI::Models::Realtime::RealtimeTranscriptionSessionAudioInputTurnDetection::ServerVad, OpenAI::Models::Realtime::RealtimeTranscriptionSessionAudioInputTurnDetection::SemanticVad, nil] optional :turn_detection, union: -> { OpenAI::Realtime::RealtimeTranscriptionSessionAudioInputTurnDetection }, diff --git a/lib/openai/models/realtime/realtime_transcription_session_audio_input_turn_detection.rb b/lib/openai/models/realtime/realtime_transcription_session_audio_input_turn_detection.rb index 10d59407..0287e367 100644 --- a/lib/openai/models/realtime/realtime_transcription_session_audio_input_turn_detection.rb +++ b/lib/openai/models/realtime/realtime_transcription_session_audio_input_turn_detection.rb @@ -16,6 +16,9 @@ module Realtime # trails off with "uhhm", the model will score a low probability of turn end and # wait longer for the user to continue speaking. This can be useful for more # natural conversations, but may have a higher latency. + # + # For `gpt-realtime-whisper` transcription sessions, turn detection must be set to + # `null`; VAD is not supported. module RealtimeTranscriptionSessionAudioInputTurnDetection extend OpenAI::Internal::Type::Union diff --git a/lib/openai/models/realtime/realtime_transcription_session_create_response.rb b/lib/openai/models/realtime/realtime_transcription_session_create_response.rb index 56b2509f..91f54db4 100644 --- a/lib/openai/models/realtime/realtime_transcription_session_create_response.rb +++ b/lib/openai/models/realtime/realtime_transcription_session_create_response.rb @@ -91,7 +91,6 @@ class Input < OpenAI::Internal::Type::BaseModel -> { OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input::NoiseReduction } # @!attribute transcription - # Configuration of the transcription model. # # @return [OpenAI::Models::Realtime::AudioTranscription, nil] optional :transcription, -> { OpenAI::Realtime::AudioTranscription } @@ -99,10 +98,15 @@ class Input < OpenAI::Internal::Type::BaseModel # @!attribute turn_detection # Configuration for turn detection. Can be set to `null` to turn off. Server VAD # means that the model will detect the start and end of speech based on audio - # volume and respond at the end of user speech. + # volume and respond at the end of user speech. For `gpt-realtime-whisper`, this + # must be `null`; VAD is not supported. # # @return [OpenAI::Models::Realtime::RealtimeTranscriptionSessionTurnDetection, nil] - optional :turn_detection, -> { OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection } + optional :turn_detection, + -> { + OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection + }, + nil?: true # @!method initialize(format_: nil, noise_reduction: nil, transcription: nil, turn_detection: nil) # Some parameter documentations has been truncated, see @@ -113,9 +117,9 @@ class Input < OpenAI::Internal::Type::BaseModel # # @param noise_reduction [OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input::NoiseReduction] Configuration for input audio noise reduction. # - # @param transcription [OpenAI::Models::Realtime::AudioTranscription] Configuration of the transcription model. + # @param transcription [OpenAI::Models::Realtime::AudioTranscription] # - # @param turn_detection [OpenAI::Models::Realtime::RealtimeTranscriptionSessionTurnDetection] Configuration for turn detection. Can be set to `null` to turn off. Server + # @param turn_detection [OpenAI::Models::Realtime::RealtimeTranscriptionSessionTurnDetection, nil] Configuration for turn detection. Can be set to `null` to turn off. Server # @see OpenAI::Models::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input#noise_reduction class NoiseReduction < OpenAI::Internal::Type::BaseModel diff --git a/lib/openai/models/realtime/realtime_transcription_session_turn_detection.rb b/lib/openai/models/realtime/realtime_transcription_session_turn_detection.rb index e7f1ba0c..2dd54610 100644 --- a/lib/openai/models/realtime/realtime_transcription_session_turn_detection.rb +++ b/lib/openai/models/realtime/realtime_transcription_session_turn_detection.rb @@ -40,7 +40,8 @@ class RealtimeTranscriptionSessionTurnDetection < OpenAI::Internal::Type::BaseMo # # Configuration for turn detection. Can be set to `null` to turn off. Server VAD # means that the model will detect the start and end of speech based on audio - # volume and respond at the end of user speech. + # volume and respond at the end of user speech. For `gpt-realtime-whisper`, this + # must be `null`; VAD is not supported. # # @param prefix_padding_ms [Integer] Amount of audio to include before the VAD detected speech (in # diff --git a/lib/openai/models/realtime/transcription_session_updated_event.rb b/lib/openai/models/realtime/transcription_session_updated_event.rb index 4896696e..184be669 100644 --- a/lib/openai/models/realtime/transcription_session_updated_event.rb +++ b/lib/openai/models/realtime/transcription_session_updated_event.rb @@ -55,7 +55,6 @@ class Session < OpenAI::Internal::Type::BaseModel optional :input_audio_format, String # @!attribute input_audio_transcription - # Configuration of the transcription model. # # @return [OpenAI::Models::Realtime::AudioTranscription, nil] optional :input_audio_transcription, -> { OpenAI::Realtime::AudioTranscription } @@ -92,7 +91,7 @@ class Session < OpenAI::Internal::Type::BaseModel # # @param input_audio_format [String] The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. # - # @param input_audio_transcription [OpenAI::Models::Realtime::AudioTranscription] Configuration of the transcription model. + # @param input_audio_transcription [OpenAI::Models::Realtime::AudioTranscription] # # @param modalities [Array] The set of modalities the model can respond with. To disable audio, # diff --git a/lib/openai/resources/realtime/calls.rb b/lib/openai/resources/realtime/calls.rb index 80df2d8c..a0cfb6f4 100644 --- a/lib/openai/resources/realtime/calls.rb +++ b/lib/openai/resources/realtime/calls.rb @@ -10,7 +10,7 @@ class Calls # Accept an incoming SIP call and configure the realtime session that will handle # it. # - # @overload accept(call_id, audio: nil, include: nil, instructions: nil, max_output_tokens: nil, model: nil, output_modalities: nil, prompt: nil, tool_choice: nil, tools: nil, tracing: nil, truncation: nil, type: :realtime, request_options: {}) + # @overload accept(call_id, audio: nil, include: nil, instructions: nil, max_output_tokens: nil, model: nil, output_modalities: nil, parallel_tool_calls: nil, prompt: nil, reasoning: nil, tool_choice: nil, tools: nil, tracing: nil, truncation: nil, type: :realtime, request_options: {}) # # @param call_id [String] The identifier for the call provided in the # @@ -26,8 +26,12 @@ class Calls # # @param output_modalities [Array] The set of modalities the model can respond with. It defaults to `["audio"]`, in # + # @param parallel_tool_calls [Boolean] Whether the model may call multiple tools in parallel. Only supported by + # # @param prompt [OpenAI::Models::Responses::ResponsePrompt, nil] Reference to a prompt template and its variables. # + # @param reasoning [OpenAI::Models::Realtime::RealtimeReasoning] Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`. + # # @param tool_choice [Symbol, OpenAI::Models::Responses::ToolChoiceOptions, OpenAI::Models::Responses::ToolChoiceFunction, OpenAI::Models::Responses::ToolChoiceMcp] How the model chooses tools. Provide one of the string modes or force a specific # # @param tools [Array] Tools available to the model. diff --git a/rbi/openai/models/realtime/audio_transcription.rbi b/rbi/openai/models/realtime/audio_transcription.rbi index 0a13c957..3ea92c44 100644 --- a/rbi/openai/models/realtime/audio_transcription.rbi +++ b/rbi/openai/models/realtime/audio_transcription.rbi @@ -12,6 +12,23 @@ module OpenAI ) end + # Controls how long the model waits before emitting transcription text. Higher + # values can improve transcription accuracy at the cost of latency. Only supported + # with `gpt-realtime-whisper` in GA Realtime sessions. + sig do + returns( + T.nilable(OpenAI::Realtime::AudioTranscription::Delay::OrSymbol) + ) + end + attr_reader :delay + + sig do + params( + delay: OpenAI::Realtime::AudioTranscription::Delay::OrSymbol + ).void + end + attr_writer :delay + # The language of the input audio. Supplying the input language in # [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) # format will improve accuracy and latency. @@ -23,8 +40,8 @@ module OpenAI # The model to use for transcription. Current options are `whisper-1`, # `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, - # `gpt-4o-transcribe`, and `gpt-4o-transcribe-diarize`. Use - # `gpt-4o-transcribe-diarize` when you need diarization with speaker labels. + # `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. + # Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels. sig do returns( T.nilable( @@ -53,6 +70,7 @@ module OpenAI # [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting). # For `gpt-4o-transcribe` models (excluding `gpt-4o-transcribe-diarize`), the # prompt is a free text string, for example "expect words related to technology". + # Prompt is not supported with `gpt-realtime-whisper` in GA Realtime sessions. sig { returns(T.nilable(String)) } attr_reader :prompt @@ -61,6 +79,7 @@ module OpenAI sig do params( + delay: OpenAI::Realtime::AudioTranscription::Delay::OrSymbol, language: String, model: T.any( @@ -71,20 +90,25 @@ module OpenAI ).returns(T.attached_class) end def self.new( + # Controls how long the model waits before emitting transcription text. Higher + # values can improve transcription accuracy at the cost of latency. Only supported + # with `gpt-realtime-whisper` in GA Realtime sessions. + delay: nil, # The language of the input audio. Supplying the input language in # [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) # format will improve accuracy and latency. language: nil, # The model to use for transcription. Current options are `whisper-1`, # `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, - # `gpt-4o-transcribe`, and `gpt-4o-transcribe-diarize`. Use - # `gpt-4o-transcribe-diarize` when you need diarization with speaker labels. + # `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. + # Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels. model: nil, # An optional text to guide the model's style or continue a previous audio # segment. For `whisper-1`, the # [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting). # For `gpt-4o-transcribe` models (excluding `gpt-4o-transcribe-diarize`), the # prompt is a free text string, for example "expect words related to technology". + # Prompt is not supported with `gpt-realtime-whisper` in GA Realtime sessions. prompt: nil ) end @@ -92,6 +116,7 @@ module OpenAI sig do override.returns( { + delay: OpenAI::Realtime::AudioTranscription::Delay::OrSymbol, language: String, model: T.any( @@ -105,10 +130,59 @@ module OpenAI def to_hash end + # Controls how long the model waits before emitting transcription text. Higher + # values can improve transcription accuracy at the cost of latency. Only supported + # with `gpt-realtime-whisper` in GA Realtime sessions. + module Delay + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, OpenAI::Realtime::AudioTranscription::Delay) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + MINIMAL = + T.let( + :minimal, + OpenAI::Realtime::AudioTranscription::Delay::TaggedSymbol + ) + LOW = + T.let( + :low, + OpenAI::Realtime::AudioTranscription::Delay::TaggedSymbol + ) + MEDIUM = + T.let( + :medium, + OpenAI::Realtime::AudioTranscription::Delay::TaggedSymbol + ) + HIGH = + T.let( + :high, + OpenAI::Realtime::AudioTranscription::Delay::TaggedSymbol + ) + XHIGH = + T.let( + :xhigh, + OpenAI::Realtime::AudioTranscription::Delay::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + OpenAI::Realtime::AudioTranscription::Delay::TaggedSymbol + ] + ) + end + def self.values + end + end + # The model to use for transcription. Current options are `whisper-1`, # `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, - # `gpt-4o-transcribe`, and `gpt-4o-transcribe-diarize`. Use - # `gpt-4o-transcribe-diarize` when you need diarization with speaker labels. + # `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. + # Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels. module Model extend OpenAI::Internal::Type::Union @@ -159,6 +233,11 @@ module OpenAI :"gpt-4o-transcribe-diarize", OpenAI::Realtime::AudioTranscription::Model::TaggedSymbol ) + GPT_REALTIME_WHISPER = + T.let( + :"gpt-realtime-whisper", + OpenAI::Realtime::AudioTranscription::Model::TaggedSymbol + ) end end end diff --git a/rbi/openai/models/realtime/realtime_audio_config_input.rbi b/rbi/openai/models/realtime/realtime_audio_config_input.rbi index fb2e2697..a21fca6b 100644 --- a/rbi/openai/models/realtime/realtime_audio_config_input.rbi +++ b/rbi/openai/models/realtime/realtime_audio_config_input.rbi @@ -91,6 +91,9 @@ module OpenAI # trails off with "uhhm", the model will score a low probability of turn end and # wait longer for the user to continue speaking. This can be useful for more # natural conversations, but may have a higher latency. + # + # For `gpt-realtime-whisper` transcription sessions, turn detection must be set to + # `null`; VAD is not supported. sig do returns( T.nilable( @@ -154,6 +157,9 @@ module OpenAI # trails off with "uhhm", the model will score a low probability of turn end and # wait longer for the user to continue speaking. This can be useful for more # natural conversations, but may have a higher latency. + # + # For `gpt-realtime-whisper` transcription sessions, turn detection must be set to + # `null`; VAD is not supported. turn_detection: nil ) end diff --git a/rbi/openai/models/realtime/realtime_audio_input_turn_detection.rbi b/rbi/openai/models/realtime/realtime_audio_input_turn_detection.rbi index ac1de18b..649a0155 100644 --- a/rbi/openai/models/realtime/realtime_audio_input_turn_detection.rbi +++ b/rbi/openai/models/realtime/realtime_audio_input_turn_detection.rbi @@ -16,6 +16,9 @@ module OpenAI # trails off with "uhhm", the model will score a low probability of turn end and # wait longer for the user to continue speaking. This can be useful for more # natural conversations, but may have a higher latency. + # + # For `gpt-realtime-whisper` transcription sessions, turn detection must be set to + # `null`; VAD is not supported. module RealtimeAudioInputTurnDetection extend OpenAI::Internal::Type::Union diff --git a/rbi/openai/models/realtime/realtime_reasoning.rbi b/rbi/openai/models/realtime/realtime_reasoning.rbi new file mode 100644 index 00000000..12fd7217 --- /dev/null +++ b/rbi/openai/models/realtime/realtime_reasoning.rbi @@ -0,0 +1,54 @@ +# typed: strong + +module OpenAI + module Models + module Realtime + class RealtimeReasoning < OpenAI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + OpenAI::Realtime::RealtimeReasoning, + OpenAI::Internal::AnyHash + ) + end + + # Constrains effort on reasoning for reasoning-capable Realtime models such as + # `gpt-realtime-2`. + sig do + returns( + T.nilable(OpenAI::Realtime::RealtimeReasoningEffort::OrSymbol) + ) + end + attr_reader :effort + + sig do + params( + effort: OpenAI::Realtime::RealtimeReasoningEffort::OrSymbol + ).void + end + attr_writer :effort + + # Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`. + sig do + params( + effort: OpenAI::Realtime::RealtimeReasoningEffort::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Constrains effort on reasoning for reasoning-capable Realtime models such as + # `gpt-realtime-2`. + effort: nil + ) + end + + sig do + override.returns( + { effort: OpenAI::Realtime::RealtimeReasoningEffort::OrSymbol } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/openai/models/realtime/realtime_reasoning_effort.rbi b/rbi/openai/models/realtime/realtime_reasoning_effort.rbi new file mode 100644 index 00000000..ebcc9183 --- /dev/null +++ b/rbi/openai/models/realtime/realtime_reasoning_effort.rbi @@ -0,0 +1,44 @@ +# typed: strong + +module OpenAI + module Models + module Realtime + # Constrains effort on reasoning for reasoning-capable Realtime models such as + # `gpt-realtime-2`. + module RealtimeReasoningEffort + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, OpenAI::Realtime::RealtimeReasoningEffort) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + MINIMAL = + T.let( + :minimal, + OpenAI::Realtime::RealtimeReasoningEffort::TaggedSymbol + ) + LOW = + T.let(:low, OpenAI::Realtime::RealtimeReasoningEffort::TaggedSymbol) + MEDIUM = + T.let( + :medium, + OpenAI::Realtime::RealtimeReasoningEffort::TaggedSymbol + ) + HIGH = + T.let(:high, OpenAI::Realtime::RealtimeReasoningEffort::TaggedSymbol) + XHIGH = + T.let(:xhigh, OpenAI::Realtime::RealtimeReasoningEffort::TaggedSymbol) + + sig do + override.returns( + T::Array[OpenAI::Realtime::RealtimeReasoningEffort::TaggedSymbol] + ) + end + def self.values + end + end + end + end +end diff --git a/rbi/openai/models/realtime/realtime_response_create_params.rbi b/rbi/openai/models/realtime/realtime_response_create_params.rbi index 18dbbadf..030812b2 100644 --- a/rbi/openai/models/realtime/realtime_response_create_params.rbi +++ b/rbi/openai/models/realtime/realtime_response_create_params.rbi @@ -159,6 +159,14 @@ module OpenAI end attr_writer :output_modalities + # Whether the model may call multiple tools in parallel. Only supported by + # reasoning Realtime models such as `gpt-realtime-2`. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :parallel_tool_calls + + sig { params(parallel_tool_calls: T::Boolean).void } + attr_writer :parallel_tool_calls + # Reference to a prompt template and its variables. # [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts). sig { returns(T.nilable(OpenAI::Responses::ResponsePrompt)) } @@ -171,6 +179,15 @@ module OpenAI end attr_writer :prompt + # Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`. + sig { returns(T.nilable(OpenAI::Realtime::RealtimeReasoning)) } + attr_reader :reasoning + + sig do + params(reasoning: OpenAI::Realtime::RealtimeReasoning::OrHash).void + end + attr_writer :reasoning + # How the model chooses tools. Provide one of the string modes or force a specific # function/MCP tool. sig do @@ -256,7 +273,9 @@ module OpenAI T::Array[ OpenAI::Realtime::RealtimeResponseCreateParams::OutputModality::OrSymbol ], + parallel_tool_calls: T::Boolean, prompt: T.nilable(OpenAI::Responses::ResponsePrompt::OrHash), + reasoning: OpenAI::Realtime::RealtimeReasoning::OrHash, tool_choice: T.any( OpenAI::Responses::ToolChoiceOptions::OrSymbol, @@ -313,9 +332,14 @@ module OpenAI # transcript. Setting the output to mode `text` will disable audio output from the # model. output_modalities: nil, + # Whether the model may call multiple tools in parallel. Only supported by + # reasoning Realtime models such as `gpt-realtime-2`. + parallel_tool_calls: nil, # Reference to a prompt template and its variables. # [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts). prompt: nil, + # Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`. + reasoning: nil, # How the model chooses tools. Provide one of the string modes or force a specific # function/MCP tool. tool_choice: nil, @@ -354,7 +378,9 @@ module OpenAI T::Array[ OpenAI::Realtime::RealtimeResponseCreateParams::OutputModality::OrSymbol ], + parallel_tool_calls: T::Boolean, prompt: T.nilable(OpenAI::Responses::ResponsePrompt), + reasoning: OpenAI::Realtime::RealtimeReasoning, tool_choice: T.any( OpenAI::Responses::ToolChoiceOptions::OrSymbol, diff --git a/rbi/openai/models/realtime/realtime_session.rbi b/rbi/openai/models/realtime/realtime_session.rbi index d3769d20..6625edcd 100644 --- a/rbi/openai/models/realtime/realtime_session.rbi +++ b/rbi/openai/models/realtime/realtime_session.rbi @@ -274,6 +274,9 @@ module OpenAI # trails off with "uhhm", the model will score a low probability of turn end and # wait longer for the user to continue speaking. This can be useful for more # natural conversations, but may have a higher latency. + # + # For `gpt-realtime-whisper` transcription sessions, turn detection must be set to + # `null`; VAD is not supported. sig do returns( T.nilable( @@ -442,6 +445,9 @@ module OpenAI # trails off with "uhhm", the model will score a low probability of turn end and # wait longer for the user to continue speaking. This can be useful for more # natural conversations, but may have a higher latency. + # + # For `gpt-realtime-whisper` transcription sessions, turn detection must be set to + # `null`; VAD is not supported. turn_detection: nil, # The voice the model uses to respond. Voice cannot be changed during the session # once the model has responded with audio at least once. Current voice options are @@ -948,6 +954,9 @@ module OpenAI # trails off with "uhhm", the model will score a low probability of turn end and # wait longer for the user to continue speaking. This can be useful for more # natural conversations, but may have a higher latency. + # + # For `gpt-realtime-whisper` transcription sessions, turn detection must be set to + # `null`; VAD is not supported. module TurnDetection extend OpenAI::Internal::Type::Union diff --git a/rbi/openai/models/realtime/realtime_session_client_secret.rbi b/rbi/openai/models/realtime/realtime_session_client_secret.rbi deleted file mode 100644 index b23e1135..00000000 --- a/rbi/openai/models/realtime/realtime_session_client_secret.rbi +++ /dev/null @@ -1,49 +0,0 @@ -# typed: strong - -module OpenAI - module Models - RealtimeSessionClientSecret = Realtime::RealtimeSessionClientSecret - - module Realtime - class RealtimeSessionClientSecret < OpenAI::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - OpenAI::Realtime::RealtimeSessionClientSecret, - OpenAI::Internal::AnyHash - ) - end - - # Timestamp for when the token expires. Currently, all tokens expire after one - # minute. - sig { returns(Integer) } - attr_accessor :expires_at - - # Ephemeral key usable in client environments to authenticate connections to the - # Realtime API. Use this in client-side environments rather than a standard API - # token, which should only be used server-side. - sig { returns(String) } - attr_accessor :value - - # Ephemeral key returned by the API. - sig do - params(expires_at: Integer, value: String).returns(T.attached_class) - end - def self.new( - # Timestamp for when the token expires. Currently, all tokens expire after one - # minute. - expires_at:, - # Ephemeral key usable in client environments to authenticate connections to the - # Realtime API. Use this in client-side environments rather than a standard API - # token, which should only be used server-side. - value: - ) - end - - sig { override.returns({ expires_at: Integer, value: String }) } - def to_hash - end - end - end - end -end diff --git a/rbi/openai/models/realtime/realtime_session_create_request.rbi b/rbi/openai/models/realtime/realtime_session_create_request.rbi index 0ab64e04..ae4a260f 100644 --- a/rbi/openai/models/realtime/realtime_session_create_request.rbi +++ b/rbi/openai/models/realtime/realtime_session_create_request.rbi @@ -125,6 +125,14 @@ module OpenAI end attr_writer :output_modalities + # Whether the model may call multiple tools in parallel. Only supported by + # reasoning Realtime models such as `gpt-realtime-2`. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :parallel_tool_calls + + sig { params(parallel_tool_calls: T::Boolean).void } + attr_writer :parallel_tool_calls + # Reference to a prompt template and its variables. # [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts). sig { returns(T.nilable(OpenAI::Responses::ResponsePrompt)) } @@ -137,6 +145,15 @@ module OpenAI end attr_writer :prompt + # Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`. + sig { returns(T.nilable(OpenAI::Realtime::RealtimeReasoning)) } + attr_reader :reasoning + + sig do + params(reasoning: OpenAI::Realtime::RealtimeReasoning::OrHash).void + end + attr_writer :reasoning + # How the model chooses tools. Provide one of the string modes or force a specific # function/MCP tool. sig do @@ -271,7 +288,9 @@ module OpenAI T::Array[ OpenAI::Realtime::RealtimeSessionCreateRequest::OutputModality::OrSymbol ], + parallel_tool_calls: T::Boolean, prompt: T.nilable(OpenAI::Responses::ResponsePrompt::OrHash), + reasoning: OpenAI::Realtime::RealtimeReasoning::OrHash, tool_choice: T.any( OpenAI::Responses::ToolChoiceOptions::OrSymbol, @@ -331,9 +350,14 @@ module OpenAI # can be used to make the model respond with text only. It is not possible to # request both `text` and `audio` at the same time. output_modalities: nil, + # Whether the model may call multiple tools in parallel. Only supported by + # reasoning Realtime models such as `gpt-realtime-2`. + parallel_tool_calls: nil, # Reference to a prompt template and its variables. # [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts). prompt: nil, + # Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`. + reasoning: nil, # How the model chooses tools. Provide one of the string modes or force a specific # function/MCP tool. tool_choice: nil, @@ -391,7 +415,9 @@ module OpenAI T::Array[ OpenAI::Realtime::RealtimeSessionCreateRequest::OutputModality::OrSymbol ], + parallel_tool_calls: T::Boolean, prompt: T.nilable(OpenAI::Responses::ResponsePrompt), + reasoning: OpenAI::Realtime::RealtimeReasoning, tool_choice: T.any( OpenAI::Responses::ToolChoiceOptions::OrSymbol, @@ -512,6 +538,11 @@ module OpenAI :"gpt-realtime-1.5", OpenAI::Realtime::RealtimeSessionCreateRequest::Model::TaggedSymbol ) + GPT_REALTIME_2 = + T.let( + :"gpt-realtime-2", + OpenAI::Realtime::RealtimeSessionCreateRequest::Model::TaggedSymbol + ) GPT_REALTIME_2025_08_28 = T.let( :"gpt-realtime-2025-08-28", diff --git a/rbi/openai/models/realtime/realtime_session_create_response.rbi b/rbi/openai/models/realtime/realtime_session_create_response.rbi index 8dfaede4..d79ab65d 100644 --- a/rbi/openai/models/realtime/realtime_session_create_response.rbi +++ b/rbi/openai/models/realtime/realtime_session_create_response.rbi @@ -14,16 +14,13 @@ module OpenAI ) end - # Ephemeral key returned by the API. - sig { returns(OpenAI::Realtime::RealtimeSessionClientSecret) } - attr_reader :client_secret + # Unique identifier for the session that looks like `sess_1234567890abcdef`. + sig { returns(String) } + attr_accessor :id - sig do - params( - client_secret: OpenAI::Realtime::RealtimeSessionClientSecret::OrHash - ).void - end - attr_writer :client_secret + # The object type. Always `realtime.session`. + sig { returns(Symbol) } + attr_accessor :object # The type of session to create. Always `realtime` for the Realtime API. sig { returns(Symbol) } @@ -45,6 +42,13 @@ module OpenAI end attr_writer :audio + # Expiration timestamp for the session, in seconds since epoch. + sig { returns(T.nilable(Integer)) } + attr_reader :expires_at + + sig { params(expires_at: Integer).void } + attr_writer :expires_at + # Additional fields to include in server outputs. # # `item.input_audio_transcription.logprobs`: Include logprobs for input audio @@ -160,6 +164,15 @@ module OpenAI end attr_writer :prompt + # Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`. + sig { returns(T.nilable(OpenAI::Realtime::RealtimeReasoning)) } + attr_reader :reasoning + + sig do + params(reasoning: OpenAI::Realtime::RealtimeReasoning::OrHash).void + end + attr_writer :reasoning + # How the model chooses tools. Provide one of the string modes or force a specific # function/MCP tool. sig do @@ -258,14 +271,13 @@ module OpenAI end attr_writer :truncation - # A new Realtime session configuration, with an ephemeral key. Default TTL for - # keys is one minute. + # A Realtime session configuration object. sig do params( - client_secret: - OpenAI::Realtime::RealtimeSessionClientSecret::OrHash, + id: String, audio: OpenAI::Realtime::RealtimeSessionCreateResponse::Audio::OrHash, + expires_at: Integer, include: T::Array[ OpenAI::Realtime::RealtimeSessionCreateResponse::Include::OrSymbol @@ -282,6 +294,7 @@ module OpenAI OpenAI::Realtime::RealtimeSessionCreateResponse::OutputModality::OrSymbol ], prompt: T.nilable(OpenAI::Responses::ResponsePrompt::OrHash), + reasoning: OpenAI::Realtime::RealtimeReasoning::OrHash, tool_choice: T.any( OpenAI::Responses::ToolChoiceOptions::OrSymbol, @@ -307,14 +320,17 @@ module OpenAI OpenAI::Realtime::RealtimeTruncation::RealtimeTruncationStrategy::OrSymbol, OpenAI::Realtime::RealtimeTruncationRetentionRatio::OrHash ), + object: Symbol, type: Symbol ).returns(T.attached_class) end def self.new( - # Ephemeral key returned by the API. - client_secret:, + # Unique identifier for the session that looks like `sess_1234567890abcdef`. + id:, # Configuration for input and output audio. audio: nil, + # Expiration timestamp for the session, in seconds since epoch. + expires_at: nil, # Additional fields to include in server outputs. # # `item.input_audio_transcription.logprobs`: Include logprobs for input audio @@ -346,6 +362,8 @@ module OpenAI # Reference to a prompt template and its variables. # [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts). prompt: nil, + # Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`. + reasoning: nil, # How the model chooses tools. Provide one of the string modes or force a specific # function/MCP tool. tool_choice: nil, @@ -378,6 +396,8 @@ module OpenAI # but would instead return an error if the conversation exceeds the model's input # token limit. truncation: nil, + # The object type. Always `realtime.session`. + object: :"realtime.session", # The type of session to create. Always `realtime` for the Realtime API. type: :realtime ) @@ -386,9 +406,11 @@ module OpenAI sig do override.returns( { - client_secret: OpenAI::Realtime::RealtimeSessionClientSecret, + id: String, + object: Symbol, type: Symbol, audio: OpenAI::Realtime::RealtimeSessionCreateResponse::Audio, + expires_at: Integer, include: T::Array[ OpenAI::Realtime::RealtimeSessionCreateResponse::Include::TaggedSymbol @@ -403,6 +425,7 @@ module OpenAI OpenAI::Realtime::RealtimeSessionCreateResponse::OutputModality::TaggedSymbol ], prompt: T.nilable(OpenAI::Responses::ResponsePrompt), + reasoning: OpenAI::Realtime::RealtimeReasoning, tool_choice: OpenAI::Realtime::RealtimeSessionCreateResponse::ToolChoice::Variants, tools: @@ -539,14 +562,6 @@ module OpenAI end attr_writer :noise_reduction - # Configuration for input audio transcription, defaults to off and can be set to - # `null` to turn off once on. Input audio transcription is not native to the - # model, since the model consumes audio directly. Transcription runs - # asynchronously through - # [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription) - # and should be treated as guidance of input audio content rather than precisely - # what the model heard. The client can optionally set the language and prompt for - # transcription, these offer additional guidance to the transcription service. sig { returns(T.nilable(OpenAI::Realtime::AudioTranscription)) } attr_reader :transcription @@ -570,6 +585,9 @@ module OpenAI # trails off with "uhhm", the model will score a low probability of turn end and # wait longer for the user to continue speaking. This can be useful for more # natural conversations, but may have a higher latency. + # + # For `gpt-realtime-whisper` transcription sessions, turn detection must be set to + # `null`; VAD is not supported. sig do returns( T.nilable( @@ -608,14 +626,6 @@ module OpenAI # detection accuracy (reducing false positives) and model performance by improving # perception of the input audio. noise_reduction: nil, - # Configuration for input audio transcription, defaults to off and can be set to - # `null` to turn off once on. Input audio transcription is not native to the - # model, since the model consumes audio directly. Transcription runs - # asynchronously through - # [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription) - # and should be treated as guidance of input audio content rather than precisely - # what the model heard. The client can optionally set the language and prompt for - # transcription, these offer additional guidance to the transcription service. transcription: nil, # Configuration for turn detection, ether Server VAD or Semantic VAD. This can be # set to `null` to turn off, in which case the client must manually trigger model @@ -630,6 +640,9 @@ module OpenAI # trails off with "uhhm", the model will score a low probability of turn end and # wait longer for the user to continue speaking. This can be useful for more # natural conversations, but may have a higher latency. + # + # For `gpt-realtime-whisper` transcription sessions, turn detection must be set to + # `null`; VAD is not supported. turn_detection: nil ) end @@ -717,6 +730,9 @@ module OpenAI # trails off with "uhhm", the model will score a low probability of turn end and # wait longer for the user to continue speaking. This can be useful for more # natural conversations, but may have a higher latency. + # + # For `gpt-realtime-whisper` transcription sessions, turn detection must be set to + # `null`; VAD is not supported. module TurnDetection extend OpenAI::Internal::Type::Union @@ -1328,6 +1344,11 @@ module OpenAI :"gpt-realtime-1.5", OpenAI::Realtime::RealtimeSessionCreateResponse::Model::TaggedSymbol ) + GPT_REALTIME_2 = + T.let( + :"gpt-realtime-2", + OpenAI::Realtime::RealtimeSessionCreateResponse::Model::TaggedSymbol + ) GPT_REALTIME_2025_08_28 = T.let( :"gpt-realtime-2025-08-28", diff --git a/rbi/openai/models/realtime/realtime_transcription_session_audio_input.rbi b/rbi/openai/models/realtime/realtime_transcription_session_audio_input.rbi index a07f9361..ed17fdbb 100644 --- a/rbi/openai/models/realtime/realtime_transcription_session_audio_input.rbi +++ b/rbi/openai/models/realtime/realtime_transcription_session_audio_input.rbi @@ -91,6 +91,9 @@ module OpenAI # trails off with "uhhm", the model will score a low probability of turn end and # wait longer for the user to continue speaking. This can be useful for more # natural conversations, but may have a higher latency. + # + # For `gpt-realtime-whisper` transcription sessions, turn detection must be set to + # `null`; VAD is not supported. sig do returns( T.nilable( @@ -154,6 +157,9 @@ module OpenAI # trails off with "uhhm", the model will score a low probability of turn end and # wait longer for the user to continue speaking. This can be useful for more # natural conversations, but may have a higher latency. + # + # For `gpt-realtime-whisper` transcription sessions, turn detection must be set to + # `null`; VAD is not supported. turn_detection: nil ) end diff --git a/rbi/openai/models/realtime/realtime_transcription_session_audio_input_turn_detection.rbi b/rbi/openai/models/realtime/realtime_transcription_session_audio_input_turn_detection.rbi index 5059f218..be60d5d1 100644 --- a/rbi/openai/models/realtime/realtime_transcription_session_audio_input_turn_detection.rbi +++ b/rbi/openai/models/realtime/realtime_transcription_session_audio_input_turn_detection.rbi @@ -16,6 +16,9 @@ module OpenAI # trails off with "uhhm", the model will score a low probability of turn end and # wait longer for the user to continue speaking. This can be useful for more # natural conversations, but may have a higher latency. + # + # For `gpt-realtime-whisper` transcription sessions, turn detection must be set to + # `null`; VAD is not supported. module RealtimeTranscriptionSessionAudioInputTurnDetection extend OpenAI::Internal::Type::Union diff --git a/rbi/openai/models/realtime/realtime_transcription_session_create_response.rbi b/rbi/openai/models/realtime/realtime_transcription_session_create_response.rbi index 8f72c8d3..481a3df2 100644 --- a/rbi/openai/models/realtime/realtime_transcription_session_create_response.rbi +++ b/rbi/openai/models/realtime/realtime_transcription_session_create_response.rbi @@ -224,7 +224,6 @@ module OpenAI end attr_writer :noise_reduction - # Configuration of the transcription model. sig { returns(T.nilable(OpenAI::Realtime::AudioTranscription)) } attr_reader :transcription @@ -237,7 +236,8 @@ module OpenAI # Configuration for turn detection. Can be set to `null` to turn off. Server VAD # means that the model will detect the start and end of speech based on audio - # volume and respond at the end of user speech. + # volume and respond at the end of user speech. For `gpt-realtime-whisper`, this + # must be `null`; VAD is not supported. sig do returns( T.nilable( @@ -250,7 +250,9 @@ module OpenAI sig do params( turn_detection: - OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection::OrHash + T.nilable( + OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection::OrHash + ) ).void end attr_writer :turn_detection @@ -267,7 +269,9 @@ module OpenAI OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input::NoiseReduction::OrHash, transcription: OpenAI::Realtime::AudioTranscription::OrHash, turn_detection: - OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection::OrHash + T.nilable( + OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection::OrHash + ) ).returns(T.attached_class) end def self.new( @@ -275,11 +279,11 @@ module OpenAI format_: nil, # Configuration for input audio noise reduction. noise_reduction: nil, - # Configuration of the transcription model. transcription: nil, # Configuration for turn detection. Can be set to `null` to turn off. Server VAD # means that the model will detect the start and end of speech based on audio - # volume and respond at the end of user speech. + # volume and respond at the end of user speech. For `gpt-realtime-whisper`, this + # must be `null`; VAD is not supported. turn_detection: nil ) end @@ -292,7 +296,9 @@ module OpenAI OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input::NoiseReduction, transcription: OpenAI::Realtime::AudioTranscription, turn_detection: - OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection + T.nilable( + OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection + ) } ) end diff --git a/rbi/openai/models/realtime/realtime_transcription_session_turn_detection.rbi b/rbi/openai/models/realtime/realtime_transcription_session_turn_detection.rbi index ee74cc23..2d67fbb9 100644 --- a/rbi/openai/models/realtime/realtime_transcription_session_turn_detection.rbi +++ b/rbi/openai/models/realtime/realtime_transcription_session_turn_detection.rbi @@ -50,7 +50,8 @@ module OpenAI # Configuration for turn detection. Can be set to `null` to turn off. Server VAD # means that the model will detect the start and end of speech based on audio - # volume and respond at the end of user speech. + # volume and respond at the end of user speech. For `gpt-realtime-whisper`, this + # must be `null`; VAD is not supported. sig do params( prefix_padding_ms: Integer, diff --git a/rbi/openai/models/realtime/transcription_session_updated_event.rbi b/rbi/openai/models/realtime/transcription_session_updated_event.rbi index 1f2d287d..d7499242 100644 --- a/rbi/openai/models/realtime/transcription_session_updated_event.rbi +++ b/rbi/openai/models/realtime/transcription_session_updated_event.rbi @@ -108,7 +108,6 @@ module OpenAI sig { params(input_audio_format: String).void } attr_writer :input_audio_format - # Configuration of the transcription model. sig { returns(T.nilable(OpenAI::Realtime::AudioTranscription)) } attr_reader :input_audio_transcription @@ -189,7 +188,6 @@ module OpenAI client_secret:, # The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. input_audio_format: nil, - # Configuration of the transcription model. input_audio_transcription: nil, # The set of modalities the model can respond with. To disable audio, set this to # ["text"]. diff --git a/rbi/openai/resources/realtime/calls.rbi b/rbi/openai/resources/realtime/calls.rbi index 7468592a..8133bcf0 100644 --- a/rbi/openai/resources/realtime/calls.rbi +++ b/rbi/openai/resources/realtime/calls.rbi @@ -25,7 +25,9 @@ module OpenAI T::Array[ OpenAI::Realtime::RealtimeSessionCreateRequest::OutputModality::OrSymbol ], + parallel_tool_calls: T::Boolean, prompt: T.nilable(OpenAI::Responses::ResponsePrompt::OrHash), + reasoning: OpenAI::Realtime::RealtimeReasoning::OrHash, tool_choice: T.any( OpenAI::Responses::ToolChoiceOptions::OrSymbol, @@ -90,9 +92,14 @@ module OpenAI # can be used to make the model respond with text only. It is not possible to # request both `text` and `audio` at the same time. output_modalities: nil, + # Whether the model may call multiple tools in parallel. Only supported by + # reasoning Realtime models such as `gpt-realtime-2`. + parallel_tool_calls: nil, # Reference to a prompt template and its variables. # [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts). prompt: nil, + # Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`. + reasoning: nil, # How the model chooses tools. Provide one of the string modes or force a specific # function/MCP tool. tool_choice: nil, diff --git a/sig/openai/models/realtime/audio_transcription.rbs b/sig/openai/models/realtime/audio_transcription.rbs index 2eccd193..1d390607 100644 --- a/sig/openai/models/realtime/audio_transcription.rbs +++ b/sig/openai/models/realtime/audio_transcription.rbs @@ -3,12 +3,19 @@ module OpenAI module Realtime type audio_transcription = { + delay: OpenAI::Models::Realtime::AudioTranscription::delay, language: String, model: OpenAI::Models::Realtime::AudioTranscription::model, prompt: String } class AudioTranscription < OpenAI::Internal::Type::BaseModel + attr_reader delay: OpenAI::Models::Realtime::AudioTranscription::delay? + + def delay=: ( + OpenAI::Models::Realtime::AudioTranscription::delay + ) -> OpenAI::Models::Realtime::AudioTranscription::delay + attr_reader language: String? def language=: (String) -> String @@ -24,17 +31,33 @@ module OpenAI def prompt=: (String) -> String def initialize: ( + ?delay: OpenAI::Models::Realtime::AudioTranscription::delay, ?language: String, ?model: OpenAI::Models::Realtime::AudioTranscription::model, ?prompt: String ) -> void def to_hash: -> { + delay: OpenAI::Models::Realtime::AudioTranscription::delay, language: String, model: OpenAI::Models::Realtime::AudioTranscription::model, prompt: String } + type delay = :minimal | :low | :medium | :high | :xhigh + + module Delay + extend OpenAI::Internal::Type::Enum + + MINIMAL: :minimal + LOW: :low + MEDIUM: :medium + HIGH: :high + XHIGH: :xhigh + + def self?.values: -> ::Array[OpenAI::Models::Realtime::AudioTranscription::delay] + end + type model = String | :"whisper-1" @@ -42,6 +65,7 @@ module OpenAI | :"gpt-4o-mini-transcribe-2025-12-15" | :"gpt-4o-transcribe" | :"gpt-4o-transcribe-diarize" + | :"gpt-realtime-whisper" module Model extend OpenAI::Internal::Type::Union @@ -53,6 +77,7 @@ module OpenAI GPT_4O_MINI_TRANSCRIBE_2025_12_15: :"gpt-4o-mini-transcribe-2025-12-15" GPT_4O_TRANSCRIBE: :"gpt-4o-transcribe" GPT_4O_TRANSCRIBE_DIARIZE: :"gpt-4o-transcribe-diarize" + GPT_REALTIME_WHISPER: :"gpt-realtime-whisper" end end end diff --git a/sig/openai/models/realtime/realtime_reasoning.rbs b/sig/openai/models/realtime/realtime_reasoning.rbs new file mode 100644 index 00000000..822a6b2b --- /dev/null +++ b/sig/openai/models/realtime/realtime_reasoning.rbs @@ -0,0 +1,24 @@ +module OpenAI + module Models + module Realtime + type realtime_reasoning = + { effort: OpenAI::Models::Realtime::realtime_reasoning_effort } + + class RealtimeReasoning < OpenAI::Internal::Type::BaseModel + attr_reader effort: OpenAI::Models::Realtime::realtime_reasoning_effort? + + def effort=: ( + OpenAI::Models::Realtime::realtime_reasoning_effort + ) -> OpenAI::Models::Realtime::realtime_reasoning_effort + + def initialize: ( + ?effort: OpenAI::Models::Realtime::realtime_reasoning_effort + ) -> void + + def to_hash: -> { + effort: OpenAI::Models::Realtime::realtime_reasoning_effort + } + end + end + end +end diff --git a/sig/openai/models/realtime/realtime_reasoning_effort.rbs b/sig/openai/models/realtime/realtime_reasoning_effort.rbs new file mode 100644 index 00000000..59522d66 --- /dev/null +++ b/sig/openai/models/realtime/realtime_reasoning_effort.rbs @@ -0,0 +1,20 @@ +module OpenAI + module Models + module Realtime + type realtime_reasoning_effort = + :minimal | :low | :medium | :high | :xhigh + + module RealtimeReasoningEffort + extend OpenAI::Internal::Type::Enum + + MINIMAL: :minimal + LOW: :low + MEDIUM: :medium + HIGH: :high + XHIGH: :xhigh + + def self?.values: -> ::Array[OpenAI::Models::Realtime::realtime_reasoning_effort] + end + end + end +end diff --git a/sig/openai/models/realtime/realtime_response_create_params.rbs b/sig/openai/models/realtime/realtime_response_create_params.rbs index c07c4534..02089dc5 100644 --- a/sig/openai/models/realtime/realtime_response_create_params.rbs +++ b/sig/openai/models/realtime/realtime_response_create_params.rbs @@ -10,7 +10,9 @@ module OpenAI max_output_tokens: OpenAI::Models::Realtime::RealtimeResponseCreateParams::max_output_tokens, metadata: OpenAI::Models::metadata?, output_modalities: ::Array[OpenAI::Models::Realtime::RealtimeResponseCreateParams::output_modality], + parallel_tool_calls: bool, prompt: OpenAI::Responses::ResponsePrompt?, + reasoning: OpenAI::Realtime::RealtimeReasoning, tool_choice: OpenAI::Models::Realtime::RealtimeResponseCreateParams::tool_choice, tools: ::Array[OpenAI::Models::Realtime::RealtimeResponseCreateParams::tool] } @@ -52,8 +54,18 @@ module OpenAI ::Array[OpenAI::Models::Realtime::RealtimeResponseCreateParams::output_modality] ) -> ::Array[OpenAI::Models::Realtime::RealtimeResponseCreateParams::output_modality] + attr_reader parallel_tool_calls: bool? + + def parallel_tool_calls=: (bool) -> bool + attr_accessor prompt: OpenAI::Responses::ResponsePrompt? + attr_reader reasoning: OpenAI::Realtime::RealtimeReasoning? + + def reasoning=: ( + OpenAI::Realtime::RealtimeReasoning + ) -> OpenAI::Realtime::RealtimeReasoning + attr_reader tool_choice: OpenAI::Models::Realtime::RealtimeResponseCreateParams::tool_choice? def tool_choice=: ( @@ -74,7 +86,9 @@ module OpenAI ?max_output_tokens: OpenAI::Models::Realtime::RealtimeResponseCreateParams::max_output_tokens, ?metadata: OpenAI::Models::metadata?, ?output_modalities: ::Array[OpenAI::Models::Realtime::RealtimeResponseCreateParams::output_modality], + ?parallel_tool_calls: bool, ?prompt: OpenAI::Responses::ResponsePrompt?, + ?reasoning: OpenAI::Realtime::RealtimeReasoning, ?tool_choice: OpenAI::Models::Realtime::RealtimeResponseCreateParams::tool_choice, ?tools: ::Array[OpenAI::Models::Realtime::RealtimeResponseCreateParams::tool] ) -> void @@ -87,7 +101,9 @@ module OpenAI max_output_tokens: OpenAI::Models::Realtime::RealtimeResponseCreateParams::max_output_tokens, metadata: OpenAI::Models::metadata?, output_modalities: ::Array[OpenAI::Models::Realtime::RealtimeResponseCreateParams::output_modality], + parallel_tool_calls: bool, prompt: OpenAI::Responses::ResponsePrompt?, + reasoning: OpenAI::Realtime::RealtimeReasoning, tool_choice: OpenAI::Models::Realtime::RealtimeResponseCreateParams::tool_choice, tools: ::Array[OpenAI::Models::Realtime::RealtimeResponseCreateParams::tool] } diff --git a/sig/openai/models/realtime/realtime_session_client_secret.rbs b/sig/openai/models/realtime/realtime_session_client_secret.rbs deleted file mode 100644 index fd104e7e..00000000 --- a/sig/openai/models/realtime/realtime_session_client_secret.rbs +++ /dev/null @@ -1,20 +0,0 @@ -module OpenAI - module Models - class RealtimeSessionClientSecret = Realtime::RealtimeSessionClientSecret - - module Realtime - type realtime_session_client_secret = - { expires_at: Integer, value: String } - - class RealtimeSessionClientSecret < OpenAI::Internal::Type::BaseModel - attr_accessor expires_at: Integer - - attr_accessor value: String - - def initialize: (expires_at: Integer, value: String) -> void - - def to_hash: -> { expires_at: Integer, value: String } - end - end - end -end diff --git a/sig/openai/models/realtime/realtime_session_create_request.rbs b/sig/openai/models/realtime/realtime_session_create_request.rbs index c072c534..bf1c3966 100644 --- a/sig/openai/models/realtime/realtime_session_create_request.rbs +++ b/sig/openai/models/realtime/realtime_session_create_request.rbs @@ -10,7 +10,9 @@ module OpenAI max_output_tokens: OpenAI::Models::Realtime::RealtimeSessionCreateRequest::max_output_tokens, model: OpenAI::Models::Realtime::RealtimeSessionCreateRequest::model, output_modalities: ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateRequest::output_modality], + parallel_tool_calls: bool, prompt: OpenAI::Responses::ResponsePrompt?, + reasoning: OpenAI::Realtime::RealtimeReasoning, tool_choice: OpenAI::Models::Realtime::realtime_tool_choice_config, tools: OpenAI::Models::Realtime::realtime_tools_config, tracing: OpenAI::Models::Realtime::realtime_tracing_config?, @@ -54,8 +56,18 @@ module OpenAI ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateRequest::output_modality] ) -> ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateRequest::output_modality] + attr_reader parallel_tool_calls: bool? + + def parallel_tool_calls=: (bool) -> bool + attr_accessor prompt: OpenAI::Responses::ResponsePrompt? + attr_reader reasoning: OpenAI::Realtime::RealtimeReasoning? + + def reasoning=: ( + OpenAI::Realtime::RealtimeReasoning + ) -> OpenAI::Realtime::RealtimeReasoning + attr_reader tool_choice: OpenAI::Models::Realtime::realtime_tool_choice_config? def tool_choice=: ( @@ -83,7 +95,9 @@ module OpenAI ?max_output_tokens: OpenAI::Models::Realtime::RealtimeSessionCreateRequest::max_output_tokens, ?model: OpenAI::Models::Realtime::RealtimeSessionCreateRequest::model, ?output_modalities: ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateRequest::output_modality], + ?parallel_tool_calls: bool, ?prompt: OpenAI::Responses::ResponsePrompt?, + ?reasoning: OpenAI::Realtime::RealtimeReasoning, ?tool_choice: OpenAI::Models::Realtime::realtime_tool_choice_config, ?tools: OpenAI::Models::Realtime::realtime_tools_config, ?tracing: OpenAI::Models::Realtime::realtime_tracing_config?, @@ -99,7 +113,9 @@ module OpenAI max_output_tokens: OpenAI::Models::Realtime::RealtimeSessionCreateRequest::max_output_tokens, model: OpenAI::Models::Realtime::RealtimeSessionCreateRequest::model, output_modalities: ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateRequest::output_modality], + parallel_tool_calls: bool, prompt: OpenAI::Responses::ResponsePrompt?, + reasoning: OpenAI::Realtime::RealtimeReasoning, tool_choice: OpenAI::Models::Realtime::realtime_tool_choice_config, tools: OpenAI::Models::Realtime::realtime_tools_config, tracing: OpenAI::Models::Realtime::realtime_tracing_config?, @@ -128,6 +144,7 @@ module OpenAI String | :"gpt-realtime" | :"gpt-realtime-1.5" + | :"gpt-realtime-2" | :"gpt-realtime-2025-08-28" | :"gpt-4o-realtime-preview" | :"gpt-4o-realtime-preview-2024-10-01" @@ -150,6 +167,7 @@ module OpenAI GPT_REALTIME: :"gpt-realtime" GPT_REALTIME_1_5: :"gpt-realtime-1.5" + GPT_REALTIME_2: :"gpt-realtime-2" GPT_REALTIME_2025_08_28: :"gpt-realtime-2025-08-28" GPT_4O_REALTIME_PREVIEW: :"gpt-4o-realtime-preview" GPT_4O_REALTIME_PREVIEW_2024_10_01: :"gpt-4o-realtime-preview-2024-10-01" diff --git a/sig/openai/models/realtime/realtime_session_create_response.rbs b/sig/openai/models/realtime/realtime_session_create_response.rbs index fd5d25e3..8271fe97 100644 --- a/sig/openai/models/realtime/realtime_session_create_response.rbs +++ b/sig/openai/models/realtime/realtime_session_create_response.rbs @@ -5,15 +5,18 @@ module OpenAI module Realtime type realtime_session_create_response = { - client_secret: OpenAI::Realtime::RealtimeSessionClientSecret, + id: String, + object: :"realtime.session", type: :realtime, audio: OpenAI::Realtime::RealtimeSessionCreateResponse::Audio, + expires_at: Integer, include: ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateResponse::include_], instructions: String, max_output_tokens: OpenAI::Models::Realtime::RealtimeSessionCreateResponse::max_output_tokens, model: OpenAI::Models::Realtime::RealtimeSessionCreateResponse::model, output_modalities: ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateResponse::output_modality], prompt: OpenAI::Responses::ResponsePrompt?, + reasoning: OpenAI::Realtime::RealtimeReasoning, tool_choice: OpenAI::Models::Realtime::RealtimeSessionCreateResponse::tool_choice, tools: ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateResponse::tool], tracing: OpenAI::Models::Realtime::RealtimeSessionCreateResponse::tracing?, @@ -21,7 +24,9 @@ module OpenAI } class RealtimeSessionCreateResponse < OpenAI::Internal::Type::BaseModel - attr_accessor client_secret: OpenAI::Realtime::RealtimeSessionClientSecret + attr_accessor id: String + + attr_accessor object: :"realtime.session" attr_accessor type: :realtime @@ -31,6 +36,10 @@ module OpenAI OpenAI::Realtime::RealtimeSessionCreateResponse::Audio ) -> OpenAI::Realtime::RealtimeSessionCreateResponse::Audio + attr_reader expires_at: Integer? + + def expires_at=: (Integer) -> Integer + attr_reader include: ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateResponse::include_]? def include=: ( @@ -61,6 +70,12 @@ module OpenAI attr_accessor prompt: OpenAI::Responses::ResponsePrompt? + attr_reader reasoning: OpenAI::Realtime::RealtimeReasoning? + + def reasoning=: ( + OpenAI::Realtime::RealtimeReasoning + ) -> OpenAI::Realtime::RealtimeReasoning + attr_reader tool_choice: OpenAI::Models::Realtime::RealtimeSessionCreateResponse::tool_choice? def tool_choice=: ( @@ -82,31 +97,37 @@ module OpenAI ) -> OpenAI::Models::Realtime::realtime_truncation def initialize: ( - client_secret: OpenAI::Realtime::RealtimeSessionClientSecret, + id: String, ?audio: OpenAI::Realtime::RealtimeSessionCreateResponse::Audio, + ?expires_at: Integer, ?include: ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateResponse::include_], ?instructions: String, ?max_output_tokens: OpenAI::Models::Realtime::RealtimeSessionCreateResponse::max_output_tokens, ?model: OpenAI::Models::Realtime::RealtimeSessionCreateResponse::model, ?output_modalities: ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateResponse::output_modality], ?prompt: OpenAI::Responses::ResponsePrompt?, + ?reasoning: OpenAI::Realtime::RealtimeReasoning, ?tool_choice: OpenAI::Models::Realtime::RealtimeSessionCreateResponse::tool_choice, ?tools: ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateResponse::tool], ?tracing: OpenAI::Models::Realtime::RealtimeSessionCreateResponse::tracing?, ?truncation: OpenAI::Models::Realtime::realtime_truncation, + ?object: :"realtime.session", ?type: :realtime ) -> void def to_hash: -> { - client_secret: OpenAI::Realtime::RealtimeSessionClientSecret, + id: String, + object: :"realtime.session", type: :realtime, audio: OpenAI::Realtime::RealtimeSessionCreateResponse::Audio, + expires_at: Integer, include: ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateResponse::include_], instructions: String, max_output_tokens: OpenAI::Models::Realtime::RealtimeSessionCreateResponse::max_output_tokens, model: OpenAI::Models::Realtime::RealtimeSessionCreateResponse::model, output_modalities: ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateResponse::output_modality], prompt: OpenAI::Responses::ResponsePrompt?, + reasoning: OpenAI::Realtime::RealtimeReasoning, tool_choice: OpenAI::Models::Realtime::RealtimeSessionCreateResponse::tool_choice, tools: ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateResponse::tool], tracing: OpenAI::Models::Realtime::RealtimeSessionCreateResponse::tracing?, @@ -415,6 +436,7 @@ module OpenAI String | :"gpt-realtime" | :"gpt-realtime-1.5" + | :"gpt-realtime-2" | :"gpt-realtime-2025-08-28" | :"gpt-4o-realtime-preview" | :"gpt-4o-realtime-preview-2024-10-01" @@ -437,6 +459,7 @@ module OpenAI GPT_REALTIME: :"gpt-realtime" GPT_REALTIME_1_5: :"gpt-realtime-1.5" + GPT_REALTIME_2: :"gpt-realtime-2" GPT_REALTIME_2025_08_28: :"gpt-realtime-2025-08-28" GPT_4O_REALTIME_PREVIEW: :"gpt-4o-realtime-preview" GPT_4O_REALTIME_PREVIEW_2024_10_01: :"gpt-4o-realtime-preview-2024-10-01" diff --git a/sig/openai/models/realtime/realtime_transcription_session_create_response.rbs b/sig/openai/models/realtime/realtime_transcription_session_create_response.rbs index 195d2a4d..39e940d5 100644 --- a/sig/openai/models/realtime/realtime_transcription_session_create_response.rbs +++ b/sig/openai/models/realtime/realtime_transcription_session_create_response.rbs @@ -79,7 +79,7 @@ module OpenAI format_: OpenAI::Models::Realtime::realtime_audio_formats, noise_reduction: OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input::NoiseReduction, transcription: OpenAI::Realtime::AudioTranscription, - turn_detection: OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection + turn_detection: OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection? } class Input < OpenAI::Internal::Type::BaseModel @@ -101,24 +101,20 @@ module OpenAI OpenAI::Realtime::AudioTranscription ) -> OpenAI::Realtime::AudioTranscription - attr_reader turn_detection: OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection? - - def turn_detection=: ( - OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection - ) -> OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection + attr_accessor turn_detection: OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection? def initialize: ( ?format_: OpenAI::Models::Realtime::realtime_audio_formats, ?noise_reduction: OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input::NoiseReduction, ?transcription: OpenAI::Realtime::AudioTranscription, - ?turn_detection: OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection + ?turn_detection: OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection? ) -> void def to_hash: -> { format_: OpenAI::Models::Realtime::realtime_audio_formats, noise_reduction: OpenAI::Realtime::RealtimeTranscriptionSessionCreateResponse::Audio::Input::NoiseReduction, transcription: OpenAI::Realtime::AudioTranscription, - turn_detection: OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection + turn_detection: OpenAI::Realtime::RealtimeTranscriptionSessionTurnDetection? } type noise_reduction = diff --git a/sig/openai/resources/realtime/calls.rbs b/sig/openai/resources/realtime/calls.rbs index b3855ab9..7f89f241 100644 --- a/sig/openai/resources/realtime/calls.rbs +++ b/sig/openai/resources/realtime/calls.rbs @@ -10,7 +10,9 @@ module OpenAI ?max_output_tokens: OpenAI::Models::Realtime::RealtimeSessionCreateRequest::max_output_tokens, ?model: OpenAI::Models::Realtime::RealtimeSessionCreateRequest::model, ?output_modalities: ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateRequest::output_modality], + ?parallel_tool_calls: bool, ?prompt: OpenAI::Responses::ResponsePrompt?, + ?reasoning: OpenAI::Realtime::RealtimeReasoning, ?tool_choice: OpenAI::Models::Realtime::realtime_tool_choice_config, ?tools: OpenAI::Models::Realtime::realtime_tools_config, ?tracing: OpenAI::Models::Realtime::realtime_tracing_config?, From 02940017e2c05ad647506b9edcf2c274c32b6ca2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 7 May 2026 17:24:50 +0000 Subject: [PATCH 16/16] release: 0.62.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 18 ++++++++++++++++++ Gemfile.lock | 2 +- README.md | 2 +- lib/openai/version.rb | 2 +- 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f7e971ea..fdce8724 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.61.0" + ".": "0.62.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 9578af11..e6b669e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## 0.62.0 (2026-05-07) + +Full Changelog: [v0.61.0...v0.62.0](https://github.com/openai/openai-ruby/compare/v0.61.0...v0.62.0) + +### Features + +* **api:** add quantity field to organization usage costs results ([2085700](https://github.com/openai/openai-ruby/commit/2085700725c2325e880a715ce3b13b4efce7b5d4)) +* **api:** add web_search_call.results includable option ([b486412](https://github.com/openai/openai-ruby/commit/b4864127789424527497aa6097d93ea06e9aa4f7)) +* **api:** launch realtime translate + update image 2 ([0e642fb](https://github.com/openai/openai-ruby/commit/0e642fbf02845ff94b8eda0fca7e8348adc3ac37)) +* **api:** manual updates ([4baf155](https://github.com/openai/openai-ruby/commit/4baf155ef74ffdf533dfba330e15f7accf1e5351)) +* **api:** manual updates ([20c8209](https://github.com/openai/openai-ruby/commit/20c82091b6c24668e90ed895dfc7e88b0aafd977)) +* **api:** realtime 2 ([1718781](https://github.com/openai/openai-ruby/commit/17187817c580b642d61ea754aa63782a16af94bc)) + + +### Bug Fixes + +* **api:** fix imagegen `size` enum regression ([51548cd](https://github.com/openai/openai-ruby/commit/51548cd04ab8f3a16e980bd2318ddb42ee75ce6c)) + ## 0.61.0 (2026-05-01) Full Changelog: [v0.60.0...v0.61.0](https://github.com/openai/openai-ruby/compare/v0.60.0...v0.61.0) diff --git a/Gemfile.lock b/Gemfile.lock index e922e231..d0ebeb70 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - openai (0.61.0) + openai (0.62.0) base64 cgi connection_pool diff --git a/README.md b/README.md index 614aa88f..916c1753 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "openai", "~> 0.61.0" +gem "openai", "~> 0.62.0" ``` diff --git a/lib/openai/version.rb b/lib/openai/version.rb index 447c45a8..74b41238 100644 --- a/lib/openai/version.rb +++ b/lib/openai/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module OpenAI - VERSION = "0.61.0" + VERSION = "0.62.0" end