openai 0.100.0 → 0.101.1

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 (67) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/README.md +1 -1
  4. data/lib/openai/client.rb +4 -0
  5. data/lib/openai/models/audio/speech_create_params.rb +3 -6
  6. data/lib/openai/models/audio/voice.rb +4 -9
  7. data/lib/openai/models/audio/voice_create_params.rb +3 -100
  8. data/lib/openai/models/beta/beta_response_tool_search_output_item_param.rb +1166 -3
  9. data/lib/openai/models/beta/beta_tool_search_output_namespace_tool.rb +176 -0
  10. data/lib/openai/models/chat/chat_completion_audio_param.rb +3 -3
  11. data/lib/openai/models/decision.rb +313 -0
  12. data/lib/openai/models/decision_create_params.rb +233 -0
  13. data/lib/openai/models/decision_input_image.rb +53 -0
  14. data/lib/openai/models/decision_input_message.rb +60 -0
  15. data/lib/openai/models/decision_input_part.rb +20 -0
  16. data/lib/openai/models/decision_input_text.rb +21 -0
  17. data/lib/openai/models/realtime/realtime_audio_config_output.rb +3 -6
  18. data/lib/openai/models/realtime/realtime_response_create_audio_output.rb +3 -6
  19. data/lib/openai/models/responses/response_tool_search_output_item_param.rb +1166 -3
  20. data/lib/openai/models/responses/tool_search_output_namespace_tool.rb +174 -0
  21. data/lib/openai/models.rb +12 -0
  22. data/lib/openai/resources/audio/speech.rb +1 -2
  23. data/lib/openai/resources/audio/voices.rb +10 -10
  24. data/lib/openai/resources/decisions.rb +59 -0
  25. data/lib/openai/version.rb +1 -1
  26. data/lib/openai.rb +9 -0
  27. data/rbi/openai/client.rbi +3 -0
  28. data/rbi/openai/models/audio/speech_create_params.rbi +3 -6
  29. data/rbi/openai/models/audio/voice.rbi +4 -9
  30. data/rbi/openai/models/audio/voice_create_params.rbi +4 -149
  31. data/rbi/openai/models/beta/beta_response_tool_search_output_item_param.rbi +1893 -18
  32. data/rbi/openai/models/beta/beta_tool_search_output_namespace_tool.rbi +272 -0
  33. data/rbi/openai/models/chat/chat_completion_audio_param.rbi +3 -3
  34. data/rbi/openai/models/decision.rbi +586 -0
  35. data/rbi/openai/models/decision_create_params.rbi +435 -0
  36. data/rbi/openai/models/decision_input_image.rbi +81 -0
  37. data/rbi/openai/models/decision_input_message.rbi +96 -0
  38. data/rbi/openai/models/decision_input_part.rbi +24 -0
  39. data/rbi/openai/models/decision_input_text.rbi +49 -0
  40. data/rbi/openai/models/realtime/realtime_audio_config_output.rbi +3 -6
  41. data/rbi/openai/models/realtime/realtime_response_create_audio_output.rbi +3 -6
  42. data/rbi/openai/models/responses/response_tool_search_output_item_param.rbi +1901 -18
  43. data/rbi/openai/models/responses/tool_search_output_namespace_tool.rbi +272 -0
  44. data/rbi/openai/models.rbi +12 -0
  45. data/rbi/openai/resources/audio/speech.rbi +1 -2
  46. data/rbi/openai/resources/audio/voices.rbi +10 -13
  47. data/rbi/openai/resources/decisions.rbi +57 -0
  48. data/sig/openai/client.rbs +2 -0
  49. data/sig/openai/models/audio/speech_create_params.rbs +2 -4
  50. data/sig/openai/models/audio/voice.rbs +3 -6
  51. data/sig/openai/models/audio/voice_create_params.rbs +1 -90
  52. data/sig/openai/models/beta/beta_response_tool_search_output_item_param.rbs +993 -4
  53. data/sig/openai/models/beta/beta_tool_search_output_namespace_tool.rbs +162 -0
  54. data/sig/openai/models/chat/chat_completion_audio_param.rbs +2 -2
  55. data/sig/openai/models/decision.rbs +296 -0
  56. data/sig/openai/models/decision_create_params.rbs +227 -0
  57. data/sig/openai/models/decision_input_image.rbs +51 -0
  58. data/sig/openai/models/decision_input_message.rbs +57 -0
  59. data/sig/openai/models/decision_input_part.rbs +12 -0
  60. data/sig/openai/models/decision_input_text.rbs +15 -0
  61. data/sig/openai/models/realtime/realtime_audio_config_output.rbs +3 -6
  62. data/sig/openai/models/realtime/realtime_response_create_audio_output.rbs +3 -6
  63. data/sig/openai/models/responses/response_tool_search_output_item_param.rbs +993 -4
  64. data/sig/openai/models/responses/tool_search_output_namespace_tool.rbs +160 -0
  65. data/sig/openai/models.rbs +12 -0
  66. data/sig/openai/resources/decisions.rbs +15 -0
  67. metadata +28 -1
