diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f7e971ead..fdce87245 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/.stats.yml b/.stats.yml index ab1af60f9..ff6b89352 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_hash: cfc868a0bb3567183510c9b5629c510f -config_hash: dd484e2cc01206d26516338d0f4596b0 +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/CHANGELOG.md b/CHANGELOG.md index 9578af119..e6b669e82 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 e922e231f..d0ebeb70b 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 614aa88f7..916c17535 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.rb b/lib/openai.rb index b57fdc788..44b6c4b27 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" @@ -651,6 +652,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/admin/organization/usage_audio_speeches_response.rb b/lib/openai/models/admin/organization/usage_audio_speeches_response.rb index d60a8208f..a4aaf9210 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 f546c4426..b0835d30d 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 a0744fec5..d33fe8235 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 0954051cd..14e931ac8 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 d29af080f..1f1382939 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 9405c1b81..3cba762e3 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 208bb965b..3c96923db 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 f82a3c4f9..5d4d6402d 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 745345b2a..7c8673bd5 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 7a09b7c26..72d78fdbe 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 b33668689..63a89099d 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/image_edit_params.rb b/lib/openai/models/image_edit_params.rb index 62f9e5a47..2666c5ad5 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. @@ -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`. @@ -61,7 +66,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 @@ -116,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`. - # - # @return [Symbol, OpenAI::Models::ImageEditParams::Size, nil] - optional :size, enum: -> { OpenAI::ImageEditParams::Size }, nil?: true + # 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 [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 @@ -145,7 +161,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. # @@ -159,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, 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 # @@ -167,10 +183,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. @@ -189,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`. @@ -220,13 +241,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 @@ -276,11 +300,42 @@ 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, 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`. module Size - extend OpenAI::Internal::Type::Enum + 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" @@ -289,8 +344,7 @@ module Size SIZE_1024X1536 = :"1024x1536" AUTO = :auto - # @!method self.values - # @return [Array] + # @!endgroup end end end diff --git a/lib/openai/models/image_generate_params.rb b/lib/openai/models/image_generate_params.rb index d0604546b..837350e01 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`. @@ -31,8 +36,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 @@ -100,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`. - # - # @return [Symbol, OpenAI::Models::ImageGenerateParams::Size, nil] - optional :size, enum: -> { OpenAI::ImageGenerateParams::Size }, nil?: true + # 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 [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 @@ -149,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, 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- # @@ -158,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`. @@ -176,14 +194,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 @@ -251,12 +270,46 @@ 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`. + # 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::Enum + 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" @@ -267,8 +320,7 @@ module Size SIZE_1792X1024 = :"1792x1024" SIZE_1024X1792 = :"1024x1792" - # @!method self.values - # @return [Array] + # @!endgroup end # The style of the generated images. This parameter is only supported for diff --git a/lib/openai/models/image_model.rb b/lib/openai/models/image_model.rb index aa447df77..6cf428b82 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/realtime/audio_transcription.rb b/lib/openai/models/realtime/audio_transcription.rb index c050c1374..22efb4d97 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 11c049b8d..57cf5cdb3 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 37ca5874e..d3c670fce 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 81c55b2af..906c728b3 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 000000000..ae7530f01 --- /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 000000000..984ae7f0d --- /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 31378b945..8e90c87a1 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 5dcf48a7c..81fd4039c 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 17e6b5553..000000000 --- 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 2df8972db..1e0bb5311 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 28fab80c9..1d6d9b84a 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 fc5fb2311..b49f0e166 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 10d594074..0287e367f 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 56b2509f3..91f54db4c 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 e7f1ba0cf..2dd54610b 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/realtime_translation_client_event.rb b/lib/openai/models/realtime/realtime_translation_client_event.rb new file mode 100644 index 000000000..c91335ae6 --- /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 000000000..3df3eab0d --- /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 000000000..64223f788 --- /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 000000000..7cd7d3fb1 --- /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 000000000..d005e56d3 --- /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 000000000..2b0d67a3f --- /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 000000000..ad26de0d8 --- /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 000000000..cc4569c71 --- /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 000000000..e7855200b --- /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 000000000..d73347bf2 --- /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 000000000..9061cf851 --- /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 000000000..05d3cfc5c --- /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 000000000..f6b3b6935 --- /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 000000000..0ca5525b0 --- /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 000000000..05bd6d45f --- /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 000000000..2b26248ae --- /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/lib/openai/models/realtime/transcription_session_updated_event.rb b/lib/openai/models/realtime/transcription_session_updated_event.rb index 4896696e0..184be6694 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/models/responses/response.rb b/lib/openai/models/responses/response.rb index 8feb582eb..6405eba40 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 3072d2f05..91491a266 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_includable.rb b/lib/openai/models/responses/response_includable.rb index c4c1959be..5b7c3e056 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/lib/openai/models/responses/response_text_delta_event.rb b/lib/openai/models/responses/response_text_delta_event.rb index 9701d97c8..7339d0603 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 77110a2a0..9f7cd3be8 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 3638b0e71..694eaac62 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/models/responses/tool.rb b/lib/openai/models/responses/tool.rb index 6a2327922..5d675f356 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`. - # - # @return [Symbol, OpenAI::Models::Responses::Tool::ImageGeneration::Size, nil] - optional :size, enum: -> { OpenAI::Responses::Tool::ImageGeneration::Size } + # 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 [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 @@ -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, 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`. @@ -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 @@ -681,8 +710,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 +729,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 @@ -743,20 +781,47 @@ module Quality # @return [Array] end - # 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`. # # @see OpenAI::Models::Responses::Tool::ImageGeneration#size module Size - extend OpenAI::Internal::Type::Enum + 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 - # @!method self.values - # @return [Array] + # @!endgroup end end diff --git a/lib/openai/resources/chat/completions.rb b/lib/openai/resources/chat/completions.rb index 89c5b7e69..a2c3b9249 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/images.rb b/lib/openai/resources/images.rb index 77116f017..f4f0c5f08 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. # @@ -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, 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 # @@ -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. # @@ -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, 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 [Symbol, OpenAI::Models::ImageGenerateParams::Size, nil] The size of the generated images. Must be one of `1024x1024`, `1536x1024` (lands + # @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 [Symbol, OpenAI::Models::ImageGenerateParams::Size, nil] The size of the generated images. Must be one of `1024x1024`, `1536x1024` (lands + # @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/lib/openai/resources/realtime/calls.rb b/lib/openai/resources/realtime/calls.rb index 80df2d8ce..a0cfb6f4d 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/lib/openai/resources/responses.rb b/lib/openai/resources/responses.rb index a31a78a08..cd4e73e85 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/lib/openai/version.rb b/lib/openai/version.rb index 447c45a82..74b412389 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 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 ef1b7e942..15e388cf1 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 232ae9112..a8ac3e5cc 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 5a91bbc2b..396c25f7b 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 d72416dac..e7652d5c7 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 157ee650b..888a75444 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 11eec65b7..ef5300646 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 343787e3d..3576b15a3 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 2058983ac..02c9a5cca 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 d8f319f49..7aa40b0d2 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 0cca08361..c1816f8db 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 4763a24f1..3aa4a4547 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/image_edit_params.rbi b/rbi/openai/models/image_edit_params.rbi index 219bcb838..8957c29a6 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. @@ -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`. @@ -57,7 +62,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 @@ -102,10 +110,22 @@ 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 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 @@ -134,7 +154,8 @@ 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(T.any(String, OpenAI::ImageEditParams::Size::OrSymbol)), user: String, request_options: OpenAI::RequestOptions::OrHash ).returns(T.attached_class) @@ -142,10 +163,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. @@ -154,9 +175,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`. @@ -171,7 +197,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, @@ -198,9 +227,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. @@ -229,7 +266,8 @@ 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(T.any(String, OpenAI::ImageEditParams::Size::OrSymbol)), user: String, request_options: OpenAI::RequestOptions } @@ -240,10 +278,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. @@ -266,9 +304,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`. @@ -318,7 +361,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 @@ -409,11 +455,30 @@ 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, 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`. module Size - extend OpenAI::Internal::Type::Enum + 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) } @@ -430,14 +495,6 @@ module OpenAI 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 diff --git a/rbi/openai/models/image_generate_params.rbi b/rbi/openai/models/image_generate_params.rbi index 7837a2e45..972a769e6 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`. @@ -30,8 +35,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 @@ -91,11 +97,22 @@ 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 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 @@ -130,7 +147,10 @@ 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( + T.any(String, OpenAI::ImageGenerateParams::Size::OrSymbol) + ), style: T.nilable(OpenAI::ImageGenerateParams::Style::OrSymbol), user: String, request_options: OpenAI::RequestOptions::OrHash @@ -142,16 +162,22 @@ 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`. 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 @@ -187,10 +213,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 @@ -222,7 +255,10 @@ 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( + T.any(String, OpenAI::ImageGenerateParams::Size::OrSymbol) + ), style: T.nilable(OpenAI::ImageGenerateParams::Style::OrSymbol), user: String, request_options: OpenAI::RequestOptions @@ -233,9 +269,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`. @@ -268,8 +309,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 @@ -399,12 +441,32 @@ 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`. + # 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::Enum + 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) } @@ -425,14 +487,6 @@ module OpenAI 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 diff --git a/rbi/openai/models/image_model.rbi b/rbi/openai/models/image_model.rbi index 911c8016e..d57507824 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/realtime/audio_transcription.rbi b/rbi/openai/models/realtime/audio_transcription.rbi index 0a13c9575..3ea92c447 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 fb2e26978..a21fca6bb 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 ac1de18b7..649a0155c 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 000000000..12fd72172 --- /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 000000000..ebcc91835 --- /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 18dbbadf9..030812b2d 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 d3769d20f..6625edcd5 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 b23e1135c..000000000 --- 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 0ab64e047..ae4a260fe 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 8dfaede41..d79ab65d4 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 a07f93617..ed17fdbb7 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 5059f2186..be60d5d1a 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 8f72c8d37..481a3df2a 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 ee74cc236..2d67fbb98 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/realtime_translation_client_event.rbi b/rbi/openai/models/realtime/realtime_translation_client_event.rbi new file mode 100644 index 000000000..c2cc18433 --- /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 000000000..77ad3423d --- /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 000000000..22149ffb2 --- /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 000000000..6fb681ed9 --- /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 000000000..e5df15ebd --- /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 000000000..b08f1b88a --- /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 000000000..a5ca475f5 --- /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 000000000..a048820c8 --- /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 000000000..32028ec04 --- /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 000000000..21a014acd --- /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 000000000..024d8dc0e --- /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 000000000..1e11650d7 --- /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 000000000..c4523e3a2 --- /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 000000000..b765cabcc --- /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 000000000..e3acffd2a --- /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 000000000..4b5f0aaca --- /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/rbi/openai/models/realtime/transcription_session_updated_event.rbi b/rbi/openai/models/realtime/transcription_session_updated_event.rbi index 1f2d287d1..d74992429 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/models/responses/response.rbi b/rbi/openai/models/responses/response.rbi index c5ef56131..a235b22a5 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 f557a5b02..57da74fb3 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_includable.rbi b/rbi/openai/models/responses/response_includable.rbi index 06c2ac374..e0944dbbf 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 diff --git a/rbi/openai/models/responses/response_text_delta_event.rbi b/rbi/openai/models/responses/response_text_delta_event.rbi index bd4384769..2a1d96842 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 2fe91762f..daa809672 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 61f86a3c7..09d725d01 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/models/responses/tool.rbi b/rbi/openai/models/responses/tool.rbi index cab7db9ce..d1ee40dc9 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,12 +1082,24 @@ module OpenAI end attr_writer :quality - # 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`. sig do returns( T.nilable( - OpenAI::Responses::Tool::ImageGeneration::Size::OrSymbol + T.any( + String, + OpenAI::Responses::Tool::ImageGeneration::Size::OrSymbol + ) ) ) end @@ -1085,7 +1107,11 @@ module OpenAI sig do params( - size: OpenAI::Responses::Tool::ImageGeneration::Size::OrSymbol + size: + T.any( + String, + OpenAI::Responses::Tool::ImageGeneration::Size::OrSymbol + ) ).void end attr_writer :size @@ -1116,15 +1142,29 @@ module OpenAI partial_images: Integer, quality: OpenAI::Responses::Tool::ImageGeneration::Quality::OrSymbol, - size: OpenAI::Responses::Tool::ImageGeneration::Size::OrSymbol, + size: + T.any( + String, + OpenAI::Responses::Tool::ImageGeneration::Size::OrSymbol + ), 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 +1189,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 +1233,11 @@ module OpenAI partial_images: Integer, quality: OpenAI::Responses::Tool::ImageGeneration::Quality::OrSymbol, - size: OpenAI::Responses::Tool::ImageGeneration::Size::OrSymbol + size: + T.any( + String, + OpenAI::Responses::Tool::ImageGeneration::Size::OrSymbol + ) } ) end @@ -1228,8 +1281,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 @@ -1388,11 +1451,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`. @@ -1514,10 +1592,37 @@ module OpenAI end end - # 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`. module Size - extend OpenAI::Internal::Type::Enum + 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 @@ -1545,16 +1650,6 @@ module OpenAI :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 diff --git a/rbi/openai/resources/chat/completions.rbi b/rbi/openai/resources/chat/completions.rbi index 5ffddaac8..c2aa91464 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/images.rbi b/rbi/openai/resources/images.rbi index a33916b92..f3cc4b5dd 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(OpenAI::ImageEditParams::Size::OrSymbol), + size: + T.nilable(T.any(String, OpenAI::ImageEditParams::Size::OrSymbol)), user: String, stream: T.noreturn, request_options: OpenAI::RequestOptions::OrHash @@ -74,10 +75,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. @@ -86,9 +87,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`. @@ -103,7 +109,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, @@ -130,9 +139,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. @@ -167,7 +184,8 @@ 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(T.any(String, OpenAI::ImageEditParams::Size::OrSymbol)), user: String, stream: T.noreturn, request_options: OpenAI::RequestOptions::OrHash @@ -178,10 +196,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. @@ -190,9 +208,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`. @@ -207,7 +230,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, @@ -234,9 +260,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. @@ -269,7 +303,10 @@ 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( + T.any(String, OpenAI::ImageGenerateParams::Size::OrSymbol) + ), style: T.nilable(OpenAI::ImageGenerateParams::Style::OrSymbol), user: String, stream: T.noreturn, @@ -282,16 +319,22 @@ 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`. 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 @@ -327,10 +370,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 @@ -368,7 +418,10 @@ 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( + T.any(String, OpenAI::ImageGenerateParams::Size::OrSymbol) + ), style: T.nilable(OpenAI::ImageGenerateParams::Style::OrSymbol), user: String, stream: T.noreturn, @@ -383,16 +436,22 @@ 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`. 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 @@ -428,10 +487,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/calls.rbi b/rbi/openai/resources/realtime/calls.rbi index 7468592a8..8133bcf03 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/rbi/openai/resources/responses.rbi b/rbi/openai/resources/responses.rbi index caee6fe33..6542cb5ae 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 648e35d0d..6ec2b5f9f 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 61ae7a657..5185c7576 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 f7a329ed2..37a85869e 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 d9e081047..0eaea0833 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 ccd334f55..b1041872e 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 b4d194a76..bbcffb672 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 bd6315a3c..d8946d708 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 9f9e0195e..5cdc0845f 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 996976ffa..f72653a28 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 } diff --git a/sig/openai/models/image_edit_params.rbs b/sig/openai/models/image_edit_params.rbs index 66f4812fe..a8ce696b3 100644 --- a/sig/openai/models/image_edit_params.rbs +++ b/sig/openai/models/image_edit_params.rbs @@ -171,7 +171,8 @@ module OpenAI end type size = - :"256x256" + String + | :"256x256" | :"512x512" | :"1024x1024" | :"1536x1024" @@ -179,7 +180,9 @@ module OpenAI | :auto module Size - extend OpenAI::Internal::Type::Enum + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::ImageEditParams::size] SIZE_256X256: :"256x256" SIZE_512X512: :"512x512" @@ -187,8 +190,6 @@ module OpenAI SIZE_1536X1024: :"1536x1024" SIZE_1024X1536: :"1024x1536" AUTO: :auto - - def self?.values: -> ::Array[OpenAI::Models::ImageEditParams::size] end end end diff --git a/sig/openai/models/image_generate_params.rbs b/sig/openai/models/image_generate_params.rbs index e870a2487..82c73a261 100644 --- a/sig/openai/models/image_generate_params.rbs +++ b/sig/openai/models/image_generate_params.rbs @@ -154,7 +154,8 @@ module OpenAI end type size = - :auto + String + | :auto | :"1024x1024" | :"1536x1024" | :"1024x1536" @@ -164,7 +165,9 @@ module OpenAI | :"1024x1792" module Size - extend OpenAI::Internal::Type::Enum + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::ImageGenerateParams::size] AUTO: :auto SIZE_1024X1024: :"1024x1024" @@ -174,8 +177,6 @@ module OpenAI SIZE_512X512: :"512x512" SIZE_1792X1024: :"1792x1024" SIZE_1024X1792: :"1024x1792" - - def self?.values: -> ::Array[OpenAI::Models::ImageGenerateParams::size] end type style = :vivid | :natural diff --git a/sig/openai/models/image_model.rbs b/sig/openai/models/image_model.rbs index 998844461..42ef7cd52 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/realtime/audio_transcription.rbs b/sig/openai/models/realtime/audio_transcription.rbs index 2eccd1935..1d3906078 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 000000000..822a6b2bf --- /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 000000000..59522d663 --- /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 c07c4534e..02089dc56 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 fd104e7eb..000000000 --- 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 c072c534f..bf1c39661 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 fd5d25e31..8271fe978 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 195d2a4db..39e940d55 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/models/realtime/realtime_translation_client_event.rbs b/sig/openai/models/realtime/realtime_translation_client_event.rbs new file mode 100644 index 000000000..f385a893b --- /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 000000000..067d096f1 --- /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 000000000..fd53a2615 --- /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 000000000..3b41b12a1 --- /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 000000000..4a29b0455 --- /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 000000000..d1ce5faed --- /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 000000000..4d14bbfbb --- /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 000000000..cd71e1fed --- /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 000000000..3f016962c --- /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 000000000..967f3649f --- /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 000000000..ea0ec8789 --- /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 000000000..3116e67a9 --- /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 000000000..593c6ea9d --- /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 000000000..3e14aa1f5 --- /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 000000000..6ef216aa5 --- /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 000000000..78077f355 --- /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 diff --git a/sig/openai/models/responses/tool.rbs b/sig/openai/models/responses/tool.rbs index e46f382c8..80aa45631 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 @@ -541,17 +550,18 @@ module OpenAI def self?.values: -> ::Array[OpenAI::Models::Responses::Tool::ImageGeneration::quality] end - type size = :"1024x1024" | :"1024x1536" | :"1536x1024" | :auto + type size = + String | :"1024x1024" | :"1024x1536" | :"1536x1024" | :auto module Size - extend OpenAI::Internal::Type::Enum + 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 - - def self?.values: -> ::Array[OpenAI::Models::Responses::Tool::ImageGeneration::size] end end diff --git a/sig/openai/resources/realtime/calls.rbs b/sig/openai/resources/realtime/calls.rbs index b3855ab91..7f89f2417 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?,