Skip to content

Commit c4565ed

Browse files
feat(api): add image sizes, reasoning encryption
1 parent f3fc915 commit c4565ed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+593
-399
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 95
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-8b68ae6b807dca92e914da1dd9e835a20f69b075e79102a264367fd7fddddb33.yml
3-
openapi_spec_hash: b6ade5b1a6327339e6669e1134de2d03
4-
config_hash: b597cd9a31e9e5ec709e2eefb4c54122
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-0ee6b36cf3cc278cef4199a6aec5f7d530a6c1f17a74830037e96d50ca1edc50.yml
3+
openapi_spec_hash: e8ec5f46bc0655b34f292422d58a60f6
4+
config_hash: d9b6b6e6bc85744663e300eebc482067

lib/openai/models/audio/speech_create_params.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class SpeechCreateParams < OpenAI::Internal::Type::BaseModel
4646

4747
# @!attribute speed
4848
# The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is
49-
# the default.
49+
# the default. Does not work with `gpt-4o-mini-tts`.
5050
#
5151
# @return [Float, nil]
5252
optional :speed, Float

lib/openai/models/image_edit_params.rb

Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@ class ImageEditParams < OpenAI::Internal::Type::BaseModel
88
include OpenAI::Internal::Type::RequestParameters
99

1010
# @!attribute image
11-
# The image(s) to edit. Must be a supported image file or an array of images. For
12-
# `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
13-
# 25MB. For `dall-e-2`, you can only provide one image, and it should be a square
14-
# `png` file less than 4MB.
11+
# The image(s) to edit. Must be a supported image file or an array of images.
12+
#
13+
# For `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
14+
# 25MB. You can provide up to 16 images.
15+
#
16+
# For `dall-e-2`, you can only provide one image, and it should be a square `png`
17+
# file less than 4MB.
1518
#
1619
# @return [Pathname, StringIO, IO, OpenAI::FilePart, Array<Pathname, StringIO, IO, OpenAI::FilePart>]
1720
required :image, union: -> { OpenAI::Models::ImageEditParams::Image }
@@ -23,6 +26,18 @@ class ImageEditParams < OpenAI::Internal::Type::BaseModel
2326
# @return [String]
2427
required :prompt, String
2528

29+
# @!attribute background
30+
# Allows to set transparency for the background of the generated image(s). This
31+
# parameter is only supported for `gpt-image-1`. Must be one of `transparent`,
32+
# `opaque` or `auto` (default value). When `auto` is used, the model will
33+
# automatically determine the best background for the image.
34+
#
35+
# If `transparent`, the output format needs to support transparency, so it should
36+
# be set to either `png` (default value) or `webp`.
37+
#
38+
# @return [Symbol, OpenAI::Models::ImageEditParams::Background, nil]
39+
optional :background, enum: -> { OpenAI::Models::ImageEditParams::Background }, nil?: true
40+
2641
# @!attribute mask
2742
# An additional image whose fully transparent areas (e.g. where alpha is zero)
2843
# indicate where `image` should be edited. If there are multiple images provided,
@@ -79,16 +94,17 @@ class ImageEditParams < OpenAI::Internal::Type::BaseModel
7994
# @return [String, nil]
8095
optional :user, String
8196

82-
# @!method initialize(image:, prompt:, mask: nil, model: nil, n: nil, quality: nil, response_format: nil, size: nil, user: nil, request_options: {})
97+
# @!method initialize(image:, prompt:, background: nil, mask: nil, model: nil, n: nil, quality: nil, response_format: nil, size: nil, user: nil, request_options: {})
8398
# Some parameter documentations has been truncated, see
8499
# {OpenAI::Models::ImageEditParams} for more details.
85100
#
86-
# @param image [Pathname, StringIO, IO, OpenAI::FilePart, Array<Pathname, StringIO, IO, OpenAI::FilePart>] The image(s) to edit. Must be a supported image file or an array of images. For
87-
# ...
101+
# @param image [Pathname, StringIO, IO, OpenAI::FilePart, Array<Pathname, StringIO, IO, OpenAI::FilePart>] The image(s) to edit. Must be a supported image file or an array of images. ...
88102
#
89103
# @param prompt [String] A text description of the desired image(s). The maximum length is 1000 character
90104
# ...
91105
#
106+
# @param background [Symbol, OpenAI::Models::ImageEditParams::Background, nil] Allows to set transparency for the background of the generated image(s). ...
107+
#
92108
# @param mask [Pathname, StringIO, IO, OpenAI::FilePart] An additional image whose fully transparent areas (e.g. where alpha is zero) ind
93109
# ...
94110
#
@@ -111,10 +127,13 @@ class ImageEditParams < OpenAI::Internal::Type::BaseModel
111127
#
112128
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
113129