@@ -0,0 +1,233 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ # @see OpenAI::Resources::Decisions#create
6
+ class DecisionCreateParams < OpenAI::Internal::Type::BaseModel
7
+ extend OpenAI::Internal::Type::RequestParameters::Converter
8
+ include OpenAI::Internal::Type::RequestParameters
9
+
10
+ # @!attribute input
11
+ # Shared evidence, as a string or an array of user messages containing text and
12
+ # inline images. Non-user roles, function calls, function-call outputs, files,
13
+ # audio, and item references are not supported. At most 128 image parts are
14
+ # allowed across all messages in one request.
15
+ #
16
+ # @return [String, Array<OpenAI::Models::DecisionInputMessage>]
17
+ required :input, union: -> { OpenAI::DecisionCreateParams::Input }
18
+
19
+ # @!attribute model
20
+ #
21
+ # @return [String]
22
+ required :model, String
23
+
24
+ # @!attribute questions
25
+ #
26
+ # @return [Array<OpenAI::Models::DecisionCreateParams::Question::Predicate, OpenAI::Models::DecisionCreateParams::Question::Choice, OpenAI::Models::DecisionCreateParams::Question::Score>]
27
+ required :questions, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::DecisionCreateParams::Question] }
28
+
29
+ # @!attribute safety_identifier
30
+ # Opaque caller-provided end-user identifier, scoped by the verified org. Match
31
+ # Responses' limit; this is never the authenticated user identity.
32
+ #
33
+ # @return [String, nil]
34
+ optional :safety_identifier, String, nil?: true
35
+
36
+ # @!method initialize(input:, model:, questions:, safety_identifier: nil, request_options: {})
37
+ # @param input [String, Array<OpenAI::Models::DecisionInputMessage>]
38
+ # Shared evidence, as a string or an array of user messages containing text and
39
+ # inline images. Non-user roles, function calls, function-call outputs, files,
40
+ # audio, and item references are not supported. At most 128 image parts are
41
+ # allowed across all messages in one request.
42
+ #
43
+ # @param model [String]
44
+ #
45
+ # @param questions [Array<OpenAI::Models::DecisionCreateParams::Question::Predicate, OpenAI::Models::DecisionCreateParams::Question::Choice, OpenAI::Models::DecisionCreateParams::Question::Score>]
46
+ #
47
+ # @param safety_identifier [String, nil]
48
+ # Opaque caller-provided end-user identifier, scoped by the verified org. Match
49
+ # Responses' limit; this is never the authenticated user identity.
50
+ #
51
+ # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
52
+
53
+ # Shared evidence, as a string or an array of user messages containing text and
54
+ # inline images. Non-user roles, function calls, function-call outputs, files,
55
+ # audio, and item references are not supported. At most 128 image parts are
56
+ # allowed across all messages in one request.
57
+ module Input
58
+ extend OpenAI::Internal::Type::Union
59
+
60
+ variant String
61
+
62
+ variant -> { OpenAI::Models::DecisionCreateParams::Input::DecisionInputMessageArray }
63
+
64
+ # @!method self.variants
65
+ # @return [Array(String, Array<OpenAI::Models::DecisionInputMessage>)]
66
+
67
+ # @type [OpenAI::Internal::Type::Converter]
68
+ DecisionInputMessageArray = OpenAI::Internal::Type::ArrayOf[-> { OpenAI::DecisionInputMessage }]
69
+ end
70
+
71
+ # A question about the request's input, with an optional correlation name.
72
+ module Question
73
+ extend OpenAI::Internal::Type::Union
74
+
75
+ discriminator :type
76
+
77
+ variant :predicate, -> { OpenAI::DecisionCreateParams::Question::Predicate }
78
+
79
+ variant :choice, -> { OpenAI::DecisionCreateParams::Question::Choice }
80
+
81
+ variant :score, -> { OpenAI::DecisionCreateParams::Question::Score }
82
+
83
+ class Predicate < OpenAI::Internal::Type::BaseModel
84
+ # @!attribute instructions
85
+ #
86
+ # @return [String]
87
+ required :instructions, String
88
+
89
+ # @!attribute type
90
+ # The type of the object. Always `predicate`.
91
+ #
92
+ # @return [Symbol, :predicate]
93
+ required :type, const: :predicate
94
+
95
+ # @!attribute name
96
+ #
97
+ # @return [String, nil]
98
+ optional :name, String
99
+
100
+ # @!method initialize(instructions:, name: nil, type: :predicate)
101
+ # @param instructions [String]
102
+ #
103
+ # @param name [String]
104
+ #
105
+ # @param type [Symbol, :predicate]
106
+ # The type of the object. Always `predicate`.
107
+ end
108
+
109
+ class Choice < OpenAI::Internal::Type::BaseModel
110
+ # @!attribute choices
111
+ #
112
+ # @return [Array<OpenAI::Models::DecisionCreateParams::Question::Choice::Choice>]
113
+ required(
114
+ :choices,
115
+ -> { OpenAI::Internal::Type::ArrayOf[OpenAI::DecisionCreateParams::Question::Choice::Choice] }
116
+ )
117
+
118
+ # @!attribute instructions
119
+ #
120
+ # @return [String]
121
+ required :instructions, String
122
+
123
+ # @!attribute type
124
+ # The type of the object. Always `choice`.
125
+ #
126
+ # @return [Symbol, :choice]
127
+ required :type, const: :choice
128
+
129
+ # @!attribute name
130
+ #
131
+ # @return [String, nil]
132
+ optional :name, String
133
+
134
+ # @!method initialize(choices:, instructions:, name: nil, type: :choice)
135
+ # @param choices [Array<OpenAI::Models::DecisionCreateParams::Question::Choice::Choice>]
136
+ #
137
+ # @param instructions [String]
138
+ #
139
+ # @param name [String]
140
+ #
141
+ # @param type [Symbol, :choice]
142
+ # The type of the object. Always `choice`.
143
+ class Choice < OpenAI::Internal::Type::BaseModel
144
+ # @!attribute value
145
+ # Choice values are typed: a string and a boolean with the same text are distinct.
146
+ #
147
+ # @return [String, Boolean]
148
+ required :value, union: -> { OpenAI::DecisionCreateParams::Question::Choice::Choice::Value }
149
+
150
+ # @!attribute description
151
+ #
152
+ # @return [String, nil]
153
+ optional :description, String
154
+
155
+ # @!method initialize(value:, description: nil)
156
+ # @param value [String, Boolean]
157
+ # Choice values are typed: a string and a boolean with the same text are distinct.
158
+ #
159
+ # @param description [String]
160
+
161
+ # Choice values are typed: a string and a boolean with the same text are distinct.
162
+ #
163
+ # @see OpenAI::Models::DecisionCreateParams::Question::Choice::Choice#value
164
+ module Value
165
+ extend OpenAI::Internal::Type::Union
166
+
167
+ variant String
168
+
169
+ variant OpenAI::Internal::Type::Boolean
170
+
171
+ # @!method self.variants
172
+ # @return [Array(String, Boolean)]
173
+ end
174
+ end
175
+ end
176
+
177
+ class Score < OpenAI::Internal::Type::BaseModel
178
+ # @!attribute instructions
179
+ #
180
+ # @return [String]
181
+ required :instructions, String
182
+
183
+ # @!attribute levels
184
+ #
185
+ # @return [Array<OpenAI::Models::DecisionCreateParams::Question::Score::Level>]
186
+ required(
187
+ :levels,
188
+ -> { OpenAI::Internal::Type::ArrayOf[OpenAI::DecisionCreateParams::Question::Score::Level] }
189
+ )
190
+
191
+ # @!attribute type
192
+ # The type of the object. Always `score`.
193
+ #
194
+ # @return [Symbol, :score]
195
+ required :type, const: :score
196
+
197
+ # @!attribute name
198
+ #
199
+ # @return [String, nil]
200
+ optional :name, String
201
+
202
+ # @!method initialize(instructions:, levels:, name: nil, type: :score)
203
+ # @param instructions [String]
204
+ #
205
+ # @param levels [Array<OpenAI::Models::DecisionCreateParams::Question::Score::Level>]
206
+ #
207
+ # @param name [String]
208
+ #
209
+ # @param type [Symbol, :score]
210
+ # The type of the object. Always `score`.
211
+ class Level < OpenAI::Internal::Type::BaseModel
212
+ # @!attribute label
213
+ #
214
+ # @return [String]
215
+ required :label, String
216
+
217
+ # @!attribute description
218
+ #
219
+ # @return [String, nil]
220
+ optional :description, String
221
+
222
+ # @!method initialize(label:, description: nil)
223
+ # @param label [String]
224
+ # @param description [String]
225
+ end
226
+ end
227
+
228
+ # @!method self.variants
229
+ # @return [Array(OpenAI::Models::DecisionCreateParams::Question::Predicate, OpenAI::Models::DecisionCreateParams::Question::Choice, OpenAI::Models::DecisionCreateParams::Question::Score)]
230
+ end
231
+ end
232
+ end
233
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ class DecisionInputImage < OpenAI::Internal::Type::BaseModel
6
+ # @!attribute image_url
7
+ # A base64-encoded image in a data URL.
8
+ #
9
+ # @return [String]
10
+ required :image_url, String
11
+
12
+ # @!attribute type
13
+ #
14
+ # @return [Symbol, :input_image]
15
+ required :type, const: :input_image
16
+
17
+ # @!attribute detail
18
+ # The image detail level, using the selected model's image profile. Defaults to
19
+ # auto.
20
+ #
21
+ # @return [Symbol, OpenAI::Models::DecisionInputImage::Detail, nil]
22
+ optional :detail, enum: -> { OpenAI::DecisionInputImage::Detail }, nil?: true
23
+
24
+ # @!method initialize(image_url:, detail: nil, type: :input_image)
25
+ # An inline image. External URLs and file IDs are not supported.
26
+ #
27
+ # @param image_url [String]
28
+ # A base64-encoded image in a data URL.
29
+ #
30
+ # @param detail [Symbol, OpenAI::Models::DecisionInputImage::Detail, nil]
31
+ # The image detail level, using the selected model's image profile. Defaults to
32
+ # auto.
33
+ #
34
+ # @param type [Symbol, :input_image]
35
+
36
+ # The image detail level, using the selected model's image profile. Defaults to
37
+ # auto.
38
+ #
39
+ # @see OpenAI::Models::DecisionInputImage#detail
40
+ module Detail
41
+ extend OpenAI::Internal::Type::Enum
42
+
43
+ LOW = :low
44
+ HIGH = :high
45
+ AUTO = :auto
46
+ ORIGINAL = :original
47
+
48
+ # @!method self.values
49
+ # @return [Array<Symbol>]
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ class DecisionInputMessage < OpenAI::Internal::Type::BaseModel
6
+ # @!attribute content
7
+ # Text evidence or an ordered list of text and inline image parts.
8
+ #
9
+ # @return [String, Array<OpenAI::Models::DecisionInputText, OpenAI::Models::DecisionInputImage>]
10
+ required :content, union: -> { OpenAI::DecisionInputMessage::Content }
11
+
12
+ # @!attribute role
13
+ #
14
+ # @return [Symbol, :user]
15
+ required :role, const: :user
16
+
17
+ # @!attribute type
18
+ #
19
+ # @return [Symbol, OpenAI::Models::DecisionInputMessage::Type, nil]
20
+ optional :type, enum: -> { OpenAI::DecisionInputMessage::Type }
21
+
22
+ # @!method initialize(content:, type: nil, role: :user)
23
+ # A user message containing text or inline images.
24
+ #
25
+ # @param content [String, Array<OpenAI::Models::DecisionInputText, OpenAI::Models::DecisionInputImage>]
26
+ # Text evidence or an ordered list of text and inline image parts.
27
+ #
28
+ # @param type [Symbol, OpenAI::Models::DecisionInputMessage::Type]
29
+ #
30
+ # @param role [Symbol, :user]
31
+
32
+ # Text evidence or an ordered list of text and inline image parts.
33
+ #
34
+ # @see OpenAI::Models::DecisionInputMessage#content
35
+ module Content
36
+ extend OpenAI::Internal::Type::Union
37
+
38
+ variant String
39
+
40
+ variant -> { OpenAI::Models::DecisionInputMessage::Content::DecisionInputPartArray }
41
+
42
+ # @!method self.variants
43
+ # @return [Array(String, Array<OpenAI::Models::DecisionInputText, OpenAI::Models::DecisionInputImage>)]
44
+
45
+ # @type [OpenAI::Internal::Type::Converter]
46
+ DecisionInputPartArray = OpenAI::Internal::Type::ArrayOf[union: -> { OpenAI::DecisionInputPart }]
47
+ end
48
+
49
+ # @see OpenAI::Models::DecisionInputMessage#type
50
+ module Type
51
+ extend OpenAI::Internal::Type::Enum
52
+
53
+ MESSAGE = :message
54
+
55
+ # @!method self.values
56
+ # @return [Array<Symbol>]
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ # An inline image. External URLs and file IDs are not supported.
6
+ module DecisionInputPart
7
+ extend OpenAI::Internal::Type::Union
8
+
9
+ discriminator :type
10
+
11
+ variant :input_text, -> { OpenAI::DecisionInputText }
12
+
13
+ # An inline image. External URLs and file IDs are not supported.
14
+ variant :input_image, -> { OpenAI::DecisionInputImage }
15
+
16
+ # @!method self.variants
17
+ # @return [Array(OpenAI::Models::DecisionInputText, OpenAI::Models::DecisionInputImage)]
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ class DecisionInputText < OpenAI::Internal::Type::BaseModel
6
+ # @!attribute text
7
+ #
8
+ # @return [String]
9
+ required :text, String
10
+
11
+ # @!attribute type
12
+ #
13
+ # @return [Symbol, :input_text]
14
+ required :type, const: :input_text
15
+
16
+ # @!method initialize(text:, type: :input_text)
17
+ # @param text [String]
18
+ # @param type [Symbol, :input_text]
19
+ end
20
+ end
21
+ end
@@ -28,8 +28,7 @@ module OpenAI
28
28
  # `cedar`. You may also provide a custom voice object with an `id`, for example
