openai 0.33.0 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/README.md +1 -1
  4. data/lib/openai/models/conversations/conversation_item.rb +0 -4
  5. data/lib/openai/models/conversations/item_list_params.rb +1 -1
  6. data/lib/openai/models/custom_tool_input_format.rb +0 -6
  7. data/lib/openai/models/image_edit_params.rb +1 -1
  8. data/lib/openai/models/responses/custom_tool.rb +0 -6
  9. data/lib/openai/models/responses/input_token_count_params.rb +283 -0
  10. data/lib/openai/models/responses/input_token_count_response.rb +24 -0
  11. data/lib/openai/models/responses/response_code_interpreter_tool_call.rb +4 -4
  12. data/lib/openai/models/responses/response_computer_tool_call.rb +13 -18
  13. data/lib/openai/models/responses/response_computer_tool_call_output_item.rb +7 -7
  14. data/lib/openai/models/responses/response_create_params.rb +1 -1
  15. data/lib/openai/models/responses/response_includable.rb +5 -3
  16. data/lib/openai/models/responses/response_input_item.rb +0 -4
  17. data/lib/openai/models/responses/response_item.rb +0 -4
  18. data/lib/openai/models/responses/response_output_item.rb +0 -4
  19. data/lib/openai/models/responses/tool.rb +2 -12
  20. data/lib/openai/resources/conversations/items.rb +1 -1
  21. data/lib/openai/resources/images.rb +2 -2
  22. data/lib/openai/resources/responses/input_tokens.rb +61 -0
  23. data/lib/openai/resources/responses.rb +6 -2
  24. data/lib/openai/version.rb +1 -1
  25. data/lib/openai.rb +3 -0
  26. data/rbi/openai/models/custom_tool_input_format.rbi +0 -2
  27. data/rbi/openai/models/responses/custom_tool.rbi +0 -2
  28. data/rbi/openai/models/responses/input_token_count_params.rbi +601 -0
  29. data/rbi/openai/models/responses/input_token_count_response.rbi +35 -0
  30. data/rbi/openai/models/responses/response_code_interpreter_tool_call.rbi +4 -4
  31. data/rbi/openai/models/responses/response_computer_tool_call.rbi +19 -13
  32. data/rbi/openai/models/responses/response_computer_tool_call_output_item.rbi +16 -8
  33. data/rbi/openai/models/responses/response_includable.rbi +18 -8
  34. data/rbi/openai/models/responses/tool.rbi +0 -1
  35. data/rbi/openai/resources/responses/input_tokens.rbi +120 -0
  36. data/rbi/openai/resources/responses.rbi +3 -0
  37. data/sig/openai/models/responses/input_token_count_params.rbs +165 -0
  38. data/sig/openai/models/responses/input_token_count_response.rbs +24 -0
  39. data/sig/openai/models/responses/response_computer_tool_call.rbs +9 -5
  40. data/sig/openai/models/responses/response_computer_tool_call_output_item.rbs +9 -5
  41. data/sig/openai/models/responses/response_includable.rbs +11 -7
  42. data/sig/openai/resources/responses/input_tokens.rbs +24 -0
  43. data/sig/openai/resources/responses.rbs +2 -0
  44. metadata +11 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3cb9e0b4c28ff23456781eee9c645f51eaf5747102a953dbbf6daf986260b6f8
4
- data.tar.gz: 63615df1a3f18243a139ca36f39be7f05432672e30c9419f837ca8d2cab44772
3
+ metadata.gz: 0e11bef2bd54635e826382815c9f85486fa061c63f0c27e431a728de52abea20
4
+ data.tar.gz: ad82ff8c87f02f9c789a3f007d33f4b374765f912015a438d260b7a1ea48bd96
5
5
  SHA512:
