openai 0.82.0 → 0.83.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 +18 -0
- data/README.md +1 -1
- data/lib/openai/helpers/realtime/client_extension.rb +107 -0
- 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/util.rb +6 -2
- 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/beta/beta_response_usage.rb +12 -1
- data/lib/openai/models/completion_usage.rb +12 -1
- data/lib/openai/models/responses/response_usage.rb +12 -1
- data/lib/openai/request_options.rb +8 -0
- data/lib/openai/version.rb +1 -1
- 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/beta/beta_response_usage.rbi +13 -3
- data/rbi/openai/models/completion_usage.rbi +10 -0
- data/rbi/openai/models/responses/response_usage.rbi +13 -3
- data/rbi/openai/request_options.rbi +4 -0
- data/sig/openai/http_client.rbs +14 -1
- data/sig/openai/internal/logging.rbs +6 -1
- data/sig/openai/internal/transport/base_client.rbs +7 -1
- 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/beta/beta_response_usage.rbs +8 -3
- data/sig/openai/models/completion_usage.rbs +5 -0
- data/sig/openai/models/responses/response_usage.rbs +8 -3
- data/sig/openai/request_options.rbs +4 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 06b53caabbe2b1546ef4ec0eb7f677b8de5cb6d193a65e6a7e37b937459e84b1
|
|
4
|
+
data.tar.gz: af8a795be6bc7ee391b58b35a48e7a6eb49562c67a98d548437fad6f85871a48
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0a4a975d009308c39829498c31a41cd7ff1e4d6d34302251a2ad1a96858892a6ca52dfb7bb2791dfae729cc000c9c191ced27ae413f96b4a15b1f93f3d729c80
|
|
7
|
+
data.tar.gz: af0e5f84ca22955f73cecafe5a06bd9180c414c410cd1d8a88f36ae4566bfcdf43cdbba3300f24648e5cfbea993bd9093f0edc57304b183af6328a0826ad026e
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.83.0](https://github.com/openai/openai-ruby/compare/v0.82.0...v0.83.0) (2026-08-27)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **api:** add compute_units to Responses and Chat Completions usage ([#543](https://github.com/openai/openai-ruby/issues/543)) ([b128f89](https://github.com/openai/openai-ruby/commit/b128f89672416a083addeb0e2bbc337f8ddb7f9f))
|
|
9
|
+
* expose opt-in raw response bodies on response metadata ([#544](https://github.com/openai/openai-ruby/issues/544)) ([1529e96](https://github.com/openai/openai-ruby/commit/1529e96781c217828915ed3f69faa61bf6605129))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* **realtime:** clean up interrupted WebRTC call allocations ([#534](https://github.com/openai/openai-ruby/issues/534)) ([2057039](https://github.com/openai/openai-ruby/commit/205703935bafe5e78b90b5424cc43d3b7b978772))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Chores
|
|
18
|
+
|
|
19
|
+
* **deps:** bump the codeql group with 2 updates ([#541](https://github.com/openai/openai-ruby/issues/541)) ([b15451c](https://github.com/openai/openai-ruby/commit/b15451c0df8ba890f136c86dc7f5299876bb9b5d))
|
|
20
|
+
|
|
3
21
|
## [0.82.0](https://github.com/openai/openai-ruby/compare/v0.81.0...v0.82.0) (2026-08-27)
|
|
4
22
|
|
|
5
23
|
|
data/README.md
CHANGED
|
@@ -5,6 +5,113 @@ module OpenAI
|
|
|
5
5
|
module Realtime
|
|
6
6
|
# Realtime request integration kept outside the generated client implementation.
|
|
7
7
|
module ClientExtension
|
|
8
|
+
MAX_CALL_CLEANUP_SECONDS = 5.0
|
|
9
|
+
private_constant :MAX_CALL_CLEANUP_SECONDS
|
|
10
|
+
|
|
11
|
+
# A generated WebRTC allocation belongs to the SDK until its complete raw
|
|
12
|
+
# response can be returned. Keep this lifecycle outside generated resources.
|
|
13
|
+
def request(req)
|
|
14
|
+
unless req.is_a?(Hash) &&
|
|
15
|
+
req[:method] == :post &&
|
|
16
|
+
req[:path] == "realtime/calls" &&
|
|
17
|
+
req[:model] == OpenAI::HTTPClient::Response
|
|
18
|
+
return super
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
delivered = false
|
|
22
|
+
allocated_response = nil
|
|
23
|
+
call_id = nil
|
|
24
|
+
begin
|
|
25
|
+
url, response, log_context = perform_request(req) do |received_response, request_url, response_url|
|
|
26
|
+
if received_response.status == 201
|
|
27
|
+
allocated_response = received_response
|
|
28
|
+
if response_url.path == request_url.path &&
|
|
29
|
+
realtime_call_origin(response_url).casecmp?(realtime_call_origin(request_url))
|
|
30
|
+
call_id = realtime_call_id_from_location(
|
|
31
|
+
received_response.headers["location"],
|
|
32
|
+
request_url: request_url
|
|
33
|
+
)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
result = finish_request(log_context, response) do
|
|
39
|
+
parse_response(req, url: url, response: response)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
delivered = true
|
|
43
|
+
result
|
|
44
|
+
ensure
|
|
45
|
+
unless delivered
|
|
46
|
+
begin
|
|
47
|
+
OpenAI::Internal::Util.close_fused!(allocated_response.body) if allocated_response
|
|
48
|
+
rescue StandardError, *(defined?(::Async::Stop) ? [::Async::Stop] : [])
|
|
49
|
+
nil
|
|
50
|
+
ensure
|
|
51
|
+
cleanup_created_realtime_call(call_id, options: req[:options]) if call_id
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
private def realtime_call_id_from_location(location, request_url:)
|
|
58
|
+
return if location.nil? || location.empty?
|
|
59
|
+
|
|
60
|
+
call_url = URI.join(request_url.to_s, location)
|
|
61
|
+
unless call_url.is_a?(URI::HTTP) &&
|
|
62
|
+
!call_url.host.to_s.empty? &&
|
|
63
|
+
call_url.userinfo.nil? &&
|
|
64
|
+
call_url.fragment.nil?
|
|
65
|
+
return
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
return unless realtime_call_origin(request_url).casecmp?(realtime_call_origin(call_url))
|
|
69
|
+
|
|
70
|
+
prefix = "#{request_url.path}/"
|
|
71
|
+
return unless call_url.path.start_with?(prefix)
|
|
72
|
+
|
|
73
|
+
call_id = call_url.path.delete_prefix(prefix)
|
|
74
|
+
call_id if /\A[A-Za-z0-9_-]+\z/.match?(call_id)
|
|
75
|
+
rescue URI::InvalidURIError, ArgumentError
|
|
76
|
+
nil
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
private def realtime_call_origin(url)
|
|
80
|
+
origin = OpenAI::Internal::Util.uri_origin(url)
|
|
81
|
+
if url.host.start_with?("[") && !url.hostname.start_with?("v", "V")
|
|
82
|
+
origin = origin.sub(url.host, "[#{IPAddr.new(url.hostname)}]")
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
origin
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
private def cleanup_created_realtime_call(call_id, options:)
|
|
89
|
+
cleanup_options = options.to_h.slice(:extra_headers, :extra_query, :timeout)
|
|
90
|
+
timeout = cleanup_options.fetch(:timeout, @timeout)
|
|
91
|
+
timeout = MAX_CALL_CLEANUP_SECONDS unless timeout&.positive?
|
|
92
|
+
cleanup_options[:timeout] = [timeout, MAX_CALL_CLEANUP_SECONDS].min
|
|
93
|
+
cleanup_options[:max_retries] = 0
|
|
94
|
+
task = ::Async::Task.current? if defined?(::Async::Task)
|
|
95
|
+
cleanup = lambda do
|
|
96
|
+
Timeout.timeout(cleanup_options.fetch(:timeout)) do
|
|
97
|
+
realtime.calls.hangup(call_id, request_options: cleanup_options)
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
if task
|
|
102
|
+
if task.respond_to?(:defer_cancel)
|
|
103
|
+
task.defer_cancel(&cleanup)
|
|
104
|
+
else
|
|
105
|
+
task.defer_stop(&cleanup)
|
|
106
|
+
end
|
|
107
|
+
else
|
|
108
|
+
cleanup.call
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
rescue StandardError, *(defined?(::Async::Stop) ? [::Async::Stop] : [])
|
|
112
|
+
nil
|
|
113
|
+
end
|
|
114
|
+
|
|
8
115
|
# Build a fully authenticated Realtime WebSocket handshake request. Realtime
|
|
9
116
|
# transports use this boundary so provider authentication and request options stay
|
|
10
117
|
# consistent with ordinary SDK requests.
|
data/lib/openai/http_client.rb
CHANGED
|
@@ -20,11 +20,18 @@ module OpenAI
|
|
|
20
20
|
# @return [String, nil]
|
|
21
21
|
attr_reader :request_id
|
|
22
22
|
|
|
23
|
+
# The exact response body when `include_raw_body: true` was requested.
|
|
24
|
+
# Bodies are never retained by default or for streaming responses.
|
|
25
|
+
#
|
|
26
|
+
# @return [String, nil]
|
|
27
|
+
attr_reader :body
|
|
28
|
+
|
|
23
29
|
# @api private
|
|
24
30
|
#
|
|
25
31
|
# @param status [Integer]
|
|
26
32
|
# @param headers [Hash{String=>String}]
|
|
27
|
-
|
|
33
|
+
# @param body [String, nil]
|
|
34
|
+
def initialize(status:, headers:, body: nil)
|
|
28
35
|
@status = Integer(status)
|
|
29
36
|
@headers = headers
|
|
30
37
|
.to_h do |name, value|
|
|
@@ -32,6 +39,7 @@ module OpenAI
|
|
|
32
39
|
end
|
|
33
40
|
.freeze
|
|
34
41
|
@request_id = @headers["x-request-id"]
|
|
42
|
+
@body = body.nil? || body.frozen? ? body : body.dup.freeze
|
|
35
43
|
freeze
|
|
36
44
|
end
|
|
37
45
|
|
|
@@ -39,6 +47,37 @@ module OpenAI
|
|
|
39
47
|
#
|
|
40
48
|
# @return [String]
|
|
41
49
|
def inspect = "#<#{self.class} status=#{@status} request_id=#{@request_id.inspect}>"
|
|
50
|
+
|
|
51
|
+
# Keep retained response bodies out of Psych object serialization.
|
|
52
|
+
#
|
|
53
|
+
# @api private
|
|
54
|
+
# @param coder [Psych::Coder]
|
|
55
|
+
# @return [void]
|
|
56
|
+
def encode_with(coder)
|
|
57
|
+
coder["status"] = @status
|
|
58
|
+
coder["headers"] = @headers
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# @api private
|
|
62
|
+
# @param coder [Psych::Coder]
|
|
63
|
+
# @return [void]
|
|
64
|
+
def init_with(coder)
|
|
65
|
+
initialize(status: coder["status"], headers: coder["headers"])
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Keep retained response bodies out of Marshal object serialization.
|
|
69
|
+
#
|
|
70
|
+
# @api private
|
|
71
|
+
# @return [Array(Integer, Hash{String=>String})]
|
|
72
|
+
def marshal_dump = [@status, @headers]
|
|
73
|
+
|
|
74
|
+
# @api private
|
|
75
|
+
# @param values [Array(Integer, Hash{String=>String})]
|
|
76
|
+
# @return [void]
|
|
77
|
+
def marshal_load(values)
|
|
78
|
+
status, headers = values
|
|
79
|
+
initialize(status: status, headers: headers)
|
|
80
|
+
end
|
|
42
81
|
end
|
|
43
82
|
|
|
44
83
|
# Details about an API request retry that is about to run.
|
|
@@ -26,19 +26,24 @@ module OpenAI
|
|
|
26
26
|
URL_HEADER_KEY = /(?:\A|[-_])(?:location|url|uri)\z|\A(?:link|refresh)\z/i
|
|
27
27
|
|
|
28
28
|
class Context
|
|
29
|
-
def initialize(logger:, log_level:, on_retry:, method:, url:)
|
|
29
|
+
def initialize(logger:, log_level:, on_retry:, method:, url:, on_response: nil)
|
|
30
30
|
@logger = logger
|
|
31
31
|
@log_level = log_level
|
|
32
32
|
@on_retry = on_retry
|
|
33
|
+
@on_response = on_response
|
|
33
34
|
@id = nil
|
|
34
35
|
@method = method.to_s.upcase
|
|
35
36
|
@url = url
|
|
37
|
+
@request_url = url
|
|
38
|
+
@first_request_url = nil
|
|
36
39
|
@started_at = OpenAI::Internal::Util.monotonic_secs
|
|
37
40
|
@attempt_started_at = @started_at
|
|
38
41
|
@attempts = 0
|
|
39
42
|
end
|
|
40
43
|
|
|
41
44
|
def request_started(request, redirect_count:)
|
|
45
|
+
@request_url = request.url
|
|
46
|
+
@first_request_url ||= request.url
|
|
42
47
|
@attempts += 1
|
|
43
48
|
log(:debug) do
|
|
44
49
|
"[openai] request started log_id=#{id} attempt=#{@attempts} " \
|
|
@@ -52,6 +57,7 @@ module OpenAI
|
|
|
52
57
|
end
|
|
53
58
|
|
|
54
59
|
def response_received(response)
|
|
60
|
+
@on_response&.call(response, @first_request_url || @url, @request_url)
|
|
55
61
|
log(:debug) do
|
|
56
62
|
"[openai] response received log_id=#{id} attempt=#{@attempts} " \
|
|
57
63
|
"status=#{response.status} request_id=#{safe_field(response.headers["x-request-id"])} " \
|
|
@@ -658,9 +658,9 @@ module OpenAI
|
|
|
658
658
|
raise TypeError, "`http_client#execute` must return an OpenAI::HTTPClient::Response"
|
|
659
659
|
end
|
|
660
660
|
|
|
661
|
+
http_response = log_context.response_received(http_response)
|
|
661
662
|
status = http_response.status
|
|
662
663
|
headers = http_response.headers
|
|
663
|
-
http_response = log_context.response_received(http_response)
|
|
664
664
|
stream = http_response.body
|
|
665
665
|
rescue OpenAI::Errors::APIConnectionError => e
|
|
666
666
|
status = e
|
|
@@ -785,6 +785,8 @@ module OpenAI
|
|
|
785
785
|
#
|
|
786
786
|
# @option options [Float, nil] :timeout
|
|
787
787
|
#
|
|
788
|
+
# @option options [Boolean, nil] :include_raw_body
|
|
789
|
+
#
|
|
788
790
|
# @raise [OpenAI::Errors::APIError]
|
|
789
791
|
# @return [Object]
|
|
790
792
|
def request(req)
|
|
@@ -798,10 +800,14 @@ module OpenAI
|
|
|
798
800
|
#
|
|
799
801
|
# @param req [Hash{Symbol=>Object}]
|
|
800
802
|
# @return [Array(URI::Generic, OpenAI::HTTPClient::Response, OpenAI::Internal::Logging::Context)]
|
|
801
|
-
private def perform_request(req)
|
|
803
|
+
private def perform_request(req, &response_observer)
|
|
802
804
|
self.class.validate!(req)
|
|
803
805
|
opts = req[:options].to_h
|
|
804
806
|
OpenAI::RequestOptions.validate!(opts)
|
|
807
|
+
if req[:stream] && opts[:include_raw_body] == true
|
|
808
|
+
raise ArgumentError, "`include_raw_body` is not supported for streaming responses"
|
|
809
|
+
end
|
|
810
|
+
|
|
805
811
|
request = build_request(req.except(:options), opts)
|
|
806
812
|
url = request.fetch(:url)
|
|
807
813
|
log_context = OpenAI::Internal::Logging::Context.new(
|
|
@@ -809,7 +815,12 @@ module OpenAI
|
|
|
809
815
|
log_level: @log_level,
|
|
810
816
|
on_retry: @on_retry,
|
|
811
817
|
method: request.fetch(:method),
|
|
812
|
-
url: url
|
|
818
|
+
url: url,
|
|
819
|
+
on_response: if response_observer
|
|
820
|
+
lambda do |received_response, trusted_url, received_url|
|
|
821
|
+
response_observer.call(received_response, trusted_url, received_url)
|
|
822
|
+
end
|
|
823
|
+
end
|
|
813
824
|
)
|
|
814
825
|
|
|
815
826
|
# Don't send the current retry count in the headers if the caller modified the header defaults.
|
|
@@ -820,6 +831,7 @@ module OpenAI
|
|
|
820
831
|
retry_count: 0,
|
|
821
832
|
send_retry_header: send_retry_header
|
|
822
833
|
) { log_context }
|
|
834
|
+
|
|
823
835
|
[url, response, log_context]
|
|
824
836
|
rescue StandardError => e
|
|
825
837
|
log_context&.request_failed(e)
|
|
@@ -862,8 +874,27 @@ module OpenAI
|
|
|
862
874
|
|
|
863
875
|
unwrap = req[:unwrap]
|
|
864
876
|
response_metadata = response.metadata
|
|
877
|
+
include_raw_body = req[:options].to_h[:include_raw_body] == true &&
|
|
878
|
+
(req[:page] ||
|
|
879
|
+
(model.is_a?(Class) && model <= OpenAI::Internal::Type::BaseModel) ||
|
|
880
|
+
model.is_a?(OpenAI::Internal::Type::Union))
|
|
881
|
+
raw_body = nil
|
|
882
|
+
decoded = if include_raw_body
|
|
883
|
+
OpenAI::Internal::Util.decode_content(response.headers, stream: response.body) do |body|
|
|
884
|
+
raw_body = body
|
|
885
|
+
end
|
|
886
|
+
else
|
|
887
|
+
OpenAI::Internal::Util.decode_content(response.headers, stream: response.body)
|
|
888
|
+
end
|
|
889
|
+
|
|
890
|
+
if include_raw_body && !decoded.is_a?(StringIO)
|
|
891
|
+
response_metadata = OpenAI::ResponseMetadata.new(
|
|
892
|
+
status: response.status,
|
|
893
|
+
headers: response.headers,
|
|
894
|
+
body: raw_body&.freeze
|
|
895
|
+
)
|
|
896
|
+
end
|
|
865
897
|
|
|
866
|
-
decoded = OpenAI::Internal::Util.decode_content(response.headers, stream: response.body)
|
|
867
898
|
case req
|
|
868
899
|
in {stream: Class => st}
|
|
869
900
|
st.new(
|
data/lib/openai/internal/util.rb
CHANGED
|
@@ -673,13 +673,16 @@ module OpenAI
|
|
|
673
673
|
# @param headers [Hash{String=>String}]
|
|
674
674
|
# @param stream [Enumerable<String>]
|
|
675
675
|
# @param suppress_error [Boolean]
|
|
676
|
+
# @yieldparam [String] The buffered response body before decoding.
|
|
676
677
|
#
|
|
677
678
|
# @raise [JSON::ParserError]
|
|
678
679
|
# @return [Object]
|
|
679
|
-
def decode_content(headers, stream:, suppress_error: false)
|
|
680
|
+
def decode_content(headers, stream:, suppress_error: false, &body_observer)
|
|
680
681
|
case (content_type = headers["content-type"])
|
|
681
682
|
in OpenAI::Internal::Util::JSON_CONTENT
|
|
682
|
-
|
|
683
|
+
json = stream.to_a.join
|
|
684
|
+
body_observer&.call(json)
|
|
685
|
+
return nil if json.empty?
|
|
683
686
|
|
|
684
687
|
begin
|
|
685
688
|
JSON.parse(json, symbolize_names: true)
|
|
@@ -703,6 +706,7 @@ module OpenAI
|
|
|
703
706
|
decode_sse(lines)
|
|
704
707
|
else
|
|
705
708
|
text = stream.to_a.join
|
|
709
|
+
body_observer&.call(text)
|
|
706
710
|
force_charset!(content_type, text: text)
|
|
707
711
|
StringIO.new(text)
|
|
708
712
|
end
|
|
@@ -236,6 +236,8 @@ module OpenAI
|
|
|
236
236
|
TENANT_ADMIN_API_KEY_UPDATED = :"tenant.admin_api_key.updated"
|
|
237
237
|
TENANT_ADMIN_API_KEY_DELETED = :"tenant.admin_api_key.deleted"
|
|
238
238
|
TENANT_PROJECT_API_KEY_CREATED = :"tenant.project_api_key.created"
|
|
239
|
+
TENANT_TRUSTED_ACCESS_BUSINESS_VERIFICATION_STARTED = :"tenant.trusted_access.business_verification.started"
|
|
240
|
+
TENANT_TRUSTED_ACCESS_APPLICATION_SUBMITTED = :"tenant.trusted_access.application.submitted"
|
|
239
241
|
TENANT_CHATGPT_ACCESS_TOKEN_REVOKED = :"tenant.chatgpt_access_token.revoked"
|
|
240
242
|
TENANT_MIGRATION_COMPLETED = :"tenant.migration.completed"
|
|
241
243
|
TENANT_SSO_MIGRATED = :"tenant.sso.migrated"
|
|
@@ -788,6 +788,8 @@ module OpenAI
|
|
|
788
788
|
TENANT_ADMIN_API_KEY_UPDATED = :"tenant.admin_api_key.updated"
|
|
789
789
|
TENANT_ADMIN_API_KEY_DELETED = :"tenant.admin_api_key.deleted"
|
|
790
790
|
TENANT_PROJECT_API_KEY_CREATED = :"tenant.project_api_key.created"
|
|
791
|
+
TENANT_TRUSTED_ACCESS_BUSINESS_VERIFICATION_STARTED = :"tenant.trusted_access.business_verification.started"
|
|
792
|
+
TENANT_TRUSTED_ACCESS_APPLICATION_SUBMITTED = :"tenant.trusted_access.application.submitted"
|
|
791
793
|
TENANT_CHATGPT_ACCESS_TOKEN_REVOKED = :"tenant.chatgpt_access_token.revoked"
|
|
792
794
|
TENANT_MIGRATION_COMPLETED = :"tenant.migration.completed"
|
|
793
795
|
TENANT_SSO_MIGRATED = :"tenant.sso.migrated"
|
|
@@ -34,7 +34,16 @@ module OpenAI
|
|
|
34
34
|
# @return [Integer]
|
|
35
35
|
required :total_tokens, Integer
|
|
36
36
|
|
|
37
|
-
# @!
|
|
37
|
+
# @!attribute compute_units
|
|
38
|
+
# Compute units for the request. Currently null when available.
|
|
39
|
+
#
|
|
40
|
+
# @return [Integer, nil]
|
|
41
|
+
optional :compute_units, Integer, nil?: true
|
|
42
|
+
|
|
43
|
+
# @!method initialize(input_tokens:, input_tokens_details:, output_tokens:, output_tokens_details:, total_tokens:, compute_units: nil)
|
|
44
|
+
# Some parameter documentations has been truncated, see
|
|
45
|
+
# {OpenAI::Models::Beta::BetaResponseUsage} for more details.
|
|
46
|
+
#
|
|
38
47
|
# Represents token usage details including input tokens, output tokens, a
|
|
39
48
|
# breakdown of output tokens, and the total tokens used.
|
|
40
49
|
#
|
|
@@ -47,6 +56,8 @@ module OpenAI
|
|
|
47
56
|
# @param output_tokens_details [OpenAI::Models::Beta::BetaResponseUsage::OutputTokensDetails] A detailed breakdown of the output tokens.
|
|
48
57
|
#
|
|
49
58
|
# @param total_tokens [Integer] The total number of tokens used.
|
|
59
|
+
#
|
|
60
|
+
# @param compute_units [Integer, nil] Compute units for the request. Currently null when available.
|
|
50
61
|
|
|
51
62
|
# @see OpenAI::Models::Beta::BetaResponseUsage#input_tokens_details
|
|
52
63
|
class InputTokensDetails < OpenAI::Internal::Type::BaseModel
|
|
@@ -27,13 +27,22 @@ module OpenAI
|
|
|
27
27
|
# @return [OpenAI::Models::CompletionUsage::CompletionTokensDetails, nil]
|
|
28
28
|
optional :completion_tokens_details, -> { OpenAI::CompletionUsage::CompletionTokensDetails }
|
|
29
29
|
|
|
30
|
+
# @!attribute compute_units
|
|
31
|
+
# Compute units for the request. Currently null when available.
|
|
32
|
+
#
|
|
33
|
+
# @return [Integer, nil]
|
|
34
|
+
optional :compute_units, Integer, nil?: true
|
|
35
|
+
|
|
30
36
|
# @!attribute prompt_tokens_details
|
|
31
37
|
# Breakdown of tokens used in the prompt.
|
|
32
38
|
#
|
|
33
39
|
# @return [OpenAI::Models::CompletionUsage::PromptTokensDetails, nil]
|
|
34
40
|
optional :prompt_tokens_details, -> { OpenAI::CompletionUsage::PromptTokensDetails }
|
|
35
41
|
|
|
36
|
-
# @!method initialize(completion_tokens:, prompt_tokens:, total_tokens:, completion_tokens_details: nil, prompt_tokens_details: nil)
|
|
42
|
+
# @!method initialize(completion_tokens:, prompt_tokens:, total_tokens:, completion_tokens_details: nil, compute_units: nil, prompt_tokens_details: nil)
|
|
43
|
+
# Some parameter documentations has been truncated, see
|
|
44
|
+
# {OpenAI::Models::CompletionUsage} for more details.
|
|
45
|
+
#
|
|
37
46
|
# Usage statistics for the completion request.
|
|
38
47
|
#
|
|
39
48
|
# @param completion_tokens [Integer] Number of tokens in the generated completion.
|
|
@@ -44,6 +53,8 @@ module OpenAI
|
|
|
44
53
|
#
|
|
45
54
|
# @param completion_tokens_details [OpenAI::Models::CompletionUsage::CompletionTokensDetails] Breakdown of tokens used in a completion.
|
|
46
55
|
#
|
|
56
|
+
# @param compute_units [Integer, nil] Compute units for the request. Currently null when available.
|
|
57
|
+
#
|
|
47
58
|
# @param prompt_tokens_details [OpenAI::Models::CompletionUsage::PromptTokensDetails] Breakdown of tokens used in the prompt.
|
|
48
59
|
|
|
49
60
|
# @see OpenAI::Models::CompletionUsage#completion_tokens_details
|
|
@@ -34,7 +34,16 @@ module OpenAI
|
|
|
34
34
|
# @return [Integer]
|
|
35
35
|
required :total_tokens, Integer
|
|
36
36
|
|
|
37
|
-
# @!
|
|
37
|
+
# @!attribute compute_units
|
|
38
|
+
# Compute units for the request. Currently null when available.
|
|
39
|
+
#
|
|
40
|
+
# @return [Integer, nil]
|
|
41
|
+
optional :compute_units, Integer, nil?: true
|
|
42
|
+
|
|
43
|
+
# @!method initialize(input_tokens:, input_tokens_details:, output_tokens:, output_tokens_details:, total_tokens:, compute_units: nil)
|
|
44
|
+
# Some parameter documentations has been truncated, see
|
|
45
|
+
# {OpenAI::Models::Responses::ResponseUsage} for more details.
|
|
46
|
+
#
|
|
38
47
|
# Represents token usage details including input tokens, output tokens, a
|
|
39
48
|
# breakdown of output tokens, and the total tokens used.
|
|
40
49
|
#
|
|
@@ -47,6 +56,8 @@ module OpenAI
|
|
|
47
56
|
# @param output_tokens_details [OpenAI::Models::Responses::ResponseUsage::OutputTokensDetails] A detailed breakdown of the output tokens.
|
|
48
57
|
#
|
|
49
58
|
# @param total_tokens [Integer] The total number of tokens used.
|
|
59
|
+
#
|
|
60
|
+
# @param compute_units [Integer, nil] Compute units for the request. Currently null when available.
|
|
50
61
|
|
|
51
62
|
# @see OpenAI::Models::Responses::ResponseUsage#input_tokens_details
|
|
52
63
|
class InputTokensDetails < OpenAI::Internal::Type::BaseModel
|
|
@@ -65,6 +65,14 @@ module OpenAI
|
|
|
65
65
|
# @return [Float, nil]
|
|
66
66
|
optional :timeout, Float
|
|
67
67
|
|
|
68
|
+
# @!attribute include_raw_body
|
|
69
|
+
# Retain the exact successful HTTP response body on the returned model or
|
|
70
|
+
# page through `last_response.body`. Body retention is disabled by default
|
|
71
|
+
# and cannot be enabled for streaming responses.
|
|
72
|
+
#
|
|
73
|
+
# @return [Boolean, nil]
|
|
74
|
+
optional :include_raw_body, OpenAI::Internal::Type::Boolean
|
|
75
|
+
|
|
68
76
|
# @!method initialize(values = {})
|
|
69
77
|
# Returns a new instance of RequestOptions.
|
|
70
78
|
#
|
data/lib/openai/version.rb
CHANGED
data/rbi/openai/http_client.rbi
CHANGED
|
@@ -11,13 +11,36 @@ module OpenAI
|
|
|
11
11
|
sig { returns(T.nilable(String)) }
|
|
12
12
|
attr_reader :request_id
|
|
13
13
|
|
|
14
|
+
sig { returns(T.nilable(String)) }
|
|
15
|
+
attr_reader :body
|
|
16
|
+
|
|
14
17
|
# @api private
|
|
15
18
|
sig do
|
|
16
|
-
params(status: Integer, headers: T::Hash[String, String]).returns(
|
|
19
|
+
params(status: Integer, headers: T::Hash[String, String], body: T.nilable(String)).returns(
|
|
17
20
|
T.attached_class
|
|
18
21
|
)
|
|
19
22
|
end
|
|
20
|
-
def self.new(status:, headers:)
|
|
23
|
+
def self.new(status:, headers:, body: nil)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# @api private
|
|
27
|
+
sig { params(coder: T.untyped).void }
|
|
28
|
+
def encode_with(coder)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# @api private
|
|
32
|
+
sig { params(coder: T.untyped).void }
|
|
33
|
+
def init_with(coder)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# @api private
|
|
37
|
+
sig { returns(T::Array[T.any(Integer, T::Hash[String, String])]) }
|
|
38
|
+
def marshal_dump
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# @api private
|
|
42
|
+
sig { params(values: T::Array[T.any(Integer, T::Hash[String, String])]).void }
|
|
43
|
+
def marshal_load(values)
|
|
21
44
|
end
|
|
22
45
|
end
|
|
23
46
|
|
|
@@ -19,11 +19,21 @@ module OpenAI
|
|
|
19
19
|
log_level: Symbol,
|
|
20
20
|
on_retry: T.nilable(T.proc.params(event: OpenAI::RetryEvent).void),
|
|
21
21
|
method: Symbol,
|
|
22
|
-
url: URI::Generic
|
|
22
|
+
url: URI::Generic,
|
|
23
|
+
on_response: T.nilable(
|
|
24
|
+
T
|
|
25
|
+
.proc
|
|
26
|
+
.params(
|
|
27
|
+
response: OpenAI::HTTPClient::Response,
|
|
28
|
+
trusted_url: URI::Generic,
|
|
29
|
+
response_url: URI::Generic
|
|
30
|
+
)
|
|
31
|
+
.void
|
|
32
|
+
)
|
|
23
33
|
)
|
|
24
34
|
.returns(T.attached_class)
|
|
25
35
|
end
|
|
26
|
-
def self.new(logger:, log_level:, on_retry:, method:, url:)
|
|
36
|
+
def self.new(logger:, log_level:, on_retry:, method:, url:, on_response: nil)
|
|
27
37
|
end
|
|
28
38
|
|
|
29
39
|
sig do
|
|
@@ -401,7 +401,17 @@ module OpenAI
|
|
|
401
401
|
# @api private
|
|
402
402
|
sig do
|
|
403
403
|
params(
|
|
404
|
-
req: OpenAI::Internal::Transport::BaseClient::RequestComponents
|
|
404
|
+
req: OpenAI::Internal::Transport::BaseClient::RequestComponents,
|
|
405
|
+
response_observer: T.nilable(
|
|
406
|
+
T
|
|
407
|
+
.proc
|
|
408
|
+
.params(
|
|
409
|
+
response: OpenAI::HTTPClient::Response,
|
|
410
|
+
url: URI::Generic,
|
|
411
|
+
response_url: URI::Generic
|
|
412
|
+
)
|
|
413
|
+
.void
|
|
414
|
+
)
|
|
405
415
|
)
|
|
406
416
|
.returns(
|
|
407
417
|
[
|
|
@@ -411,7 +421,7 @@ module OpenAI
|
|
|
411
421
|
]
|
|
412
422
|
)
|
|
413
423
|
end
|
|
414
|
-
private def perform_request(req)
|
|
424
|
+
private def perform_request(req, &response_observer)
|
|
415
425
|
end
|
|
416
426
|
|
|
417
427
|
# @api private
|
|
@@ -374,11 +374,12 @@ module OpenAI
|
|
|
374
374
|
params(
|
|
375
375
|
headers: T::Hash[String, String],
|
|
376
376
|
stream: T::Enumerable[String],
|
|
377
|
-
suppress_error: T::Boolean
|
|
377
|
+
suppress_error: T::Boolean,
|
|
378
|
+
body_observer: T.nilable(T.proc.params(body: String).void)
|
|
378
379
|
)
|
|
379
380
|
.returns(T.anything)
|
|
380
381
|
end
|
|
381
|
-
def decode_content(headers, stream:, suppress_error: false)
|
|
382
|
+
def decode_content(headers, stream:, suppress_error: false, &body_observer)
|
|
382
383
|
end
|
|
383
384
|
end
|
|
384
385
|
|
|
@@ -591,6 +591,14 @@ module OpenAI
|
|
|
591
591
|
:"tenant.project_api_key.created",
|
|
592
592
|
OpenAI::Admin::Organization::AuditLogListParams::EventType::TaggedSymbol
|
|
593
593
|
)
|
|
594
|
+
TENANT_TRUSTED_ACCESS_BUSINESS_VERIFICATION_STARTED = T.let(
|
|
595
|
+
:"tenant.trusted_access.business_verification.started",
|
|
596
|
+
OpenAI::Admin::Organization::AuditLogListParams::EventType::TaggedSymbol
|
|
597
|
+
)
|
|
598
|
+
TENANT_TRUSTED_ACCESS_APPLICATION_SUBMITTED = T.let(
|
|
599
|
+
:"tenant.trusted_access.application.submitted",
|
|
600
|
+
OpenAI::Admin::Organization::AuditLogListParams::EventType::TaggedSymbol
|
|
601
|
+
)
|
|
594
602
|
TENANT_CHATGPT_ACCESS_TOKEN_REVOKED = T.let(
|
|
595
603
|
:"tenant.chatgpt_access_token.revoked",
|
|
596
604
|
OpenAI::Admin::Organization::AuditLogListParams::EventType::TaggedSymbol
|
|
@@ -1369,6 +1369,14 @@ module OpenAI
|
|
|
1369
1369
|
:"tenant.project_api_key.created",
|
|
1370
1370
|
OpenAI::Models::Admin::Organization::AuditLogListResponse::Type::TaggedSymbol
|
|
1371
1371
|
)
|
|
1372
|
+
TENANT_TRUSTED_ACCESS_BUSINESS_VERIFICATION_STARTED = T.let(
|
|
1373
|
+
:"tenant.trusted_access.business_verification.started",
|
|
1374
|
+
OpenAI::Models::Admin::Organization::AuditLogListResponse::Type::TaggedSymbol
|
|
1375
|
+
)
|
|
1376
|
+
TENANT_TRUSTED_ACCESS_APPLICATION_SUBMITTED = T.let(
|
|
1377
|
+
:"tenant.trusted_access.application.submitted",
|
|
1378
|
+
OpenAI::Models::Admin::Organization::AuditLogListResponse::Type::TaggedSymbol
|
|
1379
|
+
)
|
|
1372
1380
|
TENANT_CHATGPT_ACCESS_TOKEN_REVOKED = T.let(
|
|
1373
1381
|
:"tenant.chatgpt_access_token.revoked",
|
|
1374
1382
|
OpenAI::Models::Admin::Organization::AuditLogListResponse::Type::TaggedSymbol
|
|
@@ -42,6 +42,10 @@ module OpenAI
|
|
|
42
42
|
sig { returns(Integer) }
|
|
43
43
|
attr_accessor :total_tokens
|
|
44
44
|
|
|
45
|
+
# Compute units for the request. Currently null when available.
|
|
46
|
+
sig { returns(T.nilable(Integer)) }
|
|
47
|
+
attr_accessor :compute_units
|
|
48
|
+
|
|
45
49
|
# Represents token usage details including input tokens, output tokens, a
|
|
46
50
|
# breakdown of output tokens, and the total tokens used.
|
|
47
51
|
sig do
|
|
@@ -55,7 +59,9 @@ module OpenAI
|
|
|
55
59
|
|
|
56
60
|
output_tokens_details: OpenAI::Beta::BetaResponseUsage::OutputTokensDetails::OrHash,
|
|
57
61
|
|
|
58
|
-
total_tokens: Integer
|
|
62
|
+
total_tokens: Integer,
|
|
63
|
+
|
|
64
|
+
compute_units: T.nilable(Integer)
|
|
59
65
|
)
|
|
60
66
|
.returns(T.attached_class)
|
|
61
67
|
end
|
|
@@ -74,8 +80,11 @@ module OpenAI
|
|
|
74
80
|
output_tokens_details:,
|
|
75
81
|
|
|
76
82
|
# The total number of tokens used.
|
|
83
|
+
total_tokens:,
|
|
84
|
+
|
|
85
|
+
# Compute units for the request. Currently null when available.
|
|
77
86
|
|
|
78
|
-
|
|
87
|
+
compute_units: nil
|
|
79
88
|
)
|
|
80
89
|
end
|
|
81
90
|
|
|
@@ -86,7 +95,8 @@ module OpenAI
|
|
|
86
95
|
input_tokens_details: OpenAI::Beta::BetaResponseUsage::InputTokensDetails,
|
|
87
96
|
output_tokens: Integer,
|
|
88
97
|
output_tokens_details: OpenAI::Beta::BetaResponseUsage::OutputTokensDetails,
|
|
89
|
-
total_tokens: Integer
|
|
98
|
+
total_tokens: Integer,
|
|
99
|
+
compute_units: T.nilable(Integer)
|
|
90
100
|
}
|
|
91
101
|
)
|
|
92
102
|
end
|
|
@@ -31,6 +31,10 @@ module OpenAI
|
|
|
31
31
|
sig { params(completion_tokens_details: OpenAI::CompletionUsage::CompletionTokensDetails::OrHash).void }
|
|
32
32
|
attr_writer :completion_tokens_details
|
|
33
33
|
|
|
34
|
+
# Compute units for the request. Currently null when available.
|
|
35
|
+
sig { returns(T.nilable(Integer)) }
|
|
36
|
+
attr_accessor :compute_units
|
|
37
|
+
|
|
34
38
|
# Breakdown of tokens used in the prompt.
|
|
35
39
|
sig { returns(T.nilable(OpenAI::CompletionUsage::PromptTokensDetails)) }
|
|
36
40
|
attr_reader :prompt_tokens_details
|
|
@@ -50,6 +54,8 @@ module OpenAI
|
|
|
50
54
|
|
|
51
55
|
completion_tokens_details: OpenAI::CompletionUsage::CompletionTokensDetails::OrHash,
|
|
52
56
|
|
|
57
|
+
compute_units: T.nilable(Integer),
|
|
58
|
+
|
|
53
59
|
prompt_tokens_details: OpenAI::CompletionUsage::PromptTokensDetails::OrHash
|
|
54
60
|
)
|
|
55
61
|
.returns(T.attached_class)
|
|
@@ -68,6 +74,9 @@ module OpenAI
|
|
|
68
74
|
# Breakdown of tokens used in a completion.
|
|
69
75
|
completion_tokens_details: nil,
|
|
70
76
|
|
|
77
|
+
# Compute units for the request. Currently null when available.
|
|
78
|
+
compute_units: nil,
|
|
79
|
+
|
|
71
80
|
# Breakdown of tokens used in the prompt.
|
|
72
81
|
|
|
73
82
|
prompt_tokens_details: nil
|
|
@@ -81,6 +90,7 @@ module OpenAI
|
|
|
81
90
|
prompt_tokens: Integer,
|
|
82
91
|
total_tokens: Integer,
|
|
83
92
|
completion_tokens_details: OpenAI::CompletionUsage::CompletionTokensDetails,
|
|
93
|
+
compute_units: T.nilable(Integer),
|
|
84
94
|
prompt_tokens_details: OpenAI::CompletionUsage::PromptTokensDetails
|
|
85
95
|
}
|
|
86
96
|
)
|
|
@@ -40,6 +40,10 @@ module OpenAI
|
|
|
40
40
|
sig { returns(Integer) }
|
|
41
41
|
attr_accessor :total_tokens
|
|
42
42
|
|
|
43
|
+
# Compute units for the request. Currently null when available.
|
|
44
|
+
sig { returns(T.nilable(Integer)) }
|
|
45
|
+
attr_accessor :compute_units
|
|
46
|
+
|
|
43
47
|
# Represents token usage details including input tokens, output tokens, a
|
|
44
48
|
# breakdown of output tokens, and the total tokens used.
|
|
45
49
|
sig do
|
|
@@ -53,7 +57,9 @@ module OpenAI
|
|
|
53
57
|
|
|
54
58
|
output_tokens_details: OpenAI::Responses::ResponseUsage::OutputTokensDetails::OrHash,
|
|
55
59
|
|
|
56
|
-
total_tokens: Integer
|
|
60
|
+
total_tokens: Integer,
|
|
61
|
+
|
|
62
|
+
compute_units: T.nilable(Integer)
|
|
57
63
|
)
|
|
58
64
|
.returns(T.attached_class)
|
|
59
65
|
end
|
|
@@ -72,8 +78,11 @@ module OpenAI
|
|
|
72
78
|
output_tokens_details:,
|
|
73
79
|
|
|
74
80
|
# The total number of tokens used.
|
|
81
|
+
total_tokens:,
|
|
82
|
+
|
|
83
|
+
# Compute units for the request. Currently null when available.
|
|
75
84
|
|
|
76
|
-
|
|
85
|
+
compute_units: nil
|
|
77
86
|
)
|
|
78
87
|
end
|
|
79
88
|
|
|
@@ -84,7 +93,8 @@ module OpenAI
|
|
|
84
93
|
input_tokens_details: OpenAI::Responses::ResponseUsage::InputTokensDetails,
|
|
85
94
|
output_tokens: Integer,
|
|
86
95
|
output_tokens_details: OpenAI::Responses::ResponseUsage::OutputTokensDetails,
|
|
87
|
-
total_tokens: Integer
|
|
96
|
+
total_tokens: Integer,
|
|
97
|
+
compute_units: T.nilable(Integer)
|
|
88
98
|
}
|
|
89
99
|
)
|
|
90
100
|
end
|
|
@@ -47,6 +47,10 @@ module OpenAI
|
|
|
47
47
|
sig { returns(T.nilable(Float)) }
|
|
48
48
|
attr_accessor :timeout
|
|
49
49
|
|
|
50
|
+
# Retain the exact successful response body on `last_response.body`.
|
|
51
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
52
|
+
attr_accessor :include_raw_body
|
|
53
|
+
|
|
50
54
|
# Returns a new instance of RequestOptions.
|
|
51
55
|
sig { params(values: OpenAI::Internal::AnyHash).returns(T.attached_class) }
|
|
52
56
|
def self.new(values = {})
|
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,
|
|
@@ -174,7 +174,13 @@ module OpenAI
|
|
|
174
174
|
|
|
175
175
|
private def perform_request: (
|
|
176
176
|
OpenAI::Internal::Transport::BaseClient::request_components req
|
|
177
|
-
)
|
|
177
|
+
) ?{
|
|
178
|
+
(
|
|
179
|
+
OpenAI::HTTPClient::Response response,
|
|
180
|
+
URI::Generic url,
|
|
181
|
+
URI::Generic response_url
|
|
182
|
+
) -> void
|
|
183
|
+
} -> [URI::Generic, OpenAI::HTTPClient::Response, OpenAI::Internal::Logging::Context]
|
|
178
184
|
|
|
179
185
|
private def finish_request: (
|
|
180
186
|
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"
|
|
@@ -9,7 +9,8 @@ module OpenAI
|
|
|
9
9
|
input_tokens_details: OpenAI::Beta::BetaResponseUsage::InputTokensDetails,
|
|
10
10
|
output_tokens: Integer,
|
|
11
11
|
output_tokens_details: OpenAI::Beta::BetaResponseUsage::OutputTokensDetails,
|
|
12
|
-
total_tokens: Integer
|
|
12
|
+
total_tokens: Integer,
|
|
13
|
+
compute_units: Integer?
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
class BetaResponseUsage < OpenAI::Internal::Type::BaseModel
|
|
@@ -23,12 +24,15 @@ module OpenAI
|
|
|
23
24
|
|
|
24
25
|
attr_accessor total_tokens: Integer
|
|
25
26
|
|
|
27
|
+
attr_accessor compute_units: Integer?
|
|
28
|
+
|
|
26
29
|
def initialize: (
|
|
27
30
|
input_tokens: Integer,
|
|
28
31
|
input_tokens_details: OpenAI::Beta::BetaResponseUsage::InputTokensDetails,
|
|
29
32
|
output_tokens: Integer,
|
|
30
33
|
output_tokens_details: OpenAI::Beta::BetaResponseUsage::OutputTokensDetails,
|
|
31
|
-
total_tokens: Integer
|
|
34
|
+
total_tokens: Integer,
|
|
35
|
+
?compute_units: Integer?
|
|
32
36
|
) -> void
|
|
33
37
|
|
|
34
38
|
def to_hash: -> {
|
|
@@ -36,7 +40,8 @@ module OpenAI
|
|
|
36
40
|
input_tokens_details: OpenAI::Beta::BetaResponseUsage::InputTokensDetails,
|
|
37
41
|
output_tokens: Integer,
|
|
38
42
|
output_tokens_details: OpenAI::Beta::BetaResponseUsage::OutputTokensDetails,
|
|
39
|
-
total_tokens: Integer
|
|
43
|
+
total_tokens: Integer,
|
|
44
|
+
compute_units: Integer?
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
type input_tokens_details =
|
|
@@ -6,6 +6,7 @@ module OpenAI
|
|
|
6
6
|
prompt_tokens: Integer,
|
|
7
7
|
total_tokens: Integer,
|
|
8
8
|
completion_tokens_details: OpenAI::CompletionUsage::CompletionTokensDetails,
|
|
9
|
+
compute_units: Integer?,
|
|
9
10
|
prompt_tokens_details: OpenAI::CompletionUsage::PromptTokensDetails
|
|
10
11
|
}
|
|
11
12
|
|
|
@@ -22,6 +23,8 @@ module OpenAI
|
|
|
22
23
|
OpenAI::CompletionUsage::CompletionTokensDetails
|
|
23
24
|
) -> OpenAI::CompletionUsage::CompletionTokensDetails
|
|
24
25
|
|
|
26
|
+
attr_accessor compute_units: Integer?
|
|
27
|
+
|
|
25
28
|
attr_reader prompt_tokens_details: OpenAI::CompletionUsage::PromptTokensDetails?
|
|
26
29
|
|
|
27
30
|
def prompt_tokens_details=: (
|
|
@@ -33,6 +36,7 @@ module OpenAI
|
|
|
33
36
|
prompt_tokens: Integer,
|
|
34
37
|
total_tokens: Integer,
|
|
35
38
|
?completion_tokens_details: OpenAI::CompletionUsage::CompletionTokensDetails,
|
|
39
|
+
?compute_units: Integer?,
|
|
36
40
|
?prompt_tokens_details: OpenAI::CompletionUsage::PromptTokensDetails
|
|
37
41
|
) -> void
|
|
38
42
|
|
|
@@ -41,6 +45,7 @@ module OpenAI
|
|
|
41
45
|
prompt_tokens: Integer,
|
|
42
46
|
total_tokens: Integer,
|
|
43
47
|
completion_tokens_details: OpenAI::CompletionUsage::CompletionTokensDetails,
|
|
48
|
+
compute_units: Integer?,
|
|
44
49
|
prompt_tokens_details: OpenAI::CompletionUsage::PromptTokensDetails
|
|
45
50
|
}
|
|
46
51
|
|
|
@@ -7,7 +7,8 @@ module OpenAI
|
|
|
7
7
|
input_tokens_details: OpenAI::Responses::ResponseUsage::InputTokensDetails,
|
|
8
8
|
output_tokens: Integer,
|
|
9
9
|
output_tokens_details: OpenAI::Responses::ResponseUsage::OutputTokensDetails,
|
|
10
|
-
total_tokens: Integer
|
|
10
|
+
total_tokens: Integer,
|
|
11
|
+
compute_units: Integer?
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
class ResponseUsage < OpenAI::Internal::Type::BaseModel
|
|
@@ -21,12 +22,15 @@ module OpenAI
|
|
|
21
22
|
|
|
22
23
|
attr_accessor total_tokens: Integer
|
|
23
24
|
|
|
25
|
+
attr_accessor compute_units: Integer?
|
|
26
|
+
|
|
24
27
|
def initialize: (
|
|
25
28
|
input_tokens: Integer,
|
|
26
29
|
input_tokens_details: OpenAI::Responses::ResponseUsage::InputTokensDetails,
|
|
27
30
|
output_tokens: Integer,
|
|
28
31
|
output_tokens_details: OpenAI::Responses::ResponseUsage::OutputTokensDetails,
|
|
29
|
-
total_tokens: Integer
|
|
32
|
+
total_tokens: Integer,
|
|
33
|
+
?compute_units: Integer?
|
|
30
34
|
) -> void
|
|
31
35
|
|
|
32
36
|
def to_hash: -> {
|
|
@@ -34,7 +38,8 @@ module OpenAI
|
|
|
34
38
|
input_tokens_details: OpenAI::Responses::ResponseUsage::InputTokensDetails,
|
|
35
39
|
output_tokens: Integer,
|
|
36
40
|
output_tokens_details: OpenAI::Responses::ResponseUsage::OutputTokensDetails,
|
|
37
|
-
total_tokens: Integer
|
|
41
|
+
total_tokens: Integer,
|
|
42
|
+
compute_units: Integer?
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
type input_tokens_details =
|
|
@@ -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
|