29
29
  # `{ "id": "voice_1234" }`. Voice cannot be changed during the session once the
30
30
  # model has responded with audio at least once. Custom voices must be created from
31
- # audio samples. Voices created from text prompts are supported only in Live. We
32
- # recommend `marin` and `cedar` for best quality.
31
+ # audio samples. We recommend `marin` and `cedar` for best quality.
33
32
  #
34
33
  # @return [String, Symbol, OpenAI::Models::Realtime::RealtimeAudioConfigOutput::Voice::ID, OpenAI::Models::Realtime::RealtimeAudioConfigOutput::Voice, nil]
35
34
  optional :voice, union: -> { OpenAI::Realtime::RealtimeAudioConfigOutput::Voice }
@@ -53,16 +52,14 @@ module OpenAI
53
52
  # `cedar`. You may also provide a custom voice object with an `id`, for example
54
53
  # `{ "id": "voice_1234" }`. Voice cannot be changed during the session once the
55
54
  # model has responded with audio at least once. Custom voices must be created from
56
- # audio samples. Voices created from text prompts are supported only in Live. We
57
- # recommend `marin` and `cedar` for best quality.
55
+ # audio samples. We recommend `marin` and `cedar` for best quality.
58
56
 
59
57
  # The voice the model uses to respond. Supported built-in voices are `alloy`,