6
- metadata.gz: 7b747eff83bd1fafd49814aec032f793a6d2eeb40063f87be0e0dacce5eab466e8977803f2e72db4c3f77e082dedf0e9b9321d74a615e54bf60d1ba9b438451a
7
- data.tar.gz: 00b2140c930518ad2c7d096e479ea4d7b161915197bc9cc32c5bf6b3595e8f00daa5c0fcbac243b2640701692f5973edc3a9cd5fa2d8cd09e6d8233565952896
6
+ metadata.gz: 9ece47a4b94c5545646fef9c269cb0bb906e586c28e7b38ff3112a5c4745d762c44b868ee7824011479b296862d6ded53cb83c3a5fa46110f50ec68e729611c6
7
+ data.tar.gz: 36aca46bba05e5c6c3e8a39ad305f8b9c3cd66793f3f393a12d837fe77a821d90ba9833f4acaf970ed28e96867a06c66a20e7eecf67d0cbc302675425db220fe
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.34.0 (2025-10-20)
4
+
5
+ Full Changelog: [v0.33.0...v0.34.0](https://github.com/openai/openai-ruby/compare/v0.33.0...v0.34.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** Add responses.input_tokens.count ([4c3f064](https://github.com/openai/openai-ruby/commit/4c3f06487954945b034f69c393a0a5a28fffa0c8))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * **api:** internal openapi updates ([1fbce8c](https://github.com/openai/openai-ruby/commit/1fbce8c1158482b361ea48ff996b1998031679bf))
15
+
3
16
  ## 0.33.0 (2025-10-17)
4
17
 
5
18
  Full Changelog: [v0.32.0...v0.33.0](https://github.com/openai/openai-ruby/compare/v0.32.0...v0.33.0)
data/README.md CHANGED
@@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
15
15
  <!-- x-release-please-start-version -->
16
16
 
17
17
  ```ruby
18
- gem "openai", "~> 0.33.0"
18
+ gem "openai", "~> 0.34.0"
19
19
  ```
20
20
 
21
21
  <!-- x-release-please-end -->
@@ -215,10 +215,6 @@ module OpenAI
215
215
  optional :working_directory, String, nil?: true
216
216
 
217
217
  # @!method initialize(command:, env:, timeout_ms: nil, user: nil, working_directory: nil, type: :exec)
218
- # Some parameter documentations has been truncated, see
219
- # {OpenAI::Models::Conversations::ConversationItem::LocalShellCall::Action} for
220
- # more details.
221
- #
222
218
  # Execute a shell command on the server.
223
219
  #
224
220
  # @param command [Array<String>] The command to run.
@@ -59,7 +59,7 @@ module OpenAI
59
59
  #
60
60
  # @param after [String] An item ID to list items after, used in pagination.
61
61
  #
62
- # @param include [Array<Symbol, OpenAI::Models::Responses::ResponseIncludable>] Specify additional output data to include in the model response. Currently
62
+ # @param include [Array<Symbol, OpenAI::Models::Responses::ResponseIncludable>] Specify additional output data to include in the model response. Currently suppo
63
63
  #
64
64
  # @param limit [Integer] A limit on the number of objects to be returned. Limit can range between
65
65
  #
@@ -8,10 +8,8 @@ module OpenAI
8
8
 
9
9
  discriminator :type
10
10
 
11
- # Unconstrained free-form text.
12
11
  variant :text, -> { OpenAI::CustomToolInputFormat::Text }
13
12
 
14
- # A grammar defined by the user.
15
13
  variant :grammar, -> { OpenAI::CustomToolInputFormat::Grammar }
16
14
 
17
15
  class Text < OpenAI::Internal::Type::BaseModel
@@ -22,8 +20,6 @@ module OpenAI
22
20
  required :type, const: :text
23
21
 
24
22
  # @!method initialize(type: :text)
25
- # Unconstrained free-form text.
26
- #
27
23
  # @param type [Symbol, :text] Unconstrained text format. Always `text`.
28
24
  end
29
25
 
@@ -47,8 +43,6 @@ module OpenAI
47
43
  required :type, const: :grammar
48
44
 
49
45
  # @!method initialize(definition:, syntax:, type: :grammar)
50
- # A grammar defined by the user.
51
- #
52
46
  # @param definition [String] The grammar definition.
53
47
  #
54
48
  # @param syntax [Symbol, OpenAI::Models::CustomToolInputFormat::Grammar::Syntax] The syntax of the grammar definition. One of `lark` or `regex`.
@@ -142,7 +142,7 @@ module OpenAI
142
142
  #
143
143
  # @param background [Symbol, OpenAI::Models::ImageEditParams::Background, nil] Allows to set transparency for the background of the generated image(s).
144
144
  #
145
- # @param input_fidelity [Symbol, OpenAI::Models::ImageEditParams::InputFidelity, nil] Control how much effort the model will exert to match the style and features,
145
+ # @param input_fidelity [Symbol, OpenAI::Models::ImageEditParams::InputFidelity, nil]
146
146
  #
147
147
  # @param mask [Pathname, StringIO, IO, String, OpenAI::FilePart] An additional image whose fully transparent areas (e.g. where alpha is zero) ind
148
148
  #
@@ -29,12 +29,6 @@ module OpenAI
29
29
  optional :format_, union: -> { OpenAI::CustomToolInputFormat }, api_name: :format
30
30
 
31
31
  # @!method initialize(name:, description: nil, format_: nil, type: :custom)
32
- # Some parameter documentations has been truncated, see
33
- # {OpenAI::Models::Responses::CustomTool} for more details.
34
- #
35
- # A custom tool that processes input using a specified format. Learn more about
36
- # [custom tools](https://platform.openai.com/docs/guides/function-calling#custom-tools).
37
- #
38
32
  # @param name [String] The name of the custom tool, used to identify it in tool calls.
39
33
  #
40
34
  # @param description [String] Optional description of the custom tool, used to provide more context.
@@ -0,0 +1,283 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Responses
6
+ # @see OpenAI::Resources::Responses::InputTokens#count
7
+ class InputTokenCountParams < OpenAI::Internal::Type::BaseModel
8
+ extend OpenAI::Internal::Type::RequestParameters::Converter
9
+ include OpenAI::Internal::Type::RequestParameters
10
+
11
+ # @!attribute conversation
12
+ # The conversation that this response belongs to. Items from this conversation are
13
+ # prepended to `input_items` for this response request. Input items and output
14
+ # items from this response are automatically added to this conversation after this
15
+ # response completes.
16
+ #
17
+ # @return [String, OpenAI::Models::Responses::ResponseConversationParam, nil]
18
+ optional :conversation,
19
+ union: -> {
20
+ OpenAI::Responses::InputTokenCountParams::Conversation
21
+ },
22
+ nil?: true
23
+
24
+ # @!attribute input
25
+ # Text, image, or file inputs to the model, used to generate a response
26
+ #
27
+ # @return [String, Array<OpenAI::Models::Responses::EasyInputMessage, OpenAI::Models::Responses::ResponseInputItem::Message, OpenAI::Models::Responses::ResponseOutputMessage, OpenAI::Models::Responses::ResponseFileSearchToolCall, OpenAI::Models::Responses::ResponseComputerToolCall, OpenAI::Models::Responses::ResponseInputItem::ComputerCallOutput, OpenAI::Models::Responses::ResponseFunctionWebSearch, OpenAI::Models::Responses::ResponseFunctionToolCall, OpenAI::Models::Responses::ResponseInputItem::FunctionCallOutput, OpenAI::Models::Responses::ResponseReasoningItem, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall, OpenAI::Models::Responses::ResponseCodeInterpreterToolCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::McpListTools, OpenAI::Models::Responses::ResponseInputItem::McpApprovalRequest, OpenAI::Models::Responses::ResponseInputItem::McpApprovalResponse, OpenAI::Models::Responses::ResponseInputItem::McpCall, OpenAI::Models::Responses::ResponseCustomToolCallOutput, OpenAI::Models::Responses::ResponseCustomToolCall, OpenAI::Models::Responses::ResponseInputItem::ItemReference>, nil]
28
+ optional :input, union: -> { OpenAI::Responses::InputTokenCountParams::Input }, nil?: true
29
+
30
+ # @!attribute instructions
31
+ # A system (or developer) message inserted into the model's context. When used
32
+ # along with `previous_response_id`, the instructions from a previous response
33
+ # will not be carried over to the next response. This makes it simple to swap out
34
+ # system (or developer) messages in new responses.
35
+ #
36
+ # @return [String, nil]
37
+ optional :instructions, String, nil?: true
38
+
39
+ # @!attribute model
40
+ # Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
41
+ # wide range of models with different capabilities, performance characteristics,
42
+ # and price points. Refer to the
43
+ # [model guide](https://platform.openai.com/docs/models) to browse and compare
44
+ # available models.
45
+ #
46
+ # @return [String, nil]
47
+ optional :model, String, nil?: true
48
+
49
+ # @!attribute parallel_tool_calls
50
+ # Whether to allow the model to run tool calls in parallel.
51
+ #
52
+ # @return [Boolean, nil]
53
+ optional :parallel_tool_calls, OpenAI::Internal::Type::Boolean, nil?: true
54
+
55
+ # @!attribute previous_response_id
56
+ # The unique ID of the previous response to the model. Use this to create
57
+ # multi-turn conversations. Learn more about
58
+ # [conversation state](https://platform.openai.com/docs/guides/conversation-state).
59
+ # Cannot be used in conjunction with `conversation`.
60
+ #
61
+ # @return [String, nil]
62
+ optional :previous_response_id, String, nil?: true
63
+
64
+ # @!attribute reasoning
65
+ # **gpt-5 and o-series models only** Configuration options for
66
+ # [reasoning models](https://platform.openai.com/docs/guides/reasoning).
67
+ #
68
+ # @return [OpenAI::Models::Reasoning, nil]
69
+ optional :reasoning, -> { OpenAI::Reasoning }, nil?: true
70
+
71
+ # @!attribute text
72
+ # Configuration options for a text response from the model. Can be plain text or
73
+ # structured JSON data. Learn more:
74
+ #
75
+ # - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
76
+ # - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
77
+ #
78
+ # @return [OpenAI::Models::Responses::InputTokenCountParams::Text, nil]
79
+ optional :text, -> { OpenAI::Responses::InputTokenCountParams::Text }, nil?: true
80
+
81
+ # @!attribute tool_choice
82
+ # How the model should select which tool (or tools) to use when generating a
83
+ # response. See the `tools` parameter to see how to specify which tools the model
84
+ # can call.
85
+ #
86
+ # @return [Symbol, OpenAI::Models::Responses::ToolChoiceOptions, OpenAI::Models::Responses::ToolChoiceAllowed, OpenAI::Models::Responses::ToolChoiceTypes, OpenAI::Models::Responses::ToolChoiceFunction, OpenAI::Models::Responses::ToolChoiceMcp, OpenAI::Models::Responses::ToolChoiceCustom, nil]
87
+ optional :tool_choice, union: -> { OpenAI::Responses::InputTokenCountParams::ToolChoice }, nil?: true
88
+
89
+ # @!attribute tools
90
+ # An array of tools the model may call while generating a response. You can
91
+ # specify which tool to use by setting the `tool_choice` parameter.
92
+ #
93
+ # @return [Array<OpenAI::Models::Responses::FunctionTool, OpenAI::Models::Responses::FileSearchTool, OpenAI::Models::Responses::ComputerTool, OpenAI::Models::Responses::Tool::Mcp, OpenAI::Models::Responses::Tool::CodeInterpreter, OpenAI::Models::Responses::Tool::ImageGeneration, OpenAI::Models::Responses::Tool::LocalShell, OpenAI::Models::Responses::CustomTool, OpenAI::Models::Responses::WebSearchTool, OpenAI::Models::Responses::WebSearchPreviewTool>, nil]
94
+ optional :tools, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Responses::Tool] }, nil?: true
95
+
96
+ # @!attribute truncation
97
+ # The truncation strategy to use for the model response. - `auto`: If the input to
98
+ # this Response exceeds the model's context window size, the model will truncate
99
+ # the response to fit the context window by dropping items from the beginning of
100
+ # the conversation. - `disabled` (default): If the input size will exceed the
101
+ # context window size for a model, the request will fail with a 400 error.
102
+ #
103
+ # @return [Symbol, OpenAI::Models::Responses::InputTokenCountParams::Truncation, nil]
104
+ optional :truncation, enum: -> { OpenAI::Responses::InputTokenCountParams::Truncation }
105
+
106
+ # @!method initialize(conversation: nil, input: nil, instructions: nil, model: nil, parallel_tool_calls: nil, previous_response_id: nil, reasoning: nil, text: nil, tool_choice: nil, tools: nil, truncation: nil, request_options: {})
107
+ # Some parameter documentations has been truncated, see
108
+ # {OpenAI::Models::Responses::InputTokenCountParams} for more details.
109
+ #
110
+ # @param conversation [String, OpenAI::Models::Responses::ResponseConversationParam, nil] The conversation that this response belongs to. Items from this conversation are
111
+ #
112
+ # @param input [String, Array<OpenAI::Models::Responses::EasyInputMessage, OpenAI::Models::Responses::ResponseInputItem::Message, OpenAI::Models::Responses::ResponseOutputMessage, OpenAI::Models::Responses::ResponseFileSearchToolCall, OpenAI::Models::Responses::ResponseComputerToolCall, OpenAI::Models::Responses::ResponseInputItem::ComputerCallOutput, OpenAI::Models::Responses::ResponseFunctionWebSearch, OpenAI::Models::Responses::ResponseFunctionToolCall, OpenAI::Models::Responses::ResponseInputItem::FunctionCallOutput, OpenAI::Models::Responses::ResponseReasoningItem, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall, OpenAI::Models::Responses::ResponseCodeInterpreterToolCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::McpListTools, OpenAI::Models::Responses::ResponseInputItem::McpApprovalRequest, OpenAI::Models::Responses::ResponseInputItem::McpApprovalResponse, OpenAI::Models::Responses::ResponseInputItem::McpCall, OpenAI::Models::Responses::ResponseCustomToolCallOutput, OpenAI::Models::Responses::ResponseCustomToolCall, OpenAI::Models::Responses::ResponseInputItem::ItemReference>, nil] Text, image, or file inputs to the model, used to generate a response
113
+ #
114
+ # @param instructions [String, nil] A system (or developer) message inserted into the model's context.
115
+ #
116
+ # @param model [String, nil] Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a w
117
+ #
118
+ # @param parallel_tool_calls [Boolean, nil] Whether to allow the model to run tool calls in parallel.
119
+ #
120
+ # @param previous_response_id [String, nil] The unique ID of the previous response to the model. Use this to create multi-tu
121
+ #
122
+ # @param reasoning [OpenAI::Models::Reasoning, nil] **gpt-5 and o-series models only** Configuration options for [reasoning models](
123
+ #
124
+ # @param text [OpenAI::Models::Responses::InputTokenCountParams::Text, nil] Configuration options for a text response from the model. Can be plain
125
+ #
126
+ # @param tool_choice [Symbol, OpenAI::Models::Responses::ToolChoiceOptions, OpenAI::Models::Responses::ToolChoiceAllowed, OpenAI::Models::Responses::ToolChoiceTypes, OpenAI::Models::Responses::ToolChoiceFunction, OpenAI::Models::Responses::ToolChoiceMcp, OpenAI::Models::Responses::ToolChoiceCustom, nil] How the model should select which tool (or tools) to use when generating
127
+ #
128
+ # @param tools [Array<OpenAI::Models::Responses::FunctionTool, OpenAI::Models::Responses::FileSearchTool, OpenAI::Models::Responses::ComputerTool, OpenAI::Models::Responses::Tool::Mcp, OpenAI::Models::Responses::Tool::CodeInterpreter, OpenAI::Models::Responses::Tool::ImageGeneration, OpenAI::Models::Responses::Tool::LocalShell, OpenAI::Models::Responses::CustomTool, OpenAI::Models::Responses::WebSearchTool, OpenAI::Models::Responses::WebSearchPreviewTool>, nil] An array of tools the model may call while generating a response. You can specif
129
+ #
130
+ # @param truncation [Symbol, OpenAI::Models::Responses::InputTokenCountParams::Truncation] The truncation strategy to use for the model response. - `auto`: If the input to
131
+ #
132
+ # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
133
+
134
+ # The conversation that this response belongs to. Items from this conversation are
135
+ # prepended to `input_items` for this response request. Input items and output
136
+ # items from this response are automatically added to this conversation after this
137
+ # response completes.
138
+ module Conversation
139
+ extend OpenAI::Internal::Type::Union
140
+
141
+ # The unique ID of the conversation.
142
+ variant String
143
+
144
+ # The conversation that this response belongs to.
145
+ variant -> { OpenAI::Responses::ResponseConversationParam }
146
+
147
+ # @!method self.variants
148
+ # @return [Array(String, OpenAI::Models::Responses::ResponseConversationParam)]
149
+ end
150
+
151
+ # Text, image, or file inputs to the model, used to generate a response
152
+ module Input
153
+ extend OpenAI::Internal::Type::Union
154
+
155
+ # A text input to the model, equivalent to a text input with the `user` role.
156
+ variant String
157
+
158
+ variant -> { OpenAI::Models::Responses::InputTokenCountParams::Input::ResponseInputItemArray }
159
+
160
+ # @!method self.variants
161
+ # @return [Array(String, Array<OpenAI::Models::Responses::EasyInputMessage, OpenAI::Models::Responses::ResponseInputItem::Message, OpenAI::Models::Responses::ResponseOutputMessage, OpenAI::Models::Responses::ResponseFileSearchToolCall, OpenAI::Models::Responses::ResponseComputerToolCall, OpenAI::Models::Responses::ResponseInputItem::ComputerCallOutput, OpenAI::Models::Responses::ResponseFunctionWebSearch, OpenAI::Models::Responses::ResponseFunctionToolCall, OpenAI::Models::Responses::ResponseInputItem::FunctionCallOutput, OpenAI::Models::Responses::ResponseReasoningItem, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall, OpenAI::Models::Responses::ResponseCodeInterpreterToolCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::McpListTools, OpenAI::Models::Responses::ResponseInputItem::McpApprovalRequest, OpenAI::Models::Responses::ResponseInputItem::McpApprovalResponse, OpenAI::Models::Responses::ResponseInputItem::McpCall, OpenAI::Models::Responses::ResponseCustomToolCallOutput, OpenAI::Models::Responses::ResponseCustomToolCall, OpenAI::Models::Responses::ResponseInputItem::ItemReference>)]
162
+
163
+ # @type [OpenAI::Internal::Type::Converter]
164
+ ResponseInputItemArray =
165
+ OpenAI::Internal::Type::ArrayOf[union: -> { OpenAI::Responses::ResponseInputItem }]
166
+ end
167
+
168
+ class Text < OpenAI::Internal::Type::BaseModel
169
+ # @!attribute format_
170
+ # An object specifying the format that the model must output.
171
+ #
172
+ # Configuring `{ "type": "json_schema" }` enables Structured Outputs, which
173
+ # ensures the model will match your supplied JSON schema. Learn more in the
174
+ # [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
175
+ #
176
+ # The default format is `{ "type": "text" }` with no additional options.
177
+ #
178
+ # **Not recommended for gpt-4o and newer models:**
179
+ #
180
+ # Setting to `{ "type": "json_object" }` enables the older JSON mode, which
181
+ # ensures the message the model generates is valid JSON. Using `json_schema` is
182
+ # preferred for models that support it.
183
+ #
184
+ # @return [OpenAI::Models::ResponseFormatText, OpenAI::Models::Responses::ResponseFormatTextJSONSchemaConfig, OpenAI::Models::ResponseFormatJSONObject, nil]
185
+ optional :format_, union: -> { OpenAI::Responses::ResponseFormatTextConfig }, api_name: :format
186
+
187
+ # @!attribute verbosity
188
+ # Constrains the verbosity of the model's response. Lower values will result in
189
+ # more concise responses, while higher values will result in more verbose
190
+ # responses. Currently supported values are `low`, `medium`, and `high`.
191
+ #
192
+ # @return [Symbol, OpenAI::Models::Responses::InputTokenCountParams::Text::Verbosity, nil]
193
+ optional :verbosity,
194
+ enum: -> {
195
+ OpenAI::Responses::InputTokenCountParams::Text::Verbosity
196
+ },
197
+ nil?: true
198
+
199
+ # @!method initialize(format_: nil, verbosity: nil)
200
+ # Some parameter documentations has been truncated, see
201
+ # {OpenAI::Models::Responses::InputTokenCountParams::Text} for more details.
202
+ #
203
+ # Configuration options for a text response from the model. Can be plain text or
204
+ # structured JSON data. Learn more:
205
+ #
206
+ # - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
207
+ # - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
208
+ #
209
+ # @param format_ [OpenAI::Models::ResponseFormatText, OpenAI::Models::Responses::ResponseFormatTextJSONSchemaConfig, OpenAI::Models::ResponseFormatJSONObject] An object specifying the format that the model must output.
210
+ #
211
+ # @param verbosity [Symbol, OpenAI::Models::Responses::InputTokenCountParams::Text::Verbosity, nil] Constrains the verbosity of the model's response. Lower values will result in
212
+
213
+ # Constrains the verbosity of the model's response. Lower values will result in
214
+ # more concise responses, while higher values will result in more verbose
215
+ # responses. Currently supported values are `low`, `medium`, and `high`.
216
+ #
217
+ # @see OpenAI::Models::Responses::InputTokenCountParams::Text#verbosity
218
+ module Verbosity
219
+ extend OpenAI::Internal::Type::Enum
220
+
221
+ LOW = :low
222
+ MEDIUM = :medium
223
+ HIGH = :high
224
+
225
+ # @!method self.values
226
+ # @return [Array<Symbol>]
227
+ end
228
+ end
229
+
230
+ # How the model should select which tool (or tools) to use when generating a
231
+ # response. See the `tools` parameter to see how to specify which tools the model
232
+ # can call.
233
+ module ToolChoice
234
+ extend OpenAI::Internal::Type::Union
235
+
236
+ # Controls which (if any) tool is called by the model.
237
+ #
238
+ # `none` means the model will not call any tool and instead generates a message.
239
+ #
240
+ # `auto` means the model can pick between generating a message or calling one or
241
+ # more tools.
242
+ #
243
+ # `required` means the model must call one or more tools.
244
+ variant enum: -> { OpenAI::Responses::ToolChoiceOptions }
245
+
246
+ # Constrains the tools available to the model to a pre-defined set.
247
+ variant -> { OpenAI::Responses::ToolChoiceAllowed }
248
+
249
+ # Indicates that the model should use a built-in tool to generate a response.
250
+ # [Learn more about built-in tools](https://platform.openai.com/docs/guides/tools).
251
+ variant -> { OpenAI::Responses::ToolChoiceTypes }
252
+
253
+ # Use this option to force the model to call a specific function.
254
+ variant -> { OpenAI::Responses::ToolChoiceFunction }
255
+
256
+ # Use this option to force the model to call a specific tool on a remote MCP server.
257
+ variant -> { OpenAI::Responses::ToolChoiceMcp }
258
+
259
+ # Use this option to force the model to call a specific custom tool.
260
+ variant -> { OpenAI::Responses::ToolChoiceCustom }
261
+
262
+ # @!method self.variants
263
+ # @return [Array(Symbol, OpenAI::Models::Responses::ToolChoiceOptions, OpenAI::Models::Responses::ToolChoiceAllowed, OpenAI::Models::Responses::ToolChoiceTypes, OpenAI::Models::Responses::ToolChoiceFunction, OpenAI::Models::Responses::ToolChoiceMcp, OpenAI::Models::Responses::ToolChoiceCustom)]
264
+ end
265
+
266
+ # The truncation strategy to use for the model response. - `auto`: If the input to
267
+ # this Response exceeds the model's context window size, the model will truncate
268
+ # the response to fit the context window by dropping items from the beginning of
269
+ # the conversation. - `disabled` (default): If the input size will exceed the
270
+ # context window size for a model, the request will fail with a 400 error.
271
+ module Truncation
272
+ extend OpenAI::Internal::Type::Enum
273
+
274
+ AUTO = :auto
275
+ DISABLED = :disabled
276
+
277
+ # @!method self.values
278
+ # @return [Array<Symbol>]
279
+ end
280
+ end
281
+ end
282
+ end
283
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Responses
6
+ # @see OpenAI::Resources::Responses::InputTokens#count
7
+ class InputTokenCountResponse < OpenAI::Internal::Type::BaseModel
8
+ # @!attribute input_tokens
9
+ #
10
+ # @return [Integer]
11
+ required :input_tokens, Integer
12
+
13
+ # @!attribute object
14
+ #
15
+ # @return [Symbol, :"response.input_tokens"]
16
+ required :object, const: :"response.input_tokens"
17
+
18
+ # @!method initialize(input_tokens:, object: :"response.input_tokens")
19
+ # @param input_tokens [Integer]
20
+ # @param object [Symbol, :"response.input_tokens"]
21
+ end
22
+ end
23
+ end
24
+ end
@@ -84,7 +84,7 @@ module OpenAI
84
84
  required :logs, String