114-
# The image(s) to edit. Must be a supported image file or an array of images. For
115-
# `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
116-
# 25MB. For `dall-e-2`, you can only provide one image, and it should be a square
117-
# `png` file less than 4MB.
130+
# The image(s) to edit. Must be a supported image file or an array of images.
131+
#
132+
# For `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
133+
# 25MB. You can provide up to 16 images.
134+
#
135+
# For `dall-e-2`, you can only provide one image, and it should be a square `png`
136+
# file less than 4MB.
118137
module Image
119138
extend OpenAI::Internal::Type::Union
120139

@@ -129,6 +148,24 @@ module Image
129148
StringArray = OpenAI::Internal::Type::ArrayOf[OpenAI::Internal::Type::FileInput]
130149
end
131150

151+
# Allows to set transparency for the background of the generated image(s). This
152+
# parameter is only supported for `gpt-image-1`. Must be one of `transparent`,
153+
# `opaque` or `auto` (default value). When `auto` is used, the model will
154+
# automatically determine the best background for the image.
155+
#
156+
# If `transparent`, the output format needs to support transparency, so it should
157+
# be set to either `png` (default value) or `webp`.
158+
module Background
159+
extend OpenAI::Internal::Type::Enum
160+
161+
TRANSPARENT = :transparent
162+
OPAQUE = :opaque
163+
AUTO = :auto
164+
165+
# @!method self.values
166+
# @return [Array<Symbol>]
167+
end
168+
132169
# The model to use for image generation. Only `dall-e-2` and `gpt-image-1` are
133170
# supported. Defaults to `dall-e-2` unless a parameter specific to `gpt-image-1`
134171
# is used.
@@ -183,6 +220,9 @@ module Size
183220
SIZE_256X256 = :"256x256"
184221
SIZE_512X512 = :"512x512"
185222
SIZE_1024X1024 = :"1024x1024"
223+
SIZE_1536X1024 = :"1536x1024"
224+
SIZE_1024X1536 = :"1024x1536"
225+
AUTO = :auto
186226

187227
# @!method self.values
188228
# @return [Array<Symbol>]

lib/openai/models/responses/computer_tool.rb

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ class ComputerTool < OpenAI::Internal::Type::BaseModel
77
# @!attribute display_height
88
# The height of the computer display.
99
#
10-
# @return [Float]
11-
required :display_height, Float
10+
# @return [Integer]
11+
required :display_height, Integer
1212

1313
# @!attribute display_width
1414
# The width of the computer display.
1515
#
16-
# @return [Float]
17-
required :display_width, Float
16+
# @return [Integer]
17+
required :display_width, Integer
1818

1919
# @!attribute environment
2020
# The type of computer environment to control.
@@ -29,28 +29,26 @@ class ComputerTool < OpenAI::Internal::Type::BaseModel
2929
required :type, const: :computer_use_preview
3030

3131
# @!method initialize(display_height:, display_width:, environment:, type: :computer_use_preview)
32-
# Some parameter documentations has been truncated, see
33-
# {OpenAI::Models::Responses::ComputerTool} for more details.
34-
#
3532
# A tool that controls a virtual computer. Learn more about the
3633
# [computer tool](https://platform.openai.com/docs/guides/tools-computer-use).
3734
#
38-
# @param display_height [Float] The height of the computer display. ...
35+
# @param display_height [Integer] The height of the computer display.
3936
#
40-
# @param display_width [Float] The width of the computer display. ...
37+
# @param display_width [Integer] The width of the computer display.
4138
#
42-
# @param environment [Symbol, OpenAI::Models::Responses::ComputerTool::Environment] The type of computer environment to control. ...
39+
# @param environment [Symbol, OpenAI::Models::Responses::ComputerTool::Environment] The type of computer environment to control.
4340
#
44-
# @param type [Symbol, :computer_use_preview] The type of the computer use tool. Always `computer_use_preview`. ...
41+
# @param type [Symbol, :computer_use_preview] The type of the computer use tool. Always `computer_use_preview`.
4542

4643
# The type of computer environment to control.
4744
#
4845
# @see OpenAI::Models::Responses::ComputerTool#environment
4946
module Environment
5047
extend OpenAI::Internal::Type::Enum
5148

52-
MAC = :mac
5349
WINDOWS = :windows
50+
MAC = :mac
51+
LINUX = :linux
5452
UBUNTU = :ubuntu
5553
BROWSER = :browser
5654

lib/openai/models/responses/file_search_tool.rb

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ class FileSearchTool < OpenAI::Internal::Type::BaseModel
1717
required :vector_store_ids, OpenAI::Internal::Type::ArrayOf[String]
1818

