openai 0.57.0 → 0.58.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 (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -0
  3. data/README.md +98 -1
  4. data/lib/openai/auth/subject_token_provider.rb +15 -0
  5. data/lib/openai/auth/subject_token_providers/azure_managed_identity_token_provider.rb +88 -0
  6. data/lib/openai/auth/subject_token_providers/gcp_id_token_provider.rb +66 -0
  7. data/lib/openai/auth/subject_token_providers/k8s_service_account_token_provider.rb +37 -0
  8. data/lib/openai/auth/token_type.rb +10 -0
  9. data/lib/openai/auth/workload_identity.rb +23 -0
  10. data/lib/openai/auth/workload_identity_auth.rb +176 -0
  11. data/lib/openai/client.rb +59 -4
  12. data/lib/openai/errors.rb +39 -0
  13. data/lib/openai/internal/util.rb +22 -7
  14. data/lib/openai/models/conversations/message.rb +28 -1
  15. data/lib/openai/models/oauth_error_code.rb +29 -0
  16. data/lib/openai/models/realtime/realtime_session_create_request.rb +4 -3
  17. data/lib/openai/models/realtime/realtime_session_create_response.rb +7 -5
  18. data/lib/openai/models/realtime/realtime_tracing_config.rb +3 -2
  19. data/lib/openai/models/vector_stores/file_batch_create_params.rb +9 -5
  20. data/lib/openai/models/vector_stores/file_create_params.rb +3 -1
  21. data/lib/openai/models.rb +2 -0
  22. data/lib/openai/resources/realtime/calls.rb +1 -1
  23. data/lib/openai/version.rb +1 -1
  24. data/lib/openai.rb +8 -0
  25. data/rbi/openai/auth.rbi +55 -0
  26. data/rbi/openai/internal/util.rbi +8 -0
  27. data/rbi/openai/models/conversations/message.rbi +53 -1
  28. data/rbi/openai/models/oauth_error_code.rbi +24 -0
  29. data/rbi/openai/models/realtime/realtime_session_create_request.rbi +6 -4
  30. data/rbi/openai/models/realtime/realtime_session_create_response.rbi +9 -6
  31. data/rbi/openai/models/realtime/realtime_tracing_config.rbi +3 -2
  32. data/rbi/openai/models/vector_stores/file_batch_create_params.rbi +18 -10
  33. data/rbi/openai/models/vector_stores/file_create_params.rbi +6 -2
  34. data/rbi/openai/models.rbi +2 -0
  35. data/rbi/openai/resources/realtime/calls.rbi +3 -2
  36. data/rbi/openai/resources/vector_stores/file_batches.rbi +6 -4
  37. data/rbi/openai/resources/vector_stores/files.rbi +3 -1
  38. data/sig/openai/internal/util.rbs +4 -0
  39. data/sig/openai/models/conversations/message.rbs +18 -2
  40. data/sig/openai/models/oauth_error_code.rbs +14 -0
  41. data/sig/openai/models.rbs +2 -0
  42. metadata +13 -2
@@ -63,8 +63,9 @@ module OpenAI
63
63
  # A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
64
64
  # the vector store should use. Useful for tools like `file_search` that can access
65
65
  # files. If `attributes` or `chunking_strategy` are provided, they will be applied
66
- # to all files in the batch. The maximum batch size is 2000 files. Mutually
67
- # exclusive with `files`.
66
+ # to all files in the batch. The maximum batch size is 2000 files. This endpoint
67
+ # is recommended for multi-file ingestion and helps reduce per-vector-store write
68
+ # request pressure. Mutually exclusive with `files`.
68
69
  sig { returns(T.nilable(T::Array[String])) }
69
70
  attr_reader :file_ids
70
71
 
@@ -74,8 +75,9 @@ module OpenAI
74
75
  # A list of objects that each include a `file_id` plus optional `attributes` or
75
76
  # `chunking_strategy`. Use this when you need to override metadata for specific
76
77
  # files. The global `attributes` or `chunking_strategy` will be ignored and must
77
- # be specified for each file. The maximum batch size is 2000 files. Mutually
78
- # exclusive with `file_ids`.
78
+ # be specified for each file. The maximum batch size is 2000 files. This endpoint
79
+ # is recommended for multi-file ingestion and helps reduce per-vector-store write
80
+ # request pressure. Mutually exclusive with `file_ids`.
79
81
  sig do
80
82
  returns(
81
83
  T.nilable(
@@ -132,14 +134,16 @@ module OpenAI
132
134
  # A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
133
135
  # the vector store should use. Useful for tools like `file_search` that can access
134
136
  # files. If `attributes` or `chunking_strategy` are provided, they will be applied
135
- # to all files in the batch. The maximum batch size is 2000 files. Mutually
136
- # exclusive with `files`.
137
+ # to all files in the batch. The maximum batch size is 2000 files. This endpoint
138
+ # is recommended for multi-file ingestion and helps reduce per-vector-store write
139
+ # request pressure. Mutually exclusive with `files`.
137
140
  file_ids: nil,
138
141
  # A list of objects that each include a `file_id` plus optional `attributes` or
139
142
  # `chunking_strategy`. Use this when you need to override metadata for specific
140
143
  # files. The global `attributes` or `chunking_strategy` will be ignored and must
141
- # be specified for each file. The maximum batch size is 2000 files. Mutually
142
- # exclusive with `file_ids`.
144
+ # be specified for each file. The maximum batch size is 2000 files. This endpoint
145
+ # is recommended for multi-file ingestion and helps reduce per-vector-store write
146
+ # request pressure. Mutually exclusive with `file_ids`.
143
147
  files: nil,
144
148
  request_options: {}
145
149
  )
@@ -198,7 +202,9 @@ module OpenAI
198
202
 
199
203
  # A [File](https://platform.openai.com/docs/api-reference/files) ID that the
200
204
  # vector store should use. Useful for tools like `file_search` that can access
201
- # files.
205
+ # files. For multi-file ingestion, we recommend
206
+ # [`file_batches`](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/createBatch)
207
+ # to minimize per-vector-store write requests.
202
208
  sig { returns(String) }
203
209
  attr_accessor :file_id
204
210
 
@@ -264,7 +270,9 @@ module OpenAI
264
270
  def self.new(
265
271
  # A [File](https://platform.openai.com/docs/api-reference/files) ID that the
266
272
  # vector store should use. Useful for tools like `file_search` that can access
267
- # files.
273
+ # files. For multi-file ingestion, we recommend
274
+ # [`file_batches`](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/createBatch)
275
+ # to minimize per-vector-store write requests.
268
276
  file_id:,
269
277
  # Set of 16 key-value pairs that can be attached to an object. This can be useful
270
278
  # for storing additional information about the object in a structured format, and
@@ -20,7 +20,9 @@ module OpenAI
20
20
 
21
21
  # A [File](https://platform.openai.com/docs/api-reference/files) ID that the
22
22
  # vector store should use. Useful for tools like `file_search` that can access
23
- # files.
23
+ # files. For multi-file ingestion, we recommend
24
+ # [`file_batches`](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/createBatch)
25
+ # to minimize per-vector-store write requests.
24
26
  sig { returns(String) }
25
27
  attr_accessor :file_id
26
28
 
@@ -89,7 +91,9 @@ module OpenAI
89
91
  vector_store_id:,
90
92
  # A [File](https://platform.openai.com/docs/api-reference/files) ID that the
91
93
  # vector store should use. Useful for tools like `file_search` that can access
92
- # files.
94
+ # files. For multi-file ingestion, we recommend
95
+ # [`file_batches`](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/createBatch)
96
+ # to minimize per-vector-store write requests.
93
97
  file_id:,
94
98
  # Set of 16 key-value pairs that can be attached to an object. This can be useful
95
99
  # for storing additional information about the object in a structured format, and
@@ -169,6 +169,8 @@ module OpenAI
169
169
 
170
170
  ModerationTextInput = OpenAI::Models::ModerationTextInput
171
171
 
172
+ OAuthErrorCode = OpenAI::Models::OAuthErrorCode
173
+
172
174
  OtherFileChunkingStrategyObject =
173
175
  OpenAI::Models::OtherFileChunkingStrategyObject
174
176
 
@@ -99,8 +99,9 @@ module OpenAI
99
99
  # Tools available to the model.
100
100
  tools: nil,
101
101
  # Realtime API can write session traces to the
102
- # [Traces Dashboard](/logs?api=traces). Set to null to disable tracing. Once
103
- # tracing is enabled for a session, the configuration cannot be modified.
102
+ # [Traces Dashboard](https://platform.openai.com/logs?api=traces). Set to null to
103
+ # disable tracing. Once tracing is enabled for a session, the configuration cannot
104
+ # be modified.
104
105
  #
105
106
  # `auto` will create a trace for the session with default values for the workflow
106
107
  # name, group id, and metadata.
@@ -43,14 +43,16 @@ module OpenAI
43
43
  # A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
44
44
  # the vector store should use. Useful for tools like `file_search` that can access
45
45
  # files. If `attributes` or `chunking_strategy` are provided, they will be applied
46
- # to all files in the batch. The maximum batch size is 2000 files. Mutually
47
- # exclusive with `files`.
46
+ # to all files in the batch. The maximum batch size is 2000 files. This endpoint
47
+ # is recommended for multi-file ingestion and helps reduce per-vector-store write
48
+ # request pressure. Mutually exclusive with `files`.
48
49
  file_ids: nil,
49
50
  # A list of objects that each include a `file_id` plus optional `attributes` or
50
51
  # `chunking_strategy`. Use this when you need to override metadata for specific
51
52
  # files. The global `attributes` or `chunking_strategy` will be ignored and must
52
- # be specified for each file. The maximum batch size is 2000 files. Mutually
53
- # exclusive with `file_ids`.
53
+ # be specified for each file. The maximum batch size is 2000 files. This endpoint
54
+ # is recommended for multi-file ingestion and helps reduce per-vector-store write
55
+ # request pressure. Mutually exclusive with `file_ids`.
54
56
  files: nil,
55
57
  request_options: {}
56
58
  )
@@ -31,7 +31,9 @@ module OpenAI
31
31
  vector_store_id,
32
32
  # A [File](https://platform.openai.com/docs/api-reference/files) ID that the
33
33
  # vector store should use. Useful for tools like `file_search` that can access
34
- # files.
34
+ # files. For multi-file ingestion, we recommend
35
+ # [`file_batches`](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/createBatch)
36
+ # to minimize per-vector-store write requests.
35
37
  file_id:,
36
38
  # Set of 16 key-value pairs that can be attached to an object. This can be useful
37
39
  # for storing additional information about the object in a structured format, and
@@ -45,8 +45,12 @@ module OpenAI
45
45
  -> top?
46
46
  } -> top?
47
47
 
48
+ RFC_3986_NOT_PCHARS: Regexp
49
+
48
50
  def self?.uri_origin: (URI::Generic uri) -> String
49
51
 
52
+ def self?.encode_path: (String | Integer path) -> String
53
+
50
54
  def self?.interpolate_path: (String | ::Array[String] path) -> String
51
55
 
52
56
  def self?.decode_query: (String? query) -> ::Hash[String, ::Array[String]]
@@ -7,7 +7,8 @@ module OpenAI
7
7
  content: ::Array[OpenAI::Models::Conversations::Message::content],
8
8
  role: OpenAI::Models::Conversations::Message::role,
9
9
  status: OpenAI::Models::Conversations::Message::status,
10
- type: :message
10
+ type: :message,
11
+ phase: OpenAI::Models::Conversations::Message::phase?
11
12
  }
