openai 0.82.0 → 0.84.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +47 -0
- data/README.md +1 -1
- data/lib/openai/auth/workload_identity_auth.rb +17 -2
- data/lib/openai/client.rb +20 -6
- data/lib/openai/errors.rb +1 -1
- data/lib/openai/helpers/realtime/client_extension.rb +107 -0
- data/lib/openai/helpers/streaming/chat_completion_stream.rb +1 -2
- data/lib/openai/helpers/streaming/response_events.rb +2 -2
- data/lib/openai/helpers/streaming/response_stream.rb +73 -42
- data/lib/openai/helpers/structured_output/chat_completion_parser.rb +6 -0
- data/lib/openai/helpers/structured_output/response_parser.rb +1 -1
- data/lib/openai/http_client.rb +40 -1
- data/lib/openai/internal/logging.rb +7 -1
- data/lib/openai/internal/transport/base_client.rb +35 -4
- data/lib/openai/internal/type/base_model.rb +2 -2
- data/lib/openai/internal/type/converter.rb +1 -1
- data/lib/openai/internal/util.rb +8 -4
- data/lib/openai/models/admin/organization/audit_log_list_params.rb +2 -0
- data/lib/openai/models/admin/organization/audit_log_list_response.rb +2 -0
- data/lib/openai/models/admin/organization/usage_costs_params.rb +10 -1
- data/lib/openai/models/batch.rb +4 -4
- data/lib/openai/models/beta/beta_response.rb +9 -12
- data/lib/openai/models/beta/beta_responses_client_event.rb +8 -12
- data/lib/openai/models/beta/response_compact_params.rb +7 -7
- data/lib/openai/models/beta/response_create_params.rb +8 -12
- data/lib/openai/models/chat/completion_create_params.rb +8 -8
- data/lib/openai/models/eval_create_response.rb +1 -1
- data/lib/openai/models/eval_list_response.rb +1 -1
- data/lib/openai/models/eval_retrieve_response.rb +1 -1
- data/lib/openai/models/eval_update_response.rb +1 -1
- data/lib/openai/models/evals/create_eval_completions_run_data_source.rb +2 -2
- data/lib/openai/models/reasoning.rb +0 -2
- data/lib/openai/models/responses/response.rb +6 -7
- data/lib/openai/models/responses/response_compact_params.rb +7 -7
- data/lib/openai/models/responses/response_create_params.rb +5 -7
- data/lib/openai/models/responses/responses_client_event.rb +5 -7
- data/lib/openai/request_options.rb +8 -0
- data/lib/openai/resources/admin/organization/usage.rb +3 -1
- data/lib/openai/resources/beta/responses.rb +5 -5
- data/lib/openai/resources/chat/completions.rb +2 -2
- data/lib/openai/resources/responses.rb +7 -6
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +1 -0
- data/rbi/openai/errors.rbi +1 -1
- data/rbi/openai/helpers/streaming/events.rbi +2 -2
- data/rbi/openai/helpers/streaming/response_stream.rbi +3 -3
- data/rbi/openai/http_client.rbi +25 -2
- data/rbi/openai/internal/logging.rbi +12 -2
- data/rbi/openai/internal/transport/base_client.rbi +12 -2
- data/rbi/openai/internal/util.rbi +3 -2
- data/rbi/openai/models/admin/organization/audit_log_list_params.rbi +8 -0
- data/rbi/openai/models/admin/organization/audit_log_list_response.rbi +8 -0
- data/rbi/openai/models/admin/organization/usage_costs_params.rbi +15 -0
- data/rbi/openai/models/batch.rbi +6 -6
- data/rbi/openai/models/beta/beta_response.rbi +10 -15
- data/rbi/openai/models/beta/beta_responses_client_event.rbi +9 -15
- data/rbi/openai/models/beta/response_compact_params.rbi +9 -9
- data/rbi/openai/models/beta/response_create_params.rbi +9 -15
- data/rbi/openai/models/chat/completion_create_params.rbi +9 -9
- data/rbi/openai/models/eval_create_response.rbi +1 -1
- data/rbi/openai/models/eval_list_response.rbi +1 -1
- data/rbi/openai/models/eval_retrieve_response.rbi +1 -1
- data/rbi/openai/models/eval_update_response.rbi +1 -1
- data/rbi/openai/models/evals/create_eval_completions_run_data_source.rbi +2 -2
- data/rbi/openai/models/reasoning.rbi +0 -2
- data/rbi/openai/models/responses/response.rbi +7 -10
- data/rbi/openai/models/responses/response_compact_params.rbi +9 -9
- data/rbi/openai/models/responses/response_create_params.rbi +6 -10
- data/rbi/openai/models/responses/responses_client_event.rbi +6 -10
- data/rbi/openai/request_options.rbi +4 -0
- data/rbi/openai/resources/admin/organization/usage.rbi +4 -0
- data/rbi/openai/resources/beta/responses.rbi +7 -11
- data/rbi/openai/resources/chat/completions.rbi +6 -6
- data/rbi/openai/resources/responses.rbi +9 -13
- data/sig/openai/errors.rbs +1 -1
- data/sig/openai/http_client.rbs +14 -1
- data/sig/openai/internal/logging.rbs +6 -1
- data/sig/openai/internal/transport/base_client.rbs +11 -20
- data/sig/openai/internal/util.rbs +3 -1
- data/sig/openai/models/admin/organization/audit_log_list_params.rbs +4 -0
- data/sig/openai/models/admin/organization/audit_log_list_response.rbs +4 -0
- data/sig/openai/models/admin/organization/usage_costs_params.rbs +7 -0
- data/sig/openai/models/beta/beta_response.rbs +2 -1
- data/sig/openai/models/responses/response.rbs +2 -1
- data/sig/openai/request_options.rbs +4 -1
- data/sig/openai/resources/admin/organization/usage.rbs +1 -0
- metadata +1 -1
data/sig/openai/http_client.rbs
CHANGED
|
@@ -10,8 +10,21 @@ module OpenAI
|
|
|
10
10
|
attr_reader status: Integer
|
|
11
11
|
attr_reader headers: ::Hash[String, String]
|
|
12
12
|
attr_reader request_id: String?
|
|
13
|
+
attr_reader body: String?
|
|
13
14
|
|
|
14
|
-
def initialize: (
|
|
15
|
+
def initialize: (
|
|
16
|
+
status: Integer,
|
|
17
|
+
headers: ::Hash[String, String],
|
|
18
|
+
?body: String?
|
|
19
|
+
) -> void
|
|
20
|
+
|
|
21
|
+
def encode_with: (top coder) -> void
|
|
22
|
+
|
|
23
|
+
def init_with: (top coder) -> void
|
|
24
|
+
|
|
25
|
+
def marshal_dump: -> [Integer, ::Hash[String, String]]
|
|
26
|
+
|
|
27
|
+
def marshal_load: ([Integer, ::Hash[String, String]] values) -> void
|
|
15
28
|
end
|
|
16
29
|
|
|
17
30
|
class RetryEvent
|
|
@@ -16,7 +16,12 @@ module OpenAI
|
|
|
16
16
|
log_level: Symbol,
|
|
17
17
|
on_retry: (^(OpenAI::RetryEvent) -> void)?,
|
|
18
18
|
method: Symbol,
|
|
19
|
-
url: URI::Generic
|
|
19
|
+
url: URI::Generic,
|
|
20
|
+
?on_response: (^(
|
|
21
|
+
OpenAI::HTTPClient::Response,
|
|
22
|
+
URI::Generic,
|
|
23
|
+
URI::Generic
|
|
24
|
+
) -> void)?
|
|
20
25
|
) -> void
|
|
21
26
|
def request_started: (
|
|
22
27
|
OpenAI::HTTPClient::Request request,
|
|
@@ -8,8 +8,8 @@ module OpenAI
|
|
|
8
8
|
{
|
|
9
9
|
method: Symbol,
|
|
10
10
|
path: String | ::Array[String],
|
|
11
|
-
query: ::Hash[String, (::Array[String] | String)?]?,
|
|
12
|
-
headers: ::Hash[String, (String
|
|
11
|
+
query: ::Hash[(String | Symbol), (::Array[String] | String)?]?,
|
|
12
|
+
headers: ::Hash[(String | Symbol), (String
|
|
13
13
|
| Integer
|
|
14
14
|
| ::Array[(String | Integer)?])?]?,
|
|
15
15
|
body: top?,
|
|
@@ -20,7 +20,7 @@ module OpenAI
|
|
|
20
20
|
page: Class?,
|
|
21
21
|
stream: Class?,
|
|
22
22
|
model: OpenAI::Internal::Type::Converter::input?,
|
|
23
|
-
security:
|
|
23
|
+
security: ::Hash[(:bearer_auth | :admin_api_key_auth), bool]?,
|
|
24
24
|
options: OpenAI::request_opts?
|
|
25
25
|
}
|
|
26
26
|
type request_input =
|
|
@@ -154,27 +154,18 @@ module OpenAI
|
|
|
154
154
|
} -> OpenAI::HTTPClient::Response
|
|
155
155
|
|
|
156
156
|
def request: (
|
|
157
|
-
|
|
158
|
-
String | ::Array[String] path,
|
|
159
|
-
?query: ::Hash[String, (::Array[String] | String)?]?,
|
|
160
|
-
?headers: ::Hash[String, (String
|
|
161
|
-
| Integer
|
|
162
|
-
| ::Array[(String | Integer)?])?]?,
|
|
163
|
-
?body: top?,
|
|
164
|
-
?unwrap: (Symbol
|
|
165
|
-
| Integer
|
|
166
|
-
| ::Array[(Symbol | Integer)]
|
|
167
|
-
| (^(top arg0) -> top))?,
|
|
168
|
-
?page: Class?,
|
|
169
|
-
?stream: Class?,
|
|
170
|
-
?model: OpenAI::Internal::Type::Converter::input?,
|
|
171
|
-
?security: { :bearer_auth? => bool, :admin_api_key_auth? => bool }?,
|
|
172
|
-
?options: OpenAI::request_opts?
|
|
157
|
+
OpenAI::Internal::Transport::BaseClient::request_components req
|
|
173
158
|
) -> top
|
|
174
159
|
|
|
175
160
|
private def perform_request: (
|
|
176
161
|
OpenAI::Internal::Transport::BaseClient::request_components req
|
|
177
|
-
)
|
|
162
|
+
) ?{
|
|
163
|
+
(
|
|
164
|
+
OpenAI::HTTPClient::Response response,
|
|
165
|
+
URI::Generic url,
|
|
166
|
+
URI::Generic response_url
|
|
167
|
+
) -> void
|
|
168
|
+
} -> [URI::Generic, OpenAI::HTTPClient::Response, OpenAI::Internal::Logging::Context]
|
|
178
169
|
|
|
179
170
|
private def finish_request: (
|
|
180
171
|
OpenAI::Internal::Logging::Context log_context,
|
|
@@ -204,6 +204,8 @@ module OpenAI
|
|
|
204
204
|
| :"tenant.admin_api_key.updated"
|
|
205
205
|
| :"tenant.admin_api_key.deleted"
|
|
206
206
|
| :"tenant.project_api_key.created"
|
|
207
|
+
| :"tenant.trusted_access.business_verification.started"
|
|
208
|
+
| :"tenant.trusted_access.application.submitted"
|
|
207
209
|
| :"tenant.chatgpt_access_token.revoked"
|
|
208
210
|
| :"tenant.migration.completed"
|
|
209
211
|
| :"tenant.sso.migrated"
|
|
@@ -353,6 +355,8 @@ module OpenAI
|
|
|
353
355
|
TENANT_ADMIN_API_KEY_UPDATED: :"tenant.admin_api_key.updated"
|
|
354
356
|
TENANT_ADMIN_API_KEY_DELETED: :"tenant.admin_api_key.deleted"
|
|
355
357
|
TENANT_PROJECT_API_KEY_CREATED: :"tenant.project_api_key.created"
|
|
358
|
+
TENANT_TRUSTED_ACCESS_BUSINESS_VERIFICATION_STARTED: :"tenant.trusted_access.business_verification.started"
|
|
359
|
+
TENANT_TRUSTED_ACCESS_APPLICATION_SUBMITTED: :"tenant.trusted_access.application.submitted"
|
|
356
360
|
TENANT_CHATGPT_ACCESS_TOKEN_REVOKED: :"tenant.chatgpt_access_token.revoked"
|
|
357
361
|
TENANT_MIGRATION_COMPLETED: :"tenant.migration.completed"
|
|
358
362
|
TENANT_SSO_MIGRATED: :"tenant.sso.migrated"
|
|
@@ -609,6 +609,8 @@ module OpenAI
|
|
|
609
609
|
| :"tenant.admin_api_key.updated"
|
|
610
610
|
| :"tenant.admin_api_key.deleted"
|
|
611
611
|
| :"tenant.project_api_key.created"
|
|
612
|
+
| :"tenant.trusted_access.business_verification.started"
|
|
613
|
+
| :"tenant.trusted_access.application.submitted"
|
|
612
614
|
| :"tenant.chatgpt_access_token.revoked"
|
|
613
615
|
| :"tenant.migration.completed"
|
|
614
616
|
| :"tenant.sso.migrated"
|
|
@@ -758,6 +760,8 @@ module OpenAI
|
|
|
758
760
|
TENANT_ADMIN_API_KEY_UPDATED: :"tenant.admin_api_key.updated"
|
|
759
761
|
TENANT_ADMIN_API_KEY_DELETED: :"tenant.admin_api_key.deleted"
|
|
760
762
|
TENANT_PROJECT_API_KEY_CREATED: :"tenant.project_api_key.created"
|
|
763
|
+
TENANT_TRUSTED_ACCESS_BUSINESS_VERIFICATION_STARTED: :"tenant.trusted_access.business_verification.started"
|
|
764
|
+
TENANT_TRUSTED_ACCESS_APPLICATION_SUBMITTED: :"tenant.trusted_access.application.submitted"
|
|
761
765
|
TENANT_CHATGPT_ACCESS_TOKEN_REVOKED: :"tenant.chatgpt_access_token.revoked"
|
|
762
766
|
TENANT_MIGRATION_COMPLETED: :"tenant.migration.completed"
|
|
763
767
|
TENANT_SSO_MIGRATED: :"tenant.sso.migrated"
|
|
@@ -10,6 +10,7 @@ module OpenAI
|
|
|
10
10
|
end_time: Integer,
|
|
11
11
|
group_by: ::Array[OpenAI::Models::Admin::Organization::UsageCostsParams::group_by],
|
|
12
12
|
limit: Integer,
|
|
13
|
+
line_items: ::Array[String],
|
|
13
14
|
page: String,
|
|
14
15
|
project_ids: ::Array[String]
|
|
15
16
|
}
|
|
@@ -45,6 +46,10 @@ module OpenAI
|
|
|
45
46
|
|
|
46
47
|
def limit=: (Integer) -> Integer
|
|
47
48
|
|
|
49
|
+
attr_reader line_items: ::Array[String]?
|
|
50
|
+
|
|
51
|
+
def line_items=: (::Array[String]) -> ::Array[String]
|
|
52
|
+
|
|
48
53
|
attr_reader page: String?
|
|
49
54
|
|
|
50
55
|
def page=: (String) -> String
|
|
@@ -60,6 +65,7 @@ module OpenAI
|
|
|
60
65
|
?end_time: Integer,
|
|
61
66
|
?group_by: ::Array[OpenAI::Models::Admin::Organization::UsageCostsParams::group_by],
|
|
62
67
|
?limit: Integer,
|
|
68
|
+
?line_items: ::Array[String],
|
|
63
69
|
?page: String,
|
|
64
70
|
?project_ids: ::Array[String],
|
|
65
71
|
?request_options: OpenAI::request_opts
|
|
@@ -72,6 +78,7 @@ module OpenAI
|
|
|
72
78
|
end_time: Integer,
|
|
73
79
|
group_by: ::Array[OpenAI::Models::Admin::Organization::UsageCostsParams::group_by],
|
|
74
80
|
limit: Integer,
|
|
81
|
+
line_items: ::Array[String],
|
|
75
82
|
page: String,
|
|
76
83
|
project_ids: ::Array[String],
|
|
77
84
|
request_options: OpenAI::RequestOptions
|
|
@@ -222,12 +222,13 @@ module OpenAI
|
|
|
222
222
|
reason: OpenAI::Models::Beta::BetaResponse::IncompleteDetails::reason
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
type reason = :max_output_tokens | :content_filter
|
|
225
|
+
type reason = :max_output_tokens | :max_messages | :content_filter
|
|
226
226
|
|
|
227
227
|
module Reason
|
|
228
228
|
extend OpenAI::Internal::Type::Enum
|
|
229
229
|
|
|
230
230
|
MAX_OUTPUT_TOKENS: :max_output_tokens
|
|
231
|
+
MAX_MESSAGES: :max_messages
|
|
231
232
|
CONTENT_FILTER: :content_filter
|
|
232
233
|
|
|
233
234
|
def self?.values: -> ::Array[OpenAI::Models::Beta::BetaResponse::IncompleteDetails::reason]
|
|
@@ -222,12 +222,13 @@ module OpenAI
|
|
|
222
222
|
reason: OpenAI::Models::Responses::Response::IncompleteDetails::reason
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
type reason = :max_output_tokens | :content_filter
|
|
225
|
+
type reason = :max_output_tokens | :max_messages | :content_filter
|
|
226
226
|
|
|
227
227
|
module Reason
|
|
228
228
|
extend OpenAI::Internal::Type::Enum
|
|
229
229
|
|
|
230
230
|
MAX_OUTPUT_TOKENS: :max_output_tokens
|
|
231
|
+
MAX_MESSAGES: :max_messages
|
|
231
232
|
CONTENT_FILTER: :content_filter
|
|
232
233
|
|
|
233
234
|
def self?.values: -> ::Array[OpenAI::Models::Responses::Response::IncompleteDetails::reason]
|
|
@@ -9,7 +9,8 @@ module OpenAI
|
|
|
9
9
|
extra_headers: ::Hash[String, String?]?,
|
|
10
10
|
extra_body: top?,
|
|
11
11
|
max_retries: Integer?,
|
|
12
|
-
timeout: Float
|
|
12
|
+
timeout: Float?,
|
|
13
|
+
include_raw_body: bool?
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
class RequestOptions < OpenAI::Internal::Type::BaseModel
|
|
@@ -27,6 +28,8 @@ module OpenAI
|
|
|
27
28
|
|
|
28
29
|
attr_accessor timeout: Float?
|
|
29
30
|
|
|
31
|
+
attr_accessor include_raw_body: bool?
|
|
32
|
+
|
|
30
33
|
def initialize: (
|
|
31
34
|
?OpenAI::request_options | ::Hash[Symbol, top] values
|
|
32
35
|
) -> void
|
|
@@ -64,6 +64,7 @@ module OpenAI
|
|
|
64
64
|
?end_time: Integer,
|
|
65
65
|
?group_by: ::Array[OpenAI::Models::Admin::Organization::UsageCostsParams::group_by],
|
|
66
66
|
?limit: Integer,
|
|
67
|
+
?line_items: ::Array[String],
|
|
67
68
|
?page: String,
|
|
68
69
|
?project_ids: ::Array[String],
|
|
69
70
|
?request_options: OpenAI::request_opts
|