85
85
 
86
86
  # @!attribute type
87
- # The type of the output. Always 'logs'.
87
+ # The type of the output. Always `logs`.
88
88
  #
89
89
  # @return [Symbol, :logs]
90
90
  required :type, const: :logs
@@ -94,12 +94,12 @@ module OpenAI
94
94
  #
95
95
  # @param logs [String] The logs output from the code interpreter.
96
96
  #
97
- # @param type [Symbol, :logs] The type of the output. Always 'logs'.
97
+ # @param type [Symbol, :logs] The type of the output. Always `logs`.
98
98
  end
99
99
 
100
100
  class Image < OpenAI::Internal::Type::BaseModel
101
101
  # @!attribute type
102
- # The type of the output. Always 'image'.
102
+ # The type of the output. Always `image`.
103
103
  #
104
104
  # @return [Symbol, :image]
105
105
  required :type, const: :image
@@ -115,7 +115,7 @@ module OpenAI
115
115
  #
116
116
  # @param url [String] The URL of the image output from the code interpreter.
117
117
  #
118
- # @param type [Symbol, :image] The type of the output. Always 'image'.
118
+ # @param type [Symbol, :image] The type of the output. Always `image`.
119
119
  end
120
120
 
121
121
  # @!method self.variants
@@ -106,8 +106,7 @@ module OpenAI
106
106
  required :button, enum: -> { OpenAI::Responses::ResponseComputerToolCall::Action::Click::Button }