12
13
 
13
14
  class Message < OpenAI::Internal::Type::BaseModel
@@ -21,11 +22,14 @@ module OpenAI
21
22
 
22
23
  attr_accessor type: :message
23
24
 
25
+ attr_accessor phase: OpenAI::Models::Conversations::Message::phase?
26
+
24
27
  def initialize: (
25
28
  id: String,
26
29
  content: ::Array[OpenAI::Models::Conversations::Message::content],
27
30
  role: OpenAI::Models::Conversations::Message::role,
28
31
  status: OpenAI::Models::Conversations::Message::status,
32
+ ?phase: OpenAI::Models::Conversations::Message::phase?,
29
33
  ?type: :message
30
34
  ) -> void
31
35
 
@@ -34,7 +38,8 @@ module OpenAI
34
38
  content: ::Array[OpenAI::Models::Conversations::Message::content],
35
39
  role: OpenAI::Models::Conversations::Message::role,
36
40
  status: OpenAI::Models::Conversations::Message::status,
37
- type: :message
41
+ type: :message,
42
+ phase: OpenAI::Models::Conversations::Message::phase?
38
43
  }
39
44
 
40
45
  type content =
@@ -102,6 +107,17 @@ module OpenAI
102
107
 
103
108
  def self?.values: -> ::Array[OpenAI::Models::Conversations::Message::status]