60
58
  # `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, `marin`, and
61
59
  # `cedar`. You may also provide a custom voice object with an `id`, for example
62
60
  # `{ "id": "voice_1234" }`. Voice cannot be changed during the session once the
63
61
  # model has responded with audio at least once. Custom voices must be created from
64
- # audio samples. Voices created from text prompts are supported only in Live. We
65
- # recommend `marin` and `cedar` for best quality.
62
+ # audio samples. We recommend `marin` and `cedar` for best quality.
66
63
  #
67
64
  # @see OpenAI::Models::Realtime::RealtimeAudioConfigOutput#voice
68
65
  module Voice
@@ -28,8 +28,7 @@ module OpenAI
28
28
  # `cedar`. You may also provide a custom voice object with an `id`, for example
29
29
  # `{ "id": "voice_1234" }`. Voice cannot be changed during the session once the
30
30
  # model has responded with audio at least once. Custom voices must be created from
31
- # audio samples. Voices created from text prompts are supported only in Live. We
32
- # recommend `marin` and `cedar` for best quality.
31
+ # audio samples. We recommend `marin` and `cedar` for best quality.
33
32
  #
34
33
  # @return [String, Symbol, OpenAI::Models::Realtime::RealtimeResponseCreateAudioOutput::Output::Voice::ID, OpenAI::Models::Realtime::RealtimeResponseCreateAudioOutput::Output::Voice, nil]
