openai 0.127.0 → 0.128.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 (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/README.md +1 -1
  4. data/lib/openai/helpers/agents/session_stream.rb +8 -3
  5. data/lib/openai/helpers/beta/agents/result.rb +12 -4
  6. data/lib/openai/models/beta/agent_session.rb +1 -43
  7. data/lib/openai/models/beta/agent_session_event.rb +1 -4
  8. data/lib/openai/models/beta/agents/session_create_params.rb +1 -33
  9. data/lib/openai/models/beta/agents/session_update_params.rb +1 -33
  10. data/lib/openai/models/beta/session_turn_error.rb +0 -3
  11. data/lib/openai/models/csam_moderation.rb +131 -0
  12. data/lib/openai/models/csam_moderation_response.rb +27 -0
  13. data/lib/openai/models/live/mcp_require_approval_filter.rb +28 -0
  14. data/lib/openai/models/live/mcp_tool.rb +181 -0
  15. data/lib/openai/models/live/mcp_tool_filter.rb +28 -0
  16. data/lib/openai/models/live/responses_delegation_config.rb +7 -14
  17. data/lib/openai/models/live/responses_delegation_update_config.rb +7 -14
  18. data/lib/openai/models.rb +4 -0
  19. data/lib/openai/resources/beta/agents/sessions/events.rb +1 -1
  20. data/lib/openai/resources/beta/agents/sessions.rb +3 -15
  21. data/lib/openai/version.rb +1 -1
  22. data/lib/openai.rb +5 -1
  23. data/rbi/openai/models/beta/agent_session.rbi +1 -70
  24. data/rbi/openai/models/beta/agent_session_event.rbi +0 -1
  25. data/rbi/openai/models/beta/agents/session_create_params.rbi +0 -56
  26. data/rbi/openai/models/beta/agents/session_update_params.rbi +0 -56
  27. data/rbi/openai/models/beta/session_turn_error.rbi +0 -3
  28. data/rbi/openai/models/csam_moderation.rbi +248 -0
  29. data/rbi/openai/models/csam_moderation_response.rbi +56 -0
  30. data/rbi/openai/models/live/mcp_require_approval_filter.rbi +64 -0
  31. data/rbi/openai/models/live/mcp_tool.rbi +253 -0
  32. data/rbi/openai/models/live/mcp_tool_filter.rbi +58 -0
  33. data/rbi/openai/models/live/responses_delegation_config.rbi +7 -39
  34. data/rbi/openai/models/live/responses_delegation_update_config.rbi +7 -39
  35. data/rbi/openai/models.rbi +4 -0
  36. data/rbi/openai/resources/beta/agents/sessions.rbi +0 -12
  37. data/sig/openai/models/beta/agent_session.rbs +3 -44
  38. data/sig/openai/models/beta/agent_session_event.rbs +0 -1
  39. data/sig/openai/models/beta/agents/session_create_params.rbs +0 -23
  40. data/sig/openai/models/beta/agents/session_update_params.rbs +0 -23
  41. data/sig/openai/models/beta/session_turn_error.rbs +0 -4
  42. data/sig/openai/models/csam_moderation.rbs +113 -0
  43. data/sig/openai/models/csam_moderation_response.rbs +30 -0
  44. data/sig/openai/models/live/mcp_require_approval_filter.rbs +33 -0
  45. data/sig/openai/models/live/mcp_tool.rbs +159 -0
  46. data/sig/openai/models/live/mcp_tool_filter.rbs +27 -0
  47. data/sig/openai/models/live/responses_delegation_config.rbs +5 -11
  48. data/sig/openai/models/live/responses_delegation_update_config.rbs +5 -11
  49. data/sig/openai/models.rbs +4 -0
  50. data/sig/openai/resources/beta/agents/sessions.rbs +0 -3
  51. metadata +16 -4
  52. data/lib/openai/models/beta/agent_session_budget_reached_event.rb +0 -48
  53. data/rbi/openai/models/beta/agent_session_budget_reached_event.rbi +0 -83
  54. data/sig/openai/models/beta/agent_session_budget_reached_event.rbs +0 -52
@@ -79,16 +79,6 @@ module OpenAI
79
79
  sig { params(review: OpenAI::Beta::Agents::SessionCreateParams::Review::OrSymbol).void }
80
80
  attr_writer :review
81
81
 
82
- # Optional spending limit in USD cents. Omission or null creates an unlimited
83
- # session.
84
- sig { returns(T.nilable(OpenAI::Beta::Agents::SessionCreateParams::SpendControl)) }
85
- attr_reader :spend_control
86
-
87
- sig {
88
- params(spend_control: T.nilable(OpenAI::Beta::Agents::SessionCreateParams::SpendControl::OrHash)).void
89
- }
90
- attr_writer :spend_control
91
-
92
82
  # Options for the event stream. Only allowed when `stream` is `true`.
93
83
  sig { returns(T.nilable(OpenAI::Beta::Agents::SessionCreateParams::StreamOptions)) }
94
84
  attr_reader :stream_options
@@ -121,8 +111,6 @@ module OpenAI
121
111
 
122
112
  review: OpenAI::Beta::Agents::SessionCreateParams::Review::OrSymbol,
123
113
 
124
- spend_control: T.nilable(OpenAI::Beta::Agents::SessionCreateParams::SpendControl::OrHash),
125
-
126
114
  stream_options: OpenAI::Beta::Agents::SessionCreateParams::StreamOptions::OrHash,
127
115
 
128
116
  vault_ids: T.nilable(T::Array[String]),
@@ -161,10 +149,6 @@ module OpenAI
161
149
  # Action review mode. Omit to use none.
162
150
  review: nil,
163
151
 
164
- # Optional spending limit in USD cents. Omission or null creates an unlimited
165
- # session.
166
- spend_control: nil,
167
-
168
152
  # Options for the event stream. Only allowed when `stream` is `true`.
169
153
  stream_options: nil,
170
154
 
@@ -189,7 +173,6 @@ module OpenAI
189
173
  metadata: T.nilable(T::Hash[Symbol, String]),
190
174
  prompt_cache_options: T.nilable(OpenAI::Beta::Agents::SessionCreateParams::PromptCacheOptions),
191
175
  review: OpenAI::Beta::Agents::SessionCreateParams::Review::OrSymbol,
192
- spend_control: T.nilable(OpenAI::Beta::Agents::SessionCreateParams::SpendControl),
193
176
  stream_options: OpenAI::Beta::Agents::SessionCreateParams::StreamOptions,
194
177
  vault_ids: T.nilable(T::Array[String]),
195
178
  request_options: OpenAI::RequestOptions
@@ -612,45 +595,6 @@ module OpenAI
612
595
  end
613
596
  end
614
597
 
615
- class SpendControl < OpenAI::Internal::Type::BaseModel
616
- OrHash = T.type_alias do
617
- T.any(
618
- OpenAI::Beta::Agents::SessionCreateParams::SpendControl,
619
- OpenAI::Internal::AnyHash
620
- )
621
- end
622
-
623
- # Positive USD cents, or null to remove the limit.
624
- sig { returns(T.nilable(Integer)) }
625
- attr_accessor :limit
626
-
627
- # Optional spending limit in USD cents. Omission or null creates an unlimited
628
- # session.
629
- sig do
630
- params(
631
-
632
- limit: T.nilable(Integer)
633
- )
634
- .returns(T.attached_class)
635
- end
636
- def self.new(
637
-
638
- # Positive USD cents, or null to remove the limit.
639
-
640
- limit:
641
- )
642
- end
643
-
644
- sig do
645
- override.returns(
646
- {limit: T.nilable(Integer)}
647
- )
648
- end
649
- def to_hash
650
- end
651
-
652
- end
653
-
654
598
  class StreamOptions < OpenAI::Internal::Type::BaseModel
655
599
  OrHash = T.type_alias do
656
600
  T.any(
@@ -56,16 +56,6 @@ module OpenAI
56
56
  sig { params(review: OpenAI::Beta::Agents::SessionUpdateParams::Review::OrSymbol).void }
57
57
  attr_writer :review
58
58
 
59
- # Omit to retain the limit; null or a null limit removes it without resetting
60
- # spend.
61
- sig { returns(T.nilable(OpenAI::Beta::Agents::SessionUpdateParams::SpendControl)) }
62
- attr_reader :spend_control
63
-
64
- sig {
65
- params(spend_control: T.nilable(OpenAI::Beta::Agents::SessionUpdateParams::SpendControl::OrHash)).void
66
- }
67
- attr_writer :spend_control
68
-
69
59
  sig do
70
60
  params(
71
61
 
@@ -79,8 +69,6 @@ module OpenAI
79
69
 
80
70
  review: OpenAI::Beta::Agents::SessionUpdateParams::Review::OrSymbol,
81
71
 
82
- spend_control: T.nilable(OpenAI::Beta::Agents::SessionUpdateParams::SpendControl::OrHash),
83
-
84
72
  request_options: OpenAI::RequestOptions::OrHash
85
73
  )
86
74
  .returns(T.attached_class)
@@ -105,10 +93,6 @@ module OpenAI
105
93
  # keep their review mode.
106
94
  review: nil,
107
95
 
108
- # Omit to retain the limit; null or a null limit removes it without resetting
109
- # spend.
110
- spend_control: nil,
111
-
112
96
  request_options: {}
113
97
  )
114
98
  end
@@ -121,7 +105,6 @@ module OpenAI
121
105
  metadata: T.nilable(T::Hash[Symbol, String]),
122
106
  prompt_cache_options: T.nilable(OpenAI::Beta::Agents::SessionUpdateParams::PromptCacheOptions),
123
107
  review: OpenAI::Beta::Agents::SessionUpdateParams::Review::OrSymbol,
124
- spend_control: T.nilable(OpenAI::Beta::Agents::SessionUpdateParams::SpendControl),
125
108
  request_options: OpenAI::RequestOptions
126
109
  }