104
109
  end
110
+
111
+ type phase = :commentary | :final_answer
112
+
113
+ module Phase
114
+ extend OpenAI::Internal::Type::Enum
115
+
116
+ COMMENTARY: :commentary
117
+ FINAL_ANSWER: :final_answer
118
+
119
+ def self?.values: -> ::Array[OpenAI::Models::Conversations::Message::phase]
120
+ end
105
121
  end
106
122
  end
107
123
  end
@@ -0,0 +1,14 @@
1
+ module OpenAI
2
+ module Models
3
+ type oauth_error_code = :invalid_grant | :invalid_subject_token | String
4
+
5
+ module OAuthErrorCode
6
+ extend OpenAI::Internal::Type::Union
7
+
8
+ def self?.variants: -> ::Array[OpenAI::Models::oauth_error_code]
9
+
10
+ INVALID_GRANT: :invalid_grant
11
+ INVALID_SUBJECT_TOKEN: :invalid_subject_token
12
+ end
13
+ end
14
+ end
@@ -165,6 +165,8 @@ module OpenAI
165
165
 
166
166
  class ModerationTextInput = OpenAI::Models::ModerationTextInput
167
167
 
168
+ module OAuthErrorCode = OpenAI::Models::OAuthErrorCode
169
+
168
170
  class OtherFileChunkingStrategyObject = OpenAI::Models::OtherFileChunkingStrategyObject
