openai 0.100.0 → 0.101.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 (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/README.md +1 -1
  4. data/lib/openai/client.rb +4 -0
  5. data/lib/openai/models/beta/beta_response_tool_search_output_item_param.rb +1166 -3
  6. data/lib/openai/models/beta/beta_tool_search_output_namespace_tool.rb +176 -0
  7. data/lib/openai/models/decision.rb +313 -0
  8. data/lib/openai/models/decision_create_params.rb +233 -0
  9. data/lib/openai/models/decision_input_image.rb +53 -0
  10. data/lib/openai/models/decision_input_message.rb +60 -0
  11. data/lib/openai/models/decision_input_part.rb +20 -0
  12. data/lib/openai/models/decision_input_text.rb +21 -0
  13. data/lib/openai/models/responses/response_tool_search_output_item_param.rb +1166 -3
  14. data/lib/openai/models/responses/tool_search_output_namespace_tool.rb +174 -0
  15. data/lib/openai/models.rb +12 -0
  16. data/lib/openai/resources/decisions.rb +59 -0
  17. data/lib/openai/version.rb +1 -1
  18. data/lib/openai.rb +9 -0
  19. data/rbi/openai/client.rbi +3 -0
  20. data/rbi/openai/models/beta/beta_response_tool_search_output_item_param.rbi +1893 -18
  21. data/rbi/openai/models/beta/beta_tool_search_output_namespace_tool.rbi +272 -0
  22. data/rbi/openai/models/decision.rbi +586 -0
  23. data/rbi/openai/models/decision_create_params.rbi +435 -0
  24. data/rbi/openai/models/decision_input_image.rbi +81 -0
  25. data/rbi/openai/models/decision_input_message.rbi +96 -0
  26. data/rbi/openai/models/decision_input_part.rbi +24 -0
  27. data/rbi/openai/models/decision_input_text.rbi +49 -0
  28. data/rbi/openai/models/responses/response_tool_search_output_item_param.rbi +1901 -18
  29. data/rbi/openai/models/responses/tool_search_output_namespace_tool.rbi +272 -0
  30. data/rbi/openai/models.rbi +12 -0
  31. data/rbi/openai/resources/decisions.rbi +57 -0
  32. data/sig/openai/client.rbs +2 -0
  33. data/sig/openai/models/beta/beta_response_tool_search_output_item_param.rbs +993 -4
  34. data/sig/openai/models/beta/beta_tool_search_output_namespace_tool.rbs +162 -0
  35. data/sig/openai/models/decision.rbs +296 -0
  36. data/sig/openai/models/decision_create_params.rbs +227 -0
  37. data/sig/openai/models/decision_input_image.rbs +51 -0
  38. data/sig/openai/models/decision_input_message.rbs +57 -0
  39. data/sig/openai/models/decision_input_part.rbs +12 -0
  40. data/sig/openai/models/decision_input_text.rbs +15 -0
  41. data/sig/openai/models/responses/response_tool_search_output_item_param.rbs +993 -4
  42. data/sig/openai/models/responses/tool_search_output_namespace_tool.rbs +160 -0
  43. data/sig/openai/models.rbs +12 -0
  44. data/sig/openai/resources/decisions.rbs +15 -0
  45. metadata +28 -1
@@ -0,0 +1,272 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+
6
+ module Responses
7
+
8
+ class ToolSearchOutputNamespaceTool < OpenAI::Internal::Type::BaseModel
9
+
10
+ OrHash = T.type_alias do
11
+ T.any(
12
+ OpenAI::Responses::ToolSearchOutputNamespaceTool,
13
+ OpenAI::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ # A description of the namespace shown to the model.
18
+ sig { returns(String) }
19
+ attr_accessor :description
20
+
21
+ # The namespace name used in tool calls (for example, `crm`).
22
+ sig { returns(String) }
23
+ attr_accessor :name
24
+
25
+ # The function/custom tools loaded inside this namespace.
26
+ sig {
27
+ returns(
28
+ T::Array[
29
+ T.any(OpenAI::Responses::ToolSearchOutputNamespaceTool::Tool::Function, OpenAI::Responses::CustomTool)
30
+ ]
31
+ )
32
+ }
33
+ attr_accessor :tools
34
+
35
+ # The type of the tool. Always `namespace`.
36
+ sig { returns(Symbol) }
37
+ attr_accessor :type
38
+
39
+ # Groups function/custom tools under a shared namespace.
40
+ sig do
41
+ params(
42
+
43
+ description: String,
44
+
45
+ name: String,
46
+
47
+ tools: T::Array[
48
+ T.any(
49
+ OpenAI::Responses::ToolSearchOutputNamespaceTool::Tool::Function::OrHash,
50
+ OpenAI::Responses::CustomTool::OrHash
51
+ )
52
+ ],
53
+
54
+ type: Symbol
55
+ )
56
+ .returns(T.attached_class)
57
+ end
58
+ def self.new(
59
+
60
+ # A description of the namespace shown to the model.
61
+ description:,
62
+
63
+ # The namespace name used in tool calls (for example, `crm`).
64
+ name:,
65
+
66
+ # The function/custom tools loaded inside this namespace.
67
+ tools:,
68
+
69
+ # The type of the tool. Always `namespace`.
70
+
71
+ type: :namespace
72
+ )
73
+ end
74
+
75
+ sig do
76
+ override.returns(
77
+ {
78
+ description: String,
79
+ name: String,
80
+ tools: T::Array[
81
+ T.any(OpenAI::Responses::ToolSearchOutputNamespaceTool::Tool::Function, OpenAI::Responses::CustomTool)
82
+ ],
83
+ type: Symbol
84
+ }
85
+ )
86
+ end
87
+ def to_hash
88
+ end
89
+
90
+ # A function or custom tool loaded into a namespace by tool search.
91
+ module Tool
92
+ extend OpenAI::Internal::Type::Union
93
+
94
+ Variants = T.type_alias {
95
+ T.any(OpenAI::Responses::ToolSearchOutputNamespaceTool::Tool::Function, OpenAI::Responses::CustomTool)
96
+ }
97
+
98
+ class Function < OpenAI::Internal::Type::BaseModel
99
+ OrHash = T.type_alias do
100
+ T.any(
101
+ OpenAI::Responses::ToolSearchOutputNamespaceTool::Tool::Function,
102
+ OpenAI::Internal::AnyHash
103
+ )
104
+ end
105
+
106
+ # The name of the loaded function tool.
107
+ sig { returns(String) }
108
+ attr_accessor :name
109
+
110
+ sig { returns(Symbol) }
111
+ attr_accessor :type
112
+
113
+ # The tool invocation context(s).
114
+ sig {
115
+ returns(
116
+ T.nilable(
117
+ T::Array[OpenAI::Responses::ToolSearchOutputNamespaceTool::Tool::Function::AllowedCaller::OrSymbol]
118
+ )
119
+ )
120
+ }
121
+ attr_accessor :allowed_callers
122
+
123
+ # Whether the tool response can be returned asynchronously versus immediately
124
+ # returned on next response creation.
125
+ sig { returns(T.nilable(T::Boolean)) }
126
+ attr_reader :async
127
+
128
+ sig { params(async: T::Boolean).void }
129
+ attr_writer :async
130
+
131
+ # Whether this function should be deferred and discovered via tool search.
132
+ sig { returns(T.nilable(T::Boolean)) }
133
+ attr_reader :defer_loading
134
+
135
+ sig { params(defer_loading: T::Boolean).void }
136
+ attr_writer :defer_loading
137
+
138
+ sig { returns(T.nilable(String)) }
139
+ attr_accessor :description
140
+
141
+ # A JSON Schema describing the JSON value encoded in string outputs for this
142
+ # function tool. This does not describe content-array outputs.
143
+ sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
144
+ attr_accessor :output_schema
145
+
146
+ sig { returns(T.nilable(T.anything)) }
147
+ attr_accessor :parameters
148
+
149
+ # Whether to enforce strict parameter validation. If omitted, Responses attempts
150
+ # to use strict validation when the schema is compatible, and falls back to
151
+ # non-strict validation otherwise.
152
+ sig { returns(T.nilable(T::Boolean)) }
153
+ attr_accessor :strict
154
+
155
+ sig do
156
+ params(
157
+
158
+ name: String,
159
+
160
+ allowed_callers: T.nilable(
161
+ T::Array[OpenAI::Responses::ToolSearchOutputNamespaceTool::Tool::Function::AllowedCaller::OrSymbol]
162
+ ),
163
+
164
+ async: T::Boolean,
165
+
166
+ defer_loading: T::Boolean,
167
+
168
+ description: T.nilable(String),
169
+
170
+ output_schema: T.nilable(T::Hash[Symbol, T.anything]),
171
+
172
+ parameters: T.nilable(T.anything),
173
+
174
+ strict: T.nilable(T::Boolean),
175
+
176
+ type: Symbol
177
+ )
178
+ .returns(T.attached_class)
179
+ end
180
+ def self.new(
181
+
182
+ # The name of the loaded function tool.
183
+ name:,
184
+
185
+ # The tool invocation context(s).
186
+ allowed_callers: nil,
187
+
188
+ # Whether the tool response can be returned asynchronously versus immediately
189
+ # returned on next response creation.
190
+ async: nil,
191
+
192
+ # Whether this function should be deferred and discovered via tool search.
193
+ defer_loading: nil,
194
+
195
+ description: nil,
196
+
197
+ # A JSON Schema describing the JSON value encoded in string outputs for this
198
+ # function tool. This does not describe content-array outputs.
199
+ output_schema: nil,
200
+
201
+ parameters: nil,
202
+
203
+ # Whether to enforce strict parameter validation. If omitted, Responses attempts
204
+ # to use strict validation when the schema is compatible, and falls back to
205
+ # non-strict validation otherwise.
206
+ strict: nil,
207
+
208
+ type: :function
209
+ )
210
+ end
211
+
212
+ sig do
213
+ override.returns(
214
+ {
215
+ name: String,
216
+ type: Symbol,
217
+ allowed_callers: T.nilable(
218
+ T::Array[OpenAI::Responses::ToolSearchOutputNamespaceTool::Tool::Function::AllowedCaller::OrSymbol]
219
+ ),
220
+ async: T::Boolean,
221
+ defer_loading: T::Boolean,
222
+ description: T.nilable(String),
223
+ output_schema: T.nilable(T::Hash[Symbol, T.anything]),
224
+ parameters: T.nilable(T.anything),
225
+ strict: T.nilable(T::Boolean)
226
+ }
227
+ )
228
+ end
229
+ def to_hash
230
+ end
231
+
232
+ module AllowedCaller
233
+ extend OpenAI::Internal::Type::Enum
234
+
235
+ TaggedSymbol = T.type_alias {
236
+ T.all(Symbol, OpenAI::Responses::ToolSearchOutputNamespaceTool::Tool::Function::AllowedCaller)
237
+ }
238
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
239
+
240
+ DIRECT = T.let(
241
+ :direct,
242
+ OpenAI::Responses::ToolSearchOutputNamespaceTool::Tool::Function::AllowedCaller::TaggedSymbol
243
+ )
244
+ PROGRAMMATIC = T.let(
245
+ :programmatic,
246
+ OpenAI::Responses::ToolSearchOutputNamespaceTool::Tool::Function::AllowedCaller::TaggedSymbol
247
+ )
248
+
249
+ sig {
250
+ override.returns(
251
+ T::Array[
252
+ OpenAI::Responses::ToolSearchOutputNamespaceTool::Tool::Function::AllowedCaller::TaggedSymbol
253
+ ]
254
+ )
255
+ }
256
+ def self.values
257
+ end
258
+ end
259
+ end
260
+
261
+ sig { override.returns(T::Array[OpenAI::Responses::ToolSearchOutputNamespaceTool::Tool::Variants]) }
262
+ def self.variants
263
+ end
264
+
265
+ end
266
+
267
+ end
268
+
269
+ end
270
+
271
+ end
272
+ end
@@ -68,6 +68,18 @@ module OpenAI
68
68
 
69
69
  CustomToolInputFormat = OpenAI::Models::CustomToolInputFormat
70
70
 
71
+ Decision = OpenAI::Models::Decision
72
+
73
+ DecisionCreateParams = OpenAI::Models::DecisionCreateParams
74
+
75
+ DecisionInputImage = OpenAI::Models::DecisionInputImage
76
+
77
+ DecisionInputMessage = OpenAI::Models::DecisionInputMessage
78
+
79
+ DecisionInputPart = OpenAI::Models::DecisionInputPart
80
+
81
+ DecisionInputText = OpenAI::Models::DecisionInputText
82
+
71
83
  DeletedSkill = OpenAI::Models::DeletedSkill
72
84
 
73
85
  Embedding = OpenAI::Models::Embedding
@@ -0,0 +1,57 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Resources
5
+
6
+ class Decisions
7
+
8
+ # Evaluate ordered classification and scoring questions against shared input.
9
+ # Answers are returned in question order.
10
+ #
11
+ # Supply input as a string or user messages containing text and inline images.
12
+ # Only user messages with `input_text` and `input_image` parts are supported;
13
+ # non-user roles, function calls, files, audio, and item references are not
14
+ # supported. Images require a data URL, not an external URL or file ID. At most
15
+ # 128 images are allowed across the request.
16
+ #
17
+ # Each question can return a refusal instead of a scored answer. A refusal has
18
+ # type `refusal` and the corresponding question name, or null if unnamed.
19
+ sig {
20
+ params(
21
+ input: OpenAI::DecisionCreateParams::Input::Variants,
22
+ model: String,
23
+ questions: T::Array[
24
+ T.any(
25
+ OpenAI::DecisionCreateParams::Question::Predicate::OrHash,
26
+ OpenAI::DecisionCreateParams::Question::Choice::OrHash,
27
+ OpenAI::DecisionCreateParams::Question::Score::OrHash
28
+ )
29
+ ],
30
+ safety_identifier: T.nilable(String),
31
+ request_options: OpenAI::RequestOptions::OrHash
32
+ )
33
+ .returns(OpenAI::Decision)
34
+ }
35
+ def create(
36
+ # Shared evidence, as a string or an array of user messages containing text and
37
+ # inline images. Non-user roles, function calls, function-call outputs, files,
38
+ # audio, and item references are not supported. At most 128 image parts are
39
+ # allowed across all messages in one request.
40
+ input:,
41
+ model:,
42
+ questions:,
43
+ # Opaque caller-provided end-user identifier, scoped by the verified org. Match
44
+ # Responses' limit; this is never the authenticated user identity.
45
+ safety_identifier: nil,
46
+ request_options: {}
47
+ )
48
+ end
49
+
50
+ # @api private
51
+ sig { params(client: OpenAI::Client).returns(T.attached_class) }
52
+ def self.new(client:)
53
+ end
54
+ end
55
+
56
+ end
57
+ end
@@ -20,6 +20,8 @@ module OpenAI
20
20
 
21
21
  attr_reader webhook_secret: String?
22
22
 
23
+ attr_reader decisions: OpenAI::Resources::Decisions
24
+
23
25
  attr_reader completions: OpenAI::Resources::Completions
24
26
 
25
27
  attr_reader chat: OpenAI::Resources::Chat