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,176 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Beta
6
+ class BetaToolSearchOutputNamespaceTool < OpenAI::Internal::Type::BaseModel
7
+ # @!attribute description
8
+ # A description of the namespace shown to the model.
9
+ #
10
+ # @return [String]
11
+ required :description, String
12
+
13
+ # @!attribute name
14
+ # The namespace name used in tool calls (for example, `crm`).
15
+ #
16
+ # @return [String]
17
+ required :name, String
18
+
19
+ # @!attribute tools
20
+ # The function/custom tools loaded inside this namespace.
21
+ #
22
+ # @return [Array<OpenAI::Models::Beta::BetaToolSearchOutputNamespaceTool::Tool::Function, OpenAI::Models::Beta::BetaCustomTool>]
23
+ required(
24
+ :tools,
25
+ -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::BetaToolSearchOutputNamespaceTool::Tool] }
26
+ )
27
+
28
+ # @!attribute type
29
+ # The type of the tool. Always `namespace`.
30
+ #
31
+ # @return [Symbol, :namespace]
32
+ required :type, const: :namespace
33
+
34
+ # @!method initialize(description:, name:, tools:, type: :namespace)
35
+ # Groups function/custom tools under a shared namespace.
36
+ #
37
+ # @param description [String]
38
+ # A description of the namespace shown to the model.
39
+ #
40
+ # @param name [String]
41
+ # The namespace name used in tool calls (for example, `crm`).
42
+ #
43
+ # @param tools [Array<OpenAI::Models::Beta::BetaToolSearchOutputNamespaceTool::Tool::Function, OpenAI::Models::Beta::BetaCustomTool>]
44
+ # The function/custom tools loaded inside this namespace.
45
+ #
46
+ # @param type [Symbol, :namespace]
47
+ # The type of the tool. Always `namespace`.
48
+
49
+ # A function or custom tool loaded into a namespace by tool search.
50
+ module Tool
51
+ extend OpenAI::Internal::Type::Union
52
+
53
+ discriminator :type
54
+
55
+ variant :function, -> { OpenAI::Beta::BetaToolSearchOutputNamespaceTool::Tool::Function }
56
+
57
+ # A custom tool that processes input using a specified format. Learn more about [custom tools](https://developers.openai.com/api/docs/guides/function-calling#custom-tools)
58
+ variant :custom, -> { OpenAI::Beta::BetaCustomTool }
59
+
60
+ class Function < OpenAI::Internal::Type::BaseModel
61
+ # @!attribute name
62
+ # The name of the loaded function tool.
63
+ #
64
+ # @return [String]
65
+ required :name, String
66
+
67
+ # @!attribute type
68
+ #
69
+ # @return [Symbol, :function]
70
+ required :type, const: :function
71
+
72
+ # @!attribute allowed_callers
73
+ # The tool invocation context(s).
74
+ #
75
+ # @return [Array<Symbol, OpenAI::Models::Beta::BetaToolSearchOutputNamespaceTool::Tool::Function::AllowedCaller>, nil]
76
+ optional(
77
+ :allowed_callers,
78
+ -> {
79
+ OpenAI::Internal::Type::ArrayOf[
80
+ enum: OpenAI::Beta::BetaToolSearchOutputNamespaceTool::Tool::Function::AllowedCaller
81
+ ]
82
+ },
83
+ nil?: true
84
+ )
85
+
86
+ # @!attribute async
87
+ # Whether the tool response can be returned asynchronously versus immediately
88
+ # returned on next response creation.
89
+ #
90
+ # @return [Boolean, nil]
91
+ optional :async, OpenAI::Internal::Type::Boolean
92
+
93
+ # @!attribute defer_loading
94
+ # Whether this function should be deferred and discovered via tool search.
95
+ #
96
+ # @return [Boolean, nil]
97
+ optional :defer_loading, OpenAI::Internal::Type::Boolean
98
+
99
+ # @!attribute description
100
+ #
101
+ # @return [String, nil]
102
+ optional :description, String, nil?: true
103
+
104
+ # @!attribute output_schema
105
+ # A JSON Schema describing the JSON value encoded in string outputs for this
106
+ # function tool. This does not describe content-array outputs.
107
+ #
108
+ # @return [Hash{Symbol=>Object}, nil]
109
+ optional(
110
+ :output_schema,
111
+ OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Unknown],
112
+ nil?: true
113
+ )
114
+
115
+ # @!attribute parameters
116
+ #
117
+ # @return [Object, nil]
118
+ optional :parameters, OpenAI::Internal::Type::Unknown, nil?: true
119
+
120
+ # @!attribute strict
121
+ # Whether to enforce strict parameter validation. If omitted, Responses attempts
122
+ # to use strict validation when the schema is compatible, and falls back to
123
+ # non-strict validation otherwise.
124
+ #
125
+ # @return [Boolean, nil]
126
+ optional :strict, OpenAI::Internal::Type::Boolean, nil?: true
127
+
128
+ # @!method initialize(name:, allowed_callers: nil, async: nil, defer_loading: nil, description: nil, output_schema: nil, parameters: nil, strict: nil, type: :function)
129
+ # @param name [String]
130
+ # The name of the loaded function tool.
131
+ #
132
+ # @param allowed_callers [Array<Symbol, OpenAI::Models::Beta::BetaToolSearchOutputNamespaceTool::Tool::Function::AllowedCaller>, nil]
133
+ # The tool invocation context(s).
134
+ #
135
+ # @param async [Boolean]
136
+ # Whether the tool response can be returned asynchronously versus immediately
137
+ # returned on next response creation.
138
+ #
139
+ # @param defer_loading [Boolean]
140
+ # Whether this function should be deferred and discovered via tool search.
141
+ #
142
+ # @param description [String, nil]
143
+ #
144
+ # @param output_schema [Hash{Symbol=>Object}, nil]
145
+ # A JSON Schema describing the JSON value encoded in string outputs for this
146
+ # function tool. This does not describe content-array outputs.
147
+ #
148
+ # @param parameters [Object, nil]
149
+ #
150
+ # @param strict [Boolean, nil]
151
+ # Whether to enforce strict parameter validation. If omitted, Responses attempts
152
+ # to use strict validation when the schema is compatible, and falls back to
153
+ # non-strict validation otherwise.
154
+ #
155
+ # @param type [Symbol, :function]
156
+
157
+ module AllowedCaller
158
+ extend OpenAI::Internal::Type::Enum
159
+
160
+ DIRECT = :direct
161
+ PROGRAMMATIC = :programmatic
162
+
163
+ # @!method self.values
164
+ # @return [Array<Symbol>]
165
+ end
166
+ end
167
+
168
+ # @!method self.variants
169
+ # @return [Array(OpenAI::Models::Beta::BetaToolSearchOutputNamespaceTool::Tool::Function, OpenAI::Models::Beta::BetaCustomTool)]
170
+ end
171
+ end
172
+ end
173
+
174
+ BetaToolSearchOutputNamespaceTool = Beta::BetaToolSearchOutputNamespaceTool
175
+ end
176
+ end
@@ -0,0 +1,313 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ # @see OpenAI::Resources::Decisions#create
6
+ class Decision < OpenAI::Internal::Type::BaseModel
7
+ # @!attribute answers
8
+ #
9
+ # @return [Array<OpenAI::Models::Decision::Answer::Predicate, OpenAI::Models::Decision::Answer::Choice, OpenAI::Models::Decision::Answer::Score, OpenAI::Models::Decision::Answer::Refusal>]
10
+ required :answers, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Decision::Answer] }
11
+
12
+ # @!attribute model
13
+ #
14
+ # @return [String]
15
+ required :model, String
16
+
17
+ # @!attribute usage
18
+ #
19
+ # @return [OpenAI::Models::Decision::Usage]
20
+ required :usage, -> { OpenAI::Decision::Usage }
21
+
22
+ # @!method initialize(answers:, model:, usage:)
23
+ # @param answers [Array<OpenAI::Models::Decision::Answer::Predicate, OpenAI::Models::Decision::Answer::Choice, OpenAI::Models::Decision::Answer::Score, OpenAI::Models::Decision::Answer::Refusal>]
24
+ # @param model [String]
25
+ # @param usage [OpenAI::Models::Decision::Usage]
26
+
27
+ # A completed question always includes its name, including null when unnamed.
28
+ module Answer
29
+ extend OpenAI::Internal::Type::Union
30
+
31
+ discriminator :type
32
+
33
+ variant :predicate, -> { OpenAI::Decision::Answer::Predicate }
34
+
35
+ variant :choice, -> { OpenAI::Decision::Answer::Choice }
36
+
37
+ variant :score, -> { OpenAI::Decision::Answer::Score }
38
+
39
+ # The host may decline one question without disclosing its refusal score.
40
+ variant :refusal, -> { OpenAI::Decision::Answer::Refusal }
41
+
42
+ class Predicate < OpenAI::Internal::Type::BaseModel
43
+ # @!attribute name
44
+ #
45
+ # @return [String, nil]
46
+ required :name, String, nil?: true
47
+
48
+ # @!attribute probability
49
+ #
50
+ # @return [Float]
51
+ required :probability, Float
52
+
53
+ # @!attribute type
54
+ # The type of the object. Always `predicate`.
55
+ #
56
+ # @return [Symbol, :predicate]
57
+ required :type, const: :predicate
58
+
59
+ # @!method initialize(name:, probability:, type: :predicate)
60
+ # @param name [String, nil]
61
+ #
62
+ # @param probability [Float]
63
+ #
64
+ # @param type [Symbol, :predicate]
65
+ # The type of the object. Always `predicate`.
66
+ end
67
+
68
+ class Choice < OpenAI::Internal::Type::BaseModel
69
+ # @!attribute choice
70
+ # Choice values are typed: a string and a boolean with the same text are distinct.
71
+ #
72
+ # @return [String, Boolean]
73
+ required :choice, union: -> { OpenAI::Decision::Answer::Choice::Choice }
74
+
75
+ # @!attribute confidence
76
+ #
77
+ # @return [Float]
78
+ required :confidence, Float
79
+
80
+ # @!attribute name
81
+ #
82
+ # @return [String, nil]
83
+ required :name, String, nil?: true
84
+
85
+ # @!attribute probabilities
86
+ #
87
+ # @return [Array<OpenAI::Models::Decision::Answer::Choice::Probability>]
88
+ required(
89
+ :probabilities,
90
+ -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Decision::Answer::Choice::Probability] }
91
+ )
92
+
93
+ # @!attribute type
94
+ # The type of the object. Always `choice`.
95
+ #
96
+ # @return [Symbol, :choice]
97
+ required :type, const: :choice
98
+
99
+ # @!method initialize(choice:, confidence:, name:, probabilities:, type: :choice)
100
+ # @param choice [String, Boolean]
101
+ # Choice values are typed: a string and a boolean with the same text are distinct.
102
+ #
103
+ # @param confidence [Float]
104
+ #
105
+ # @param name [String, nil]
106
+ #
107
+ # @param probabilities [Array<OpenAI::Models::Decision::Answer::Choice::Probability>]
108
+ #
109
+ # @param type [Symbol, :choice]
110
+ # The type of the object. Always `choice`.
111
+
112
+ # Choice values are typed: a string and a boolean with the same text are distinct.
113
+ #
114
+ # @see OpenAI::Models::Decision::Answer::Choice#choice
115
+ module Choice
116
+ extend OpenAI::Internal::Type::Union
117
+
118
+ variant String
119
+
120
+ variant OpenAI::Internal::Type::Boolean
121
+
122
+ # @!method self.variants
123
+ # @return [Array(String, Boolean)]
124
+ end
125
+
126
+ class Probability < OpenAI::Internal::Type::BaseModel
127
+ # @!attribute probability
128
+ #
129
+ # @return [Float]
130
+ required :probability, Float
131
+
132
+ # @!attribute value
133
+ # Choice values are typed: a string and a boolean with the same text are distinct.
134
+ #
135
+ # @return [String, Boolean]
136
+ required :value, union: -> { OpenAI::Decision::Answer::Choice::Probability::Value }
137
+
138
+ # @!method initialize(probability:, value:)
139
+ # @param probability [Float]
140
+ #
141
+ # @param value [String, Boolean]
142
+ # Choice values are typed: a string and a boolean with the same text are distinct.
143
+
144
+ # Choice values are typed: a string and a boolean with the same text are distinct.
145
+ #
146
+ # @see OpenAI::Models::Decision::Answer::Choice::Probability#value
147
+ module Value
148
+ extend OpenAI::Internal::Type::Union
149
+
150
+ variant String
151
+
152
+ variant OpenAI::Internal::Type::Boolean
153
+
154
+ # @!method self.variants
155
+ # @return [Array(String, Boolean)]
156
+ end
157
+ end
158
+ end
159
+
160
+ class Score < OpenAI::Internal::Type::BaseModel
161
+ # @!attribute confidence
162
+ #
163
+ # @return [Float]
164
+ required :confidence, Float
165
+
166
+ # @!attribute name
167
+ #
168
+ # @return [String, nil]
169
+ required :name, String, nil?: true
170
+
171
+ # @!attribute probabilities
172
+ #
173
+ # @return [Array<OpenAI::Models::Decision::Answer::Score::Probability>]
174
+ required(
175
+ :probabilities,
176
+ -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Decision::Answer::Score::Probability] }
177
+ )
178
+
179
+ # @!attribute score
180
+ #
181
+ # @return [Float]
182
+ required :score, Float
183
+
184
+ # @!attribute type
185
+ # The type of the object. Always `score`.
186
+ #
187
+ # @return [Symbol, :score]
188
+ required :type, const: :score
189
+
190
+ # @!method initialize(confidence:, name:, probabilities:, score:, type: :score)
191
+ # @param confidence [Float]
192
+ #
193
+ # @param name [String, nil]
194
+ #
195
+ # @param probabilities [Array<OpenAI::Models::Decision::Answer::Score::Probability>]
196
+ #
197
+ # @param score [Float]
198
+ #
199
+ # @param type [Symbol, :score]
200
+ # The type of the object. Always `score`.
201
+ class Probability < OpenAI::Internal::Type::BaseModel
202
+ # @!attribute label
203
+ #
204
+ # @return [String]
205
+ required :label, String
206
+
207
+ # @!attribute probability
208
+ #
209
+ # @return [Float]
210
+ required :probability, Float
211
+
212
+ # @!attribute value
213
+ #
214
+ # @return [Integer]
215
+ required :value, Integer
216
+
217
+ # @!method initialize(label:, probability:, value:)
218
+ # @param label [String]
219
+ # @param probability [Float]
220
+ # @param value [Integer]
221
+ end
222
+ end
223
+
224
+ class Refusal < OpenAI::Internal::Type::BaseModel
225
+ # @!attribute name
226
+ #
227
+ # @return [String, nil]
228
+ required :name, String, nil?: true
229
+
230
+ # @!attribute type
231
+ # The type of the object. Always `refusal`.
232
+ #
233
+ # @return [Symbol, :refusal]
234
+ required :type, const: :refusal
235
+
236
+ # @!method initialize(name:, type: :refusal)
237
+ # The host may decline one question without disclosing its refusal score.
238
+ #
239
+ # @param name [String, nil]
240
+ #
241
+ # @param type [Symbol, :refusal]
242
+ # The type of the object. Always `refusal`.
243
+ end
244
+
245
+ # @!method self.variants
246
+ # @return [Array(OpenAI::Models::Decision::Answer::Predicate, OpenAI::Models::Decision::Answer::Choice, OpenAI::Models::Decision::Answer::Score, OpenAI::Models::Decision::Answer::Refusal)]
247
+ end
248
+
249
+ # @see OpenAI::Models::Decision#usage
250
+ class Usage < OpenAI::Internal::Type::BaseModel
251
+ # @!attribute input_tokens
252
+ #
253
+ # @return [Integer]
254
+ required :input_tokens, Integer
255
+
256
+ # @!attribute input_tokens_details
257
+ #
258
+ # @return [OpenAI::Models::Decision::Usage::InputTokensDetails]
259
+ required :input_tokens_details, -> { OpenAI::Decision::Usage::InputTokensDetails }
260
+
261
+ # @!attribute output_tokens
262
+ #
263
+ # @return [Integer]
264
+ required :output_tokens, Integer
265
+
266
+ # @!attribute output_tokens_details
267
+ #
268
+ # @return [OpenAI::Models::Decision::Usage::OutputTokensDetails]
269
+ required :output_tokens_details, -> { OpenAI::Decision::Usage::OutputTokensDetails }
270
+
271
+ # @!attribute total_tokens
272
+ #
273
+ # @return [Integer]
274
+ required :total_tokens, Integer
275
+
276
+ # @!method initialize(input_tokens:, input_tokens_details:, output_tokens:, output_tokens_details:, total_tokens:)
277
+ # @param input_tokens [Integer]
278
+ # @param input_tokens_details [OpenAI::Models::Decision::Usage::InputTokensDetails]
279
+ # @param output_tokens [Integer]
280
+ # @param output_tokens_details [OpenAI::Models::Decision::Usage::OutputTokensDetails]
281
+ # @param total_tokens [Integer]
282
+
283
+ # @see OpenAI::Models::Decision::Usage#input_tokens_details
284
+ class InputTokensDetails < OpenAI::Internal::Type::BaseModel
285
+ # @!attribute cache_write_tokens
286
+ #
287
+ # @return [Integer]
288
+ required :cache_write_tokens, Integer
289
+
290
+ # @!attribute cached_tokens
291
+ #
292
+ # @return [Integer]
293
+ required :cached_tokens, Integer
294
+
295
+ # @!method initialize(cache_write_tokens:, cached_tokens:)
296
+ # @param cache_write_tokens [Integer]
297
+ # @param cached_tokens [Integer]
298
+ end
299
+
300
+ # @see OpenAI::Models::Decision::Usage#output_tokens_details
301
+ class OutputTokensDetails < OpenAI::Internal::Type::BaseModel
302
+ # @!attribute reasoning_tokens
303
+ #
304
+ # @return [Integer]
305
+ required :reasoning_tokens, Integer
306
+
307
+ # @!method initialize(reasoning_tokens:)
308
+ # @param reasoning_tokens [Integer]
309
+ end
310
+ end
311
+ end
312
+ end
313
+ end