169
171
 
170
172
  module Realtime = OpenAI::Models::Realtime
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.57.0
4
+ version: 0.58.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenAI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-25 00:00:00.000000000 Z
11
+ date: 2026-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -64,6 +64,13 @@ files:
64
64
  - README.md
65
65
  - SECURITY.md
66
66
  - lib/openai.rb
67
+ - lib/openai/auth/subject_token_provider.rb
68
+ - lib/openai/auth/subject_token_providers/azure_managed_identity_token_provider.rb
69
+ - lib/openai/auth/subject_token_providers/gcp_id_token_provider.rb
70
+ - lib/openai/auth/subject_token_providers/k8s_service_account_token_provider.rb
71
+ - lib/openai/auth/token_type.rb
72
+ - lib/openai/auth/workload_identity.rb
73
+ - lib/openai/auth/workload_identity_auth.rb
67
74
  - lib/openai/client.rb
68
75
  - lib/openai/errors.rb
69
76
  - lib/openai/file_part.rb
@@ -450,6 +457,7 @@ files:
450
457
  - lib/openai/models/moderation_model.rb
451
458
  - lib/openai/models/moderation_multi_modal_input.rb
452
459
  - lib/openai/models/moderation_text_input.rb
460
+ - lib/openai/models/oauth_error_code.rb
453
461
  - lib/openai/models/other_file_chunking_strategy_object.rb
454
462
  - lib/openai/models/realtime/audio_transcription.rb
455
463
  - lib/openai/models/realtime/call_accept_params.rb
@@ -872,6 +880,7 @@ files:
872
880
  - lib/openai/structured_output.rb
873
881
  - lib/openai/version.rb
874
882
  - manifest.yaml
883
+ - rbi/openai/auth.rbi
875
884
  - rbi/openai/client.rbi
876
885
  - rbi/openai/errors.rbi
877
886
  - rbi/openai/file_part.rbi
@@ -1253,6 +1262,7 @@ files:
1253
1262
  - rbi/openai/models/moderation_model.rbi
1254
1263
  - rbi/openai/models/moderation_multi_modal_input.rbi
1255
1264
  - rbi/openai/models/moderation_text_input.rbi
1265
+ - rbi/openai/models/oauth_error_code.rbi
1256
1266
  - rbi/openai/models/other_file_chunking_strategy_object.rbi
1257
1267
  - rbi/openai/models/realtime/audio_transcription.rbi
1258
1268
  - rbi/openai/models/realtime/call_accept_params.rbi
@@ -2046,6 +2056,7 @@ files:
2046
2056
  - sig/openai/models/moderation_model.rbs
2047
2057
  - sig/openai/models/moderation_multi_modal_input.rbs
2048
2058
  - sig/openai/models/moderation_text_input.rbs
2059
+ - sig/openai/models/oauth_error_code.rbs
2049
2060
  - sig/openai/models/other_file_chunking_strategy_object.rbs
2050
2061
  - sig/openai/models/realtime/audio_transcription.rbs
2051
2062
  - sig/openai/models/realtime/call_accept_params.rbs