35
34
  optional :voice, union: -> { OpenAI::Realtime::RealtimeResponseCreateAudioOutput::Output::Voice }
@@ -44,16 +43,14 @@ module OpenAI
44
43
  # `cedar`. You may also provide a custom voice object with an `id`, for example
45
44
  # `{ "id": "voice_1234" }`. Voice cannot be changed during the session once the
46
45
  # model has responded with audio at least once. Custom voices must be created from
47
- # audio samples. Voices created from text prompts are supported only in Live. We
48
- # recommend `marin` and `cedar` for best quality.
46
+ # audio samples. We recommend `marin` and `cedar` for best quality.
49
47
 
50
48
  # The voice the model uses to respond. Supported built-in voices are `alloy`,
51
49
  # `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, `marin`, and
52
50
  # `cedar`. You may also provide a custom voice object with an `id`, for example
53
51
  # `{ "id": "voice_1234" }`. Voice cannot be changed during the session once the
54
52
  # model has responded with audio at least once. Custom voices must be created from
55
- # audio samples. Voices created from text prompts are supported only in Live. We
56
- # recommend `marin` and `cedar` for best quality.
53
+ # audio samples. We recommend `marin` and `cedar` for best quality.
57
54
  #
58
55
  # @see OpenAI::Models::Realtime::RealtimeResponseCreateAudioOutput::Output#voice
59
56
  module Voice