1919
# @!attribute filters
20-
# A filter to apply based on file attributes.
20+
# A filter to apply.
2121
#
2222
# @return [OpenAI::Models::ComparisonFilter, OpenAI::Models::CompoundFilter, nil]
23-
optional :filters, union: -> { OpenAI::Models::Responses::FileSearchTool::Filters }
23+
optional :filters, union: -> { OpenAI::Models::Responses::FileSearchTool::Filters }, nil?: true
2424

2525
# @!attribute max_num_results
2626
# The maximum number of results to return. This number should be between 1 and 50
@@ -43,17 +43,18 @@ class FileSearchTool < OpenAI::Internal::Type::BaseModel
4343
# the
4444
# [file search tool](https://platform.openai.com/docs/guides/tools-file-search).
4545
#
46-
# @param vector_store_ids [Array<String>] The IDs of the vector stores to search. ...
46+
# @param vector_store_ids [Array<String>] The IDs of the vector stores to search.
4747
#
48-
# @param filters [OpenAI::Models::ComparisonFilter, OpenAI::Models::CompoundFilter] A filter to apply based on file attributes.
48+
# @param filters [OpenAI::Models::ComparisonFilter, OpenAI::Models::CompoundFilter, nil] A filter to apply.
4949
#
50-
# @param max_num_results [Integer] The maximum number of results to return. This number should be between 1 ...
50+
# @param max_num_results [Integer] The maximum number of results to return. This number should be between 1 and 50
51+
# ...
5152
#
5253
# @param ranking_options [OpenAI::Models::Responses::FileSearchTool::RankingOptions] Ranking options for search.
5354
#
54-
# @param type [Symbol, :file_search] The type of the file search tool. Always `file_search`. ...
55+
# @param type [Symbol, :file_search] The type of the file search tool. Always `file_search`.
5556

56-
# A filter to apply based on file attributes.
57+
# A filter to apply.
5758
#
5859
# @see OpenAI::Models::Responses::FileSearchTool#filters
5960
module Filters
@@ -93,7 +94,8 @@ class RankingOptions < OpenAI::Internal::Type::BaseModel
9394
#
9495
# @param ranker [Symbol, OpenAI::Models::Responses::FileSearchTool::RankingOptions::Ranker] The ranker to use for the file search.
9596
#
96-
# @param score_threshold [Float] The score threshold for the file search, a number between 0 and 1. ...
97+
# @param score_threshold [Float] The score threshold for the file search, a number between 0 and 1. Numbers close
98+
# ...
9799

98100
# The ranker to use for the file search.
99101
#

lib/openai/models/responses/function_tool.rb

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ class FunctionTool < OpenAI::Internal::Type::BaseModel
1313
# @!attribute parameters
1414
# A JSON schema object describing the parameters of the function.
1515
#
16-
# @return [Hash{Symbol=>Object}]
17-
required :parameters, OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Unknown]
16+
# @return [Hash{Symbol=>Object}, nil]
17+
required :parameters, OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Unknown], nil?: true
1818

1919
# @!attribute strict
2020
# Whether to enforce strict parameter validation. Default `true`.
2121
#
22-
# @return [Boolean]
23-
required :strict, OpenAI::Internal::Type::Boolean
22+
# @return [Boolean, nil]
23+
required :strict, OpenAI::Internal::Type::Boolean, nil?: true
2424

2525
# @!attribute type
2626
# The type of the function tool. Always `function`.
@@ -43,15 +43,16 @@ class FunctionTool < OpenAI::Internal::Type::BaseModel
4343
# about
4444
# [function calling](https://platform.openai.com/docs/guides/function-calling).
4545
#
46-
# @param name [String] The name of the function to call. ...
46+
# @param name [String] The name of the function to call.
4747
#
48-
# @param parameters [Hash{Symbol=>Object}] A JSON schema object describing the parameters of the function. ...
48+
# @param parameters [Hash{Symbol=>Object}, nil] A JSON schema object describing the parameters of the function.
4949
#
50-
# @param strict [Boolean] Whether to enforce strict parameter validation. Default `true`. ...
50+
# @param strict [Boolean, nil] Whether to enforce strict parameter validation. Default `true`.
5151
#
52-
# @param description [String, nil] A description of the function. Used by the model to determine whether ...
52+
# @param description [String, nil] A description of the function. Used by the model to determine whether or not to
53+
# ...
5354
#
54-
# @param type [Symbol, :function] The type of the function tool. Always `function`. ...
55+
# @param type [Symbol, :function] The type of the function tool. Always `function`.
5556
end
5657
end
5758
end