107
107
 
108
108
  # @!attribute type
109
- # Specifies the event type. For a click action, this property is always set to
110
- # `click`.
109
+ # Specifies the event type. For a click action, this property is always `click`.
111
110
  #
112
111
  # @return [Symbol, :click]
113
112
  required :type, const: :click
@@ -137,7 +136,7 @@ module OpenAI
137
136
  #
138
137
  # @param y_ [Integer] The y-coordinate where the click occurred.
139
138
  #
140
- # @param type [Symbol, :click] Specifies the event type. For a click action, this property is
139
+ # @param type [Symbol, :click] Specifies the event type. For a click action, this property is always `click`.
141
140
 
142
141
  # Indicates which mouse button was pressed during the click. One of `left`,
143
142
  # `right`, `wheel`, `back`, or `forward`.
@@ -188,7 +187,7 @@ module OpenAI
188
187
  #
189
188
  # @param y_ [Integer] The y-coordinate where the double click occurred.
190
189
  #
191
- # @param type [Symbol, :double_click] Specifies the event type. For a double click action, this property is
190
+ # @param type [Symbol, :double_click] Specifies the event type. For a double click action, this property is always set
192
191
  end
193
192
 
194
193
  class Drag < OpenAI::Internal::Type::BaseModel
@@ -239,11 +238,7 @@ module OpenAI
239
238
  required :y_, Integer, api_name: :y