127
110
  )
@@ -432,45 +415,6 @@ module OpenAI
432
415
  end
433
416
  end
434
417
 
435
- class SpendControl < OpenAI::Internal::Type::BaseModel
436
- OrHash = T.type_alias do
437
- T.any(
438
- OpenAI::Beta::Agents::SessionUpdateParams::SpendControl,
439
- OpenAI::Internal::AnyHash
440
- )
441
- end
442
-
443
- # Positive USD cents, or null to remove the limit.
444
- sig { returns(T.nilable(Integer)) }
445
- attr_accessor :limit
446
-
447
- # Omit to retain the limit; null or a null limit removes it without resetting
448
- # spend.
449
- sig do
450
- params(
451
-
452
- limit: T.nilable(Integer)
453
- )
454
- .returns(T.attached_class)
455
- end
456
- def self.new(
457
-
458
- # Positive USD cents, or null to remove the limit.
459
-
460
- limit:
461
- )
462
- end
463
-
464
- sig do
465
- override.returns(
466
- {limit: T.nilable(Integer)}
467
- )
468
- end
469
- def to_hash
470
- end
471
-
472
- end
473
-
474
418
  end
475
419
 
476
420
  end
@@ -64,9 +64,6 @@ module OpenAI
64
64
  # The model reached its output token limit before finishing the response.