lib/openai/models/responses/response_create_params.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ class ResponseCreateParams < OpenAI::Internal::Type::BaseModel
4343
# - `message.input_image.image_url`: Include image urls from the input message.
4444
# - `computer_call_output.output.image_url`: Include image urls from the computer
4545
# call output.
46+
# - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
47+
# tokens in reasoning item outputs. This enables reasoning items to be used in
48+
# multi-turn conversations when using the Responses API statelessly (like when
49+
# the `store` parameter is set to `false`, or when an organization is enrolled
50+
# in the zero data retention program).
4651
#
4752
# @return [Array<Symbol, OpenAI::Models::Responses::ResponseIncludable>, nil]
4853
optional :include,

lib/openai/models/responses/response_includable.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,18 @@ module Responses
1111
# - `message.input_image.image_url`: Include image urls from the input message.
1212
# - `computer_call_output.output.image_url`: Include image urls from the computer
1313
# call output.
14+
# - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
15+
# tokens in reasoning item outputs. This enables reasoning items to be used in
16+
# multi-turn conversations when using the Responses API statelessly (like when
17+
# the `store` parameter is set to `false`, or when an organization is enrolled
18+
# in the zero data retention program).
1419
module ResponseIncludable
1520
extend OpenAI::Internal::Type::Enum
1621

1722
FILE_SEARCH_CALL_RESULTS = :"file_search_call.results"
1823
MESSAGE_INPUT_IMAGE_IMAGE_URL = :"message.input_image.image_url"
1924
COMPUTER_CALL_OUTPUT_OUTPUT_IMAGE_URL = :"computer_call_output.output.image_url"
25+
REASONING_ENCRYPTED_CONTENT = :"reasoning.encrypted_content"
2026

2127
# @!method self.values
2228
# @return [Array<Symbol>]

lib/openai/models/responses/response_input_file.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ResponseInputFile < OpenAI::Internal::Type::BaseModel
2020
# The ID of the file to be sent to the model.
2121
#
2222
# @return [String, nil]
23-
optional :file_id, String
23+
optional :file_id, String, nil?: true
2424

2525
# @!attribute filename
2626
# The name of the file to be sent to the model.
@@ -36,11 +36,11 @@ class ResponseInputFile < OpenAI::Internal::Type::BaseModel
3636
#
3737
# @param file_data [String] The content of the file to be sent to the model. ...
3838
#
39-
# @param file_id [String] The ID of the file to be sent to the model. ...
39+
# @param file_id [String, nil] The ID of the file to be sent to the model.
4040
#
41-
# @param filename [String] The name of the file to be sent to the model. ...
41+
# @param filename [String] The name of the file to be sent to the model.
4242
#
43-
# @param type [Symbol, :input_file] The type of the input item. Always `input_file`. ...
43+
# @param type [Symbol, :input_file] The type of the input item. Always `input_file`.
4444
end
4545
end
4646
end

lib/openai/models/responses/response_input_image.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,15 @@ class ResponseInputImage < OpenAI::Internal::Type::BaseModel
3737
# An image input to the model. Learn about
3838
# [image inputs](https://platform.openai.com/docs/guides/vision).
3939
#
40-
# @param detail [Symbol, OpenAI::Models::Responses::ResponseInputImage::Detail] The detail level of the image to be sent to the model. One of `high`, ...
40+
# @param detail [Symbol, OpenAI::Models::Responses::ResponseInputImage::Detail] The detail level of the image to be sent to the model. One of `high`, `low`, or
41+
# ...
4142
#
42-
# @param file_id [String, nil] The ID of the file to be sent to the model. ...
43+
# @param file_id [String, nil] The ID of the file to be sent to the model.
4344
#
44-
# @param image_url [String, nil] The URL of the image to be sent to the model. A fully qualified URL or ...
45+
# @param image_url [String, nil] The URL of the image to be sent to the model. A fully qualified URL or base64 en
46+
# ...
4547
#
46-
# @param type [Symbol, :input_image] The type of the input item. Always `input_image`. ...
48+
# @param type [Symbol, :input_image] The type of the input item. Always `input_image`.
4749

4850
# The detail level of the image to be sent to the model. One of `high`, `low`, or
4951
# `auto`. Defaults to `auto`.
@@ -52,8 +54,8 @@ class ResponseInputImage < OpenAI::Internal::Type::BaseModel
5254
module Detail
5355
extend OpenAI::Internal::Type::Enum
5456

55-
HIGH = :high
5657
LOW = :low
58+
HIGH = :high
5759
AUTO = :auto
5860

5961
# @!method self.values

0 commit comments

Comments
 (0)