240
239
 
241
240
  # @!method initialize(x:, y_:)
242
- # Some parameter documentations has been truncated, see
243
- # {OpenAI::Models::Responses::ResponseComputerToolCall::Action::Drag::Path} for
244
- # more details.
245
- #
246
- # A series of x/y coordinate pairs in the drag path.
241
+ # An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`.
247
242
  #
248
243
  # @param x [Integer] The x-coordinate.
249
244
  #
@@ -273,9 +268,9 @@ module OpenAI
273
268
  #
274
269
  # A collection of keypresses the model would like to perform.
275
270
  #
276
- # @param keys [Array<String>] The combination of keys the model is requesting to be pressed. This is an
271
+ # @param keys [Array<String>] The combination of keys the model is requesting to be pressed. This is an array
277
272
  #
278
- # @param type [Symbol, :keypress] Specifies the event type. For a keypress action, this property is
273
+ # @param type [Symbol, :keypress] Specifies the event type. For a keypress action, this property is always set to
279
274
  end
280
275
 
281
276
  class Move < OpenAI::Internal::Type::BaseModel
@@ -438,23 +433,23 @@ module OpenAI
438
433
  # @!attribute code
439
434
  # The type of the pending safety check.
440
435
  #
441
- # @return [String]
442
- required :code, String
436
+ # @return [String, nil]
437
+ optional :code, String, nil?: true
443
438
 