65
65
  MAX_OUTPUT_TOKENS = T.let(:max_output_tokens, OpenAI::Beta::SessionTurnError::Code::TaggedSymbol)
66
66
 
67
- # The session has reached its usage budget.
68
- SESSION_BUDGET_EXCEEDED = T.let(:session_budget_exceeded, OpenAI::Beta::SessionTurnError::Code::TaggedSymbol)
69
-
70
67
  # The organization has reached a usage, plan, or billing limit.
71
68
  USAGE_LIMIT_EXCEEDED = T.let(:usage_limit_exceeded, OpenAI::Beta::SessionTurnError::Code::TaggedSymbol)
72
69
 
@@ -0,0 +1,248 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+
6
+ class CsamModeration < OpenAI::Internal::Type::BaseModel
7
+
8
+ OrHash = T.type_alias do
9
+ T.any(
10
+ OpenAI::CsamModeration,
11
+ OpenAI::Internal::AnyHash
12
+ )
13
+ end
14
+
15
+ # Whether the image was flagged in each category.
16
+ sig { returns(OpenAI::CsamModeration::Categories) }
17
+ attr_reader :categories
18
+
19
+ sig { params(categories: OpenAI::CsamModeration::Categories::OrHash).void }
20
+ attr_writer :categories
21
+
22
+ # The input types evaluated for each category.
23
+ sig { returns(OpenAI::CsamModeration::CategoryAppliedInputTypes) }
24
+ attr_reader :category_applied_input_types
25
+
26
+ sig { params(category_applied_input_types: OpenAI::CsamModeration::CategoryAppliedInputTypes::OrHash).void }
27
+ attr_writer :category_applied_input_types
28
+
29
+ # The classifier score for each category.
30
+ sig { returns(OpenAI::CsamModeration::CategoryScores) }
31
+ attr_reader :category_scores
32
+
33
+ sig { params(category_scores: OpenAI::CsamModeration::CategoryScores::OrHash).void }
34
+ attr_writer :category_scores
35
+
36
+ # Whether either CSAM category was flagged.
37
+ sig { returns(T::Boolean) }
38
+ attr_accessor :flagged
39
+
40
+ sig do
41
+ params(
42
+
43
+ categories: OpenAI::CsamModeration::Categories::OrHash,
44
+
45
+ category_applied_input_types: OpenAI::CsamModeration::CategoryAppliedInputTypes::OrHash,
46
+
47
+ category_scores: OpenAI::CsamModeration::CategoryScores::OrHash,
48
+
49
+ flagged: T::Boolean
50
+ )
51
+ .returns(T.attached_class)
52
+ end
53
+ def self.new(
54
+
55
+ # Whether the image was flagged in each category.
56
+ categories:,
57
+
58
+ # The input types evaluated for each category.
59
+ category_applied_input_types:,
60
+
61
+ # The classifier score for each category.
62
+ category_scores:,
63
+
64
+ # Whether either CSAM category was flagged.
65
+
66
+ flagged:
67
+ )
68
+ end
69
+
70
+ sig do
71
+ override.returns(
72
+ {
73
+ categories: OpenAI::CsamModeration::Categories,
74
+ category_applied_input_types: OpenAI::CsamModeration::CategoryAppliedInputTypes,
75
+ category_scores: OpenAI::CsamModeration::CategoryScores,
76
+ flagged: T::Boolean
77
+ }
78
+ )
79
+ end
80
+ def to_hash
81
+ end
82
+
83
+ class Categories < OpenAI::Internal::Type::BaseModel
84
+ OrHash = T.type_alias do
85
+ T.any(
86
+ OpenAI::CsamModeration::Categories,
87
+ OpenAI::Internal::AnyHash
88
+ )
89
+ end
90
+
91
+ sig { returns(T::Boolean) }
92
+ attr_accessor :likely_csam
93
+
94
+ sig { returns(T::Boolean) }
95
+ attr_accessor :likely_csam_gen_ai
96
+
97
+ # Whether the image was flagged in each category.
98
+ sig do
99
+ params(
100
+
101
+ likely_csam: T::Boolean,
102
+
103
+ likely_csam_gen_ai: T::Boolean
104
+ )
105
+ .returns(T.attached_class)
106
+ end
107
+ def self.new(
108
+
109
+ likely_csam:,
110
+
111
+ likely_csam_gen_ai:
112
+ )
113
+ end
114
+
115
+ sig do
116
+ override.returns(
117
+ {likely_csam: T::Boolean, likely_csam_gen_ai: T::Boolean}
118
+ )
119
+ end
120
+ def to_hash
121
+ end
122
+
123
+ end
124
+
125
+ class CategoryAppliedInputTypes < OpenAI::Internal::Type::BaseModel
126
+ OrHash = T.type_alias do
127
+ T.any(
128
+ OpenAI::CsamModeration::CategoryAppliedInputTypes,
129
+ OpenAI::Internal::AnyHash
130
+ )
131
+ end
132
+
133
+ sig { returns(T::Array[OpenAI::CsamModeration::CategoryAppliedInputTypes::LikelyCsam::TaggedSymbol]) }
134
+ attr_accessor :likely_csam
135
+
136
+ sig { returns(T::Array[OpenAI::CsamModeration::CategoryAppliedInputTypes::LikelyCsamGenAi::TaggedSymbol]) }
137
+ attr_accessor :likely_csam_gen_ai
138
+
139
+ # The input types evaluated for each category.
140
+ sig do
141
+ params(
142
+
143
+ likely_csam: T::Array[OpenAI::CsamModeration::CategoryAppliedInputTypes::LikelyCsam::OrSymbol],
144
+
145
+ likely_csam_gen_ai: T::Array[OpenAI::CsamModeration::CategoryAppliedInputTypes::LikelyCsamGenAi::OrSymbol]
146
+ )
147
+ .returns(T.attached_class)
148
+ end
149
+ def self.new(
150
+
151
+ likely_csam:,
152
+
153
+ likely_csam_gen_ai:
154
+ )
155
+ end
156
+
157
+ sig do
158
+ override.returns(
159
+ {
160
+ likely_csam: T::Array[OpenAI::CsamModeration::CategoryAppliedInputTypes::LikelyCsam::TaggedSymbol],
161
+ likely_csam_gen_ai: T::Array[
162
+ OpenAI::CsamModeration::CategoryAppliedInputTypes::LikelyCsamGenAi::TaggedSymbol
163
+ ]
164
+ }
165
+ )
166
+ end
167
+ def to_hash
168
+ end
169
+
170
+ module LikelyCsam
171
+ extend OpenAI::Internal::Type::Enum
172
+
173
+ TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::CsamModeration::CategoryAppliedInputTypes::LikelyCsam) }
174
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
175
+
176
+ IMAGE = T.let(:image, OpenAI::CsamModeration::CategoryAppliedInputTypes::LikelyCsam::TaggedSymbol)
177
+
178
+ sig {
179
+ override.returns(T::Array[OpenAI::CsamModeration::CategoryAppliedInputTypes::LikelyCsam::TaggedSymbol])
180
+ }
181
+ def self.values
182
+ end
183
+ end
184
+
185
+ module LikelyCsamGenAi
186
+ extend OpenAI::Internal::Type::Enum
187
+
188
+ TaggedSymbol = T.type_alias {
189
+ T.all(Symbol, OpenAI::CsamModeration::CategoryAppliedInputTypes::LikelyCsamGenAi)
190
+ }
191
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
192
+
193
+ IMAGE = T.let(:image, OpenAI::CsamModeration::CategoryAppliedInputTypes::LikelyCsamGenAi::TaggedSymbol)
194
+
195
+ sig {
196
+ override.returns(T::Array[OpenAI::CsamModeration::CategoryAppliedInputTypes::LikelyCsamGenAi::TaggedSymbol])
197
+ }
198
+ def self.values
199
+ end
200
+ end
201
+ end
202
+
203
+ class CategoryScores < OpenAI::Internal::Type::BaseModel
204
+ OrHash = T.type_alias do
205
+ T.any(
206
+ OpenAI::CsamModeration::CategoryScores,
207
+ OpenAI::Internal::AnyHash
208
+ )
209
+ end
210
+
211
+ sig { returns(Float) }
212
+ attr_accessor :likely_csam
213
+
214
+ sig { returns(Float) }
215
+ attr_accessor :likely_csam_gen_ai
216
+
217
+ # The classifier score for each category.
218
+ sig do
219
+ params(
220
+
221
+ likely_csam: Float,
222
+
223
+ likely_csam_gen_ai: Float
224
+ )
225
+ .returns(T.attached_class)
226
+ end
227
+ def self.new(
228
+
229
+ likely_csam:,
230
+
231
+ likely_csam_gen_ai:
232
+ )
233
+ end
234
+
235
+ sig do
236
+ override.returns(
237
+ {likely_csam: Float, likely_csam_gen_ai: Float}
238
+ )
239
+ end
240
+ def to_hash
241
+ end
242
+
243
+ end
244
+
245
+ end
246
+
247
+ end
248
+ end
@@ -0,0 +1,56 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+
6
+ class CsamModerationResponse < OpenAI::Internal::Type::BaseModel
7
+
8
+ OrHash = T.type_alias do
9
+ T.any(
10
+ OpenAI::CsamModerationResponse,
11
+ OpenAI::Internal::AnyHash
12
+ )
13
+ end
14
+
15
+ sig { returns(String) }
16
+ attr_accessor :id
17
+
18
+ sig { returns(Symbol) }
19
+ attr_accessor :model
20
+
21
+ sig { returns(T::Array[OpenAI::CsamModeration]) }
22
+ attr_accessor :results
23
+
24
+ sig do
25
+ params(
26
+
27
+ id: String,
28
+
29
+ results: T::Array[OpenAI::CsamModeration::OrHash],
30
+
31
+ model: Symbol
32
+ )
33
+ .returns(T.attached_class)
34
+ end
35
+ def self.new(
36
+
37
+ id:,
38
+
39
+ results:,
40
+
41
+ model: :"omni-moderation-csam-latest"
42
+ )
43
+ end
44
+
45
+ sig do
46
+ override.returns(
47
+ {id: String, model: Symbol, results: T::Array[OpenAI::CsamModeration]}
48
+ )
49
+ end
50
+ def to_hash
51
+ end
52
+
53
+ end
54
+
55
+ end
56
+ end
@@ -0,0 +1,64 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+
6
+ module Live
7
+
8
+ class McpRequireApprovalFilter < OpenAI::Internal::Type::BaseModel
9
+
10
+ OrHash = T.type_alias do
11
+ T.any(
12
+ OpenAI::Live::McpRequireApprovalFilter,
13
+ OpenAI::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ # A filter that forces approval for matching tools.
18
+ sig { returns(T.nilable(OpenAI::Live::McpToolFilter)) }
19
+ attr_reader :always
20
+
21
+ sig { params(always: T.nilable(OpenAI::Live::McpToolFilter::OrHash)).void }
22
+ attr_writer :always
23
+
24
+ # A filter that skips approval for matching tools.
25
+ sig { returns(T.nilable(OpenAI::Live::McpToolFilter)) }
26
+ attr_reader :never
27
+
28
+ sig { params(never: T.nilable(OpenAI::Live::McpToolFilter::OrHash)).void }
29
+ attr_writer :never
30
+
31
+ sig do
32
+ params(
33
+
34
+ always: T.nilable(OpenAI::Live::McpToolFilter::OrHash),
35
+
36
+ never: T.nilable(OpenAI::Live::McpToolFilter::OrHash)
37
+ )
38
+ .returns(T.attached_class)
39
+ end
40
+ def self.new(
41
+
42
+ # A filter that forces approval for matching tools.
43
+ always: nil,
44
+
45
+ # A filter that skips approval for matching tools.
46
+
47
+ never: nil
48
+ )
49
+ end
50
+
51
+ sig do
52
+ override.returns(
53
+ {always: T.nilable(OpenAI::Live::McpToolFilter), never: T.nilable(OpenAI::Live::McpToolFilter)}
54
+ )
55
+ end
56
+ def to_hash
57
+ end
58
+
59
+ end
60
+
61
+ end
62
+
63
+ end
64
+ end