444
439
  # @!attribute message
445
440
  # Details about the pending safety check.
446
441
  #
447
- # @return [String]
448
- required :message, String
442
+ # @return [String, nil]
443
+ optional :message, String, nil?: true
449
444
 
450
- # @!method initialize(id:, code:, message:)
445
+ # @!method initialize(id:, code: nil, message: nil)
451
446
  # A pending safety check for the computer call.
452
447
  #
453
448
  # @param id [String] The ID of the pending safety check.
454
449
  #
455
- # @param code [String] The type of the pending safety check.
450
+ # @param code [String, nil] The type of the pending safety check.
456
451
  #
457
- # @param message [String] Details about the pending safety check.
452
+ # @param message [String, nil] Details about the pending safety check.
458
453
  end
459
454
 
460
455
  # The status of the item. One of `in_progress`, `completed`, or `incomplete`.
@@ -70,23 +70,23 @@ module OpenAI
70
70
  # @!attribute code
71
71
  # The type of the pending safety check.
72
72
  #
73
- # @return [String]
74
- required :code, String
73
+ # @return [String, nil]
74
+ optional :code, String, nil?: true
75
75
 
76
76
  # @!attribute message
77
77
  # Details about the pending safety check.
78
78
  #
79
- # @return [String]
80
- required :message, String
79
+ # @return [String, nil]
80
+ optional :message, String, nil?: true
81
81
 
82
- # @!method initialize(id:, code:, message:)
82
+ # @!method initialize(id:, code: nil, message: nil)
83
83
  # A pending safety check for the computer call.
84
84
  #
85
85
  # @param id [String] The ID of the pending safety check.
86
86
  #
87
- # @param code [String] The type of the pending safety check.
87
+ # @param code [String, nil] The type of the pending safety check.
88
88
  #
89
- # @param message [String] Details about the pending safety check.
89
+ # @param message [String, nil] Details about the pending safety check.
90
90
  end
91
91
 
92
92
  # The status of the message input. One of `in_progress`, `completed`, or
@@ -305,7 +305,7 @@ module OpenAI
305
305
  #
306
306
  # @param conversation [String, OpenAI::Models::Responses::ResponseConversationParam, nil] The conversation that this response belongs to. Items from this conversation are
307
307
  #
308
- # @param include [Array<Symbol, OpenAI::Models::Responses::ResponseIncludable>, nil] Specify additional output data to include in the model response. Currently
308
+ # @param include [Array<Symbol, OpenAI::Models::Responses::ResponseIncludable>, nil] Specify additional output data to include in the model response. Currently suppo
309
309
  #
310
310
  # @param input [String, Array<OpenAI::Models::Responses::EasyInputMessage, OpenAI::Models::Responses::ResponseInputItem::Message, OpenAI::Models::Responses::ResponseOutputMessage, OpenAI::Models::Responses::ResponseFileSearchToolCall, OpenAI::Models::Responses::ResponseComputerToolCall, OpenAI::Models::Responses::ResponseInputItem::ComputerCallOutput, OpenAI::Models::Responses::ResponseFunctionWebSearch, OpenAI::Models::Responses::ResponseFunctionToolCall, OpenAI::Models::Responses::ResponseInputItem::FunctionCallOutput, OpenAI::Models::Responses::ResponseReasoningItem, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall, OpenAI::Models::Responses::ResponseCodeInterpreterToolCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::McpListTools, OpenAI::Models::Responses::ResponseInputItem::McpApprovalRequest, OpenAI::Models::Responses::ResponseInputItem::McpApprovalResponse, OpenAI::Models::Responses::ResponseInputItem::McpCall, OpenAI::Models::Responses::ResponseCustomToolCallOutput, OpenAI::Models::Responses::ResponseCustomToolCall, OpenAI::Models::Responses::ResponseInputItem::ItemReference>] Text, image, or file inputs to the model, used to generate a response.
311
311
  #
@@ -24,12 +24,14 @@ module OpenAI
24
24
  module ResponseIncludable
25
25
  extend OpenAI::Internal::Type::Enum
26
26
 
27
- CODE_INTERPRETER_CALL_OUTPUTS = :"code_interpreter_call.outputs"
28
- COMPUTER_CALL_OUTPUT_OUTPUT_IMAGE_URL = :"computer_call_output.output.image_url"
29
27
  FILE_SEARCH_CALL_RESULTS = :"file_search_call.results"
28
+ WEB_SEARCH_CALL_RESULTS = :"web_search_call.results"
29
+ WEB_SEARCH_CALL_ACTION_SOURCES = :"web_search_call.action.sources"
30
30
  MESSAGE_INPUT_IMAGE_IMAGE_URL = :"message.input_image.image_url"
31
- MESSAGE_OUTPUT_TEXT_LOGPROBS = :"message.output_text.logprobs"
31
+ COMPUTER_CALL_OUTPUT_OUTPUT_IMAGE_URL = :"computer_call_output.output.image_url"
32
+ CODE_INTERPRETER_CALL_OUTPUTS = :"code_interpreter_call.outputs"
32
33
  REASONING_ENCRYPTED_CONTENT = :"reasoning.encrypted_content"
34
+ MESSAGE_OUTPUT_TEXT_LOGPROBS = :"message.output_text.logprobs"
33
35
 
34
36
  # @!method self.values
35
37
  # @return [Array<Symbol>]
@@ -508,10 +508,6 @@ module OpenAI
508
508
  optional :working_directory, String, nil?: true
509
509
 
510
510
  # @!method initialize(command:, env:, timeout_ms: nil, user: nil, working_directory: nil, type: :exec)
511
- # Some parameter documentations has been truncated, see
512
- # {OpenAI::Models::Responses::ResponseInputItem::LocalShellCall::Action} for more
513
- # details.
514
- #
515
511
  # Execute a shell command on the server.
516
512
  #
517
513
  # @param command [Array<String>] The command to run.
@@ -199,10 +199,6 @@ module OpenAI
199
199
  optional :working_directory, String, nil?: true
200
200
 
201
201
  # @!method initialize(command:, env:, timeout_ms: nil, user: nil, working_directory: nil, type: :exec)
202
- # Some parameter documentations has been truncated, see
203
- # {OpenAI::Models::Responses::ResponseItem::LocalShellCall::Action} for more
204
- # details.
205
- #
206
202
  # Execute a shell command on the server.
207
203
  #
208
204
  # @param command [Array<String>] The command to run.
@@ -198,10 +198,6 @@ module OpenAI
198
198
  optional :working_directory, String, nil?: true
199
199
 
200
200
  # @!method initialize(command:, env:, timeout_ms: nil, user: nil, working_directory: nil, type: :exec)
201
- # Some parameter documentations has been truncated, see
202
- # {OpenAI::Models::Responses::ResponseOutputItem::LocalShellCall::Action} for more
203
- # details.
204
- #
205
201
  # Execute a shell command on the server.
206
202
  #
207
203
  # @param command [Array<String>] The command to run.