openai 0.23.3 → 0.24.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 +9 -0
- data/README.md +1 -1
- data/lib/openai/errors.rb +25 -11
- data/lib/openai/internal/conversation_cursor_page.rb +1 -1
- data/lib/openai/internal/cursor_page.rb +1 -1
- data/lib/openai/internal/page.rb +1 -1
- data/lib/openai/internal/stream.rb +1 -0
- data/lib/openai/internal/transport/base_client.rb +11 -7
- data/lib/openai/internal/type/base_page.rb +1 -1
- data/lib/openai/internal/type/base_stream.rb +9 -1
- data/lib/openai/internal/util.rb +1 -1
- data/lib/openai/models/conversations/computer_screenshot_content.rb +2 -0
- data/lib/openai/models/conversations/conversation_item.rb +1 -0
- data/lib/openai/models/conversations/input_file_content.rb +1 -34
- data/lib/openai/models/conversations/input_image_content.rb +1 -54
- data/lib/openai/models/conversations/input_text_content.rb +1 -18
- data/lib/openai/models/conversations/message.rb +19 -8
- data/lib/openai/models/conversations/output_text_content.rb +1 -49
- data/lib/openai/models/conversations/refusal_content.rb +1 -18
- data/lib/openai/models/conversations/summary_text_content.rb +2 -0
- data/lib/openai/models/conversations/text_content.rb +2 -0
- data/lib/openai/models/evals/create_eval_completions_run_data_source.rb +13 -1
- data/lib/openai/models/evals/run_cancel_response.rb +13 -1
- data/lib/openai/models/evals/run_create_params.rb +13 -1
- data/lib/openai/models/evals/run_create_response.rb +13 -1
- data/lib/openai/models/evals/run_list_response.rb +13 -1
- data/lib/openai/models/evals/run_retrieve_response.rb +13 -1
- data/lib/openai/models/evals/runs/output_item_list_response.rb +49 -4
- data/lib/openai/models/evals/runs/output_item_retrieve_response.rb +49 -4
- data/lib/openai/models/graders/score_model_grader.rb +56 -3
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +5 -10
- data/rbi/openai/errors.rbi +29 -2
- data/rbi/openai/internal/transport/base_client.rbi +4 -5
- data/rbi/openai/internal/type/base_page.rbi +1 -1
- data/rbi/openai/internal/type/base_stream.rbi +16 -1
- data/rbi/openai/internal/util.rbi +1 -1
- data/rbi/openai/models/conversations/computer_screenshot_content.rbi +1 -0
- data/rbi/openai/models/conversations/input_file_content.rbi +1 -64
- data/rbi/openai/models/conversations/input_image_content.rbi +1 -105
- data/rbi/openai/models/conversations/input_text_content.rbi +1 -30
- data/rbi/openai/models/conversations/message.rbi +12 -10
- data/rbi/openai/models/conversations/output_text_content.rbi +1 -102
- data/rbi/openai/models/conversations/refusal_content.rbi +1 -30
- data/rbi/openai/models/conversations/summary_text_content.rbi +1 -0
- data/rbi/openai/models/conversations/text_content.rbi +1 -0
- data/rbi/openai/models/evals/create_eval_completions_run_data_source.rbi +16 -0
- data/rbi/openai/models/evals/run_cancel_response.rbi +18 -0
- data/rbi/openai/models/evals/run_create_params.rbi +18 -0
- data/rbi/openai/models/evals/run_create_response.rbi +18 -0
- data/rbi/openai/models/evals/run_list_response.rbi +18 -0
- data/rbi/openai/models/evals/run_retrieve_response.rbi +18 -0
- data/rbi/openai/models/evals/runs/output_item_list_response.rbi +88 -5
- data/rbi/openai/models/evals/runs/output_item_retrieve_response.rbi +88 -5
- data/rbi/openai/models/graders/score_model_grader.rbi +88 -4
- data/sig/openai/errors.rbs +7 -0
- data/sig/openai/internal/type/base_stream.rbs +5 -0
- data/sig/openai/models/conversations/input_file_content.rbs +1 -35
- data/sig/openai/models/conversations/input_image_content.rbs +1 -43
- data/sig/openai/models/conversations/input_text_content.rbs +1 -11
- data/sig/openai/models/conversations/message.rbs +5 -5
- data/sig/openai/models/conversations/output_text_content.rbs +1 -46
- data/sig/openai/models/conversations/refusal_content.rbs +1 -11
- data/sig/openai/models/evals/create_eval_completions_run_data_source.rbs +5 -0
- data/sig/openai/models/evals/run_cancel_response.rbs +5 -0
- data/sig/openai/models/evals/run_create_params.rbs +5 -0
- data/sig/openai/models/evals/run_create_response.rbs +5 -0
- data/sig/openai/models/evals/run_list_response.rbs +5 -0
- data/sig/openai/models/evals/run_retrieve_response.rbs +5 -0
- data/sig/openai/models/evals/runs/output_item_list_response.rbs +43 -4
- data/sig/openai/models/evals/runs/output_item_retrieve_response.rbs +43 -4
- data/sig/openai/models/graders/score_model_grader.rbs +44 -5
- metadata +2 -17
- data/lib/openai/models/conversations/container_file_citation_body.rb +0 -58
- data/lib/openai/models/conversations/file_citation_body.rb +0 -42
- data/lib/openai/models/conversations/lob_prob.rb +0 -35
- data/lib/openai/models/conversations/top_log_prob.rb +0 -29
- data/lib/openai/models/conversations/url_citation_body.rb +0 -50
- data/rbi/openai/models/conversations/container_file_citation_body.rbi +0 -82
- data/rbi/openai/models/conversations/file_citation_body.rbi +0 -61
- data/rbi/openai/models/conversations/lob_prob.rbi +0 -50
- data/rbi/openai/models/conversations/top_log_prob.rbi +0 -41
- data/rbi/openai/models/conversations/url_citation_body.rbi +0 -74
- data/sig/openai/models/conversations/container_file_citation_body.rbs +0 -47
- data/sig/openai/models/conversations/file_citation_body.rbs +0 -37
- data/sig/openai/models/conversations/lob_prob.rbs +0 -37
- data/sig/openai/models/conversations/top_log_prob.rbs +0 -28
- data/sig/openai/models/conversations/url_citation_body.rbs +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9739da617fa34b8a5add655141558b5f984fa8c349236cf521605e748024cdb
|
4
|
+
data.tar.gz: 44064a7817af7fc80e2e9e7bf5bb1df722472d074cfc9daa3abb6ae3f877f25d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4067c143f59520175c9273966544511a35bb76690fa6685ee5292084714a3b81737ae0e8e689ce0294393ec57d3bfe355baf41159a0ba57a3e44908aef47618b
|
7
|
+
data.tar.gz: 86f95667cf0b219500e4a90480a4b81a1daa781dbf2239db5bade3604208e45fcca9ed6cdd25428a5f76956884548c9a01c9bc2d5f5da0f71f4f5453857d10c1
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.24.0 (2025-09-17)
|
4
|
+
|
5
|
+
Full Changelog: [v0.23.3...v0.24.0](https://github.com/openai/openai-ruby/compare/v0.23.3...v0.24.0)
|
6
|
+
|
7
|
+
### Features
|
8
|
+
|
9
|
+
* **api:** type updates for conversations, reasoning_effort and results for evals ([ee17642](https://github.com/openai/openai-ruby/commit/ee17642d7319dacb933a41ae9f1edae2a200762f))
|
10
|
+
* expose response headers for both streams and errors ([a158fd6](https://github.com/openai/openai-ruby/commit/a158fd66b22a5586f4a45301ff96e40f8d52fe8c))
|
11
|
+
|
3
12
|
## 0.23.3 (2025-09-15)
|
4
13
|
|
5
14
|
Full Changelog: [v0.23.2...v0.23.3](https://github.com/openai/openai-ruby/compare/v0.23.2...v0.23.3)
|
data/README.md
CHANGED
data/lib/openai/errors.rb
CHANGED
@@ -43,6 +43,9 @@ module OpenAI
|
|
43
43
|
# @return [Integer, nil]
|
44
44
|
attr_accessor :status
|
45
45
|
|
46
|
+
# @return [Hash{String=>String}, nil]
|
47
|
+
attr_accessor :headers
|
48
|
+
|
46
49
|
# @return [Object, nil]
|
47
50
|
attr_accessor :body
|
48
51
|
|
@@ -59,13 +62,15 @@ module OpenAI
|
|
59
62
|
#
|
60
63
|
# @param url [URI::Generic]
|
61
64
|
# @param status [Integer, nil]
|
65
|
+
# @param headers [Hash{String=>String}, nil]
|
62
66
|
# @param body [Object, nil]
|
63
67
|
# @param request [nil]
|
64
68
|
# @param response [nil]
|
65
69
|
# @param message [String, nil]
|
66
|
-
def initialize(url:, status: nil, body: nil, request: nil, response: nil, message: nil)
|
70
|
+
def initialize(url:, status: nil, headers: nil, body: nil, request: nil, response: nil, message: nil)
|
67
71
|
@url = url
|
68
72
|
@status = status
|
73
|
+
@headers = headers
|
69
74
|
@body = body
|
70
75
|
@request = request
|
71
76
|
@response = response
|
@@ -98,6 +103,7 @@ module OpenAI
|
|
98
103
|
#
|
99
104
|
# @param url [URI::Generic]
|
100
105
|
# @param status [nil]
|
106
|
+
# @param headers [Hash{String=>String}, nil]
|
101
107
|
# @param body [nil]
|
102
108
|
# @param request [nil]
|
103
109
|
# @param response [nil]
|
@@ -105,6 +111,7 @@ module OpenAI
|
|
105
111
|
def initialize(
|
106
112
|
url:,
|
107
113
|
status: nil,
|
114
|
+
headers: nil,
|
108
115
|
body: nil,
|
109
116
|
request: nil,
|
110
117
|
response: nil,
|
@@ -119,6 +126,7 @@ module OpenAI
|
|
119
126
|
#
|
120
127
|
# @param url [URI::Generic]
|
121
128
|
# @param status [nil]
|
129
|
+
# @param headers [Hash{String=>String}, nil]
|
122
130
|
# @param body [nil]
|
123
131
|
# @param request [nil]
|
124
132
|
# @param response [nil]
|
@@ -126,6 +134,7 @@ module OpenAI
|
|
126
134
|
def initialize(
|
127
135
|
url:,
|
128
136
|
status: nil,
|
137
|
+
headers: nil,
|
129
138
|
body: nil,
|
130
139
|
request: nil,
|
131
140
|
response: nil,
|
@@ -140,21 +149,24 @@ module OpenAI
|
|
140
149
|
#
|
141
150
|
# @param url [URI::Generic]
|
142
151
|
# @param status [Integer]
|
152
|
+
# @param headers [Hash{String=>String}, nil]
|
143
153
|
# @param body [Object, nil]
|
144
154
|
# @param request [nil]
|
145
155
|
# @param response [nil]
|
146
156
|
# @param message [String, nil]
|
147
157
|
#
|
148
158
|
# @return [self]
|
149
|
-
def self.for(url:, status:, body:, request:, response:, message: nil)
|
150
|
-
kwargs =
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
159
|
+
def self.for(url:, status:, headers:, body:, request:, response:, message: nil)
|
160
|
+
kwargs =
|
161
|
+
{
|
162
|
+
url: url,
|
163
|
+
status: status,
|
164
|
+
headers: headers,
|
165
|
+
body: body,
|
166
|
+
request: request,
|
167
|
+
response: response,
|
168
|
+
message: message
|
169
|
+
}
|
158
170
|
|
159
171
|
case status
|
160
172
|
in 400
|
@@ -198,11 +210,12 @@ module OpenAI
|
|
198
210
|
#
|
199
211
|
# @param url [URI::Generic]
|
200
212
|
# @param status [Integer]
|
213
|
+
# @param headers [Hash{String=>String}, nil]
|
201
214
|
# @param body [Object, nil]
|
202
215
|
# @param request [nil]
|
203
216
|
# @param response [nil]
|
204
217
|
# @param message [String, nil]
|
205
|
-
def initialize(url:, status:, body:, request:, response:, message: nil)
|
218
|
+
def initialize(url:, status:, headers:, body:, request:, response:, message: nil)
|
206
219
|
message ||= OpenAI::Internal::Util.dig(body, :message) { {url: url.to_s, status: status, body: body} }
|
207
220
|
@code = OpenAI::Internal::Type::Converter.coerce(String, OpenAI::Internal::Util.dig(body, :code))
|
208
221
|
@param = OpenAI::Internal::Type::Converter.coerce(String, OpenAI::Internal::Util.dig(body, :param))
|
@@ -210,6 +223,7 @@ module OpenAI
|
|
210
223
|
super(
|
211
224
|
url: url,
|
212
225
|
status: status,
|
226
|
+
headers: headers,
|
213
227
|
body: body,
|
214
228
|
request: request,
|
215
229
|
response: response,
|
@@ -63,7 +63,7 @@ module OpenAI
|
|
63
63
|
#
|
64
64
|
# @param client [OpenAI::Internal::Transport::BaseClient]
|
65
65
|
# @param req [Hash{Symbol=>Object}]
|
66
|
-
# @param headers [Hash{String=>String}
|
66
|
+
# @param headers [Hash{String=>String}]
|
67
67
|
# @param page_data [Hash{Symbol=>Object}]
|
68
68
|
def initialize(client:, req:, headers:, page_data:)
|
69
69
|
super
|
@@ -60,7 +60,7 @@ module OpenAI
|
|
60
60
|
#
|
61
61
|
# @param client [OpenAI::Internal::Transport::BaseClient]
|
62
62
|
# @param req [Hash{Symbol=>Object}]
|
63
|
-
# @param headers [Hash{String=>String}
|
63
|
+
# @param headers [Hash{String=>String}]
|
64
64
|
# @param page_data [Hash{Symbol=>Object}]
|
65
65
|
def initialize(client:, req:, headers:, page_data:)
|
66
66
|
super
|
data/lib/openai/internal/page.rb
CHANGED
@@ -54,7 +54,7 @@ module OpenAI
|
|
54
54
|
#
|
55
55
|
# @param client [OpenAI::Internal::Transport::BaseClient]
|
56
56
|
# @param req [Hash{Symbol=>Object}]
|
57
|
-
# @param headers [Hash{String=>String}
|
57
|
+
# @param headers [Hash{String=>String}]
|
58
58
|
# @param page_data [Array<Object>]
|
59
59
|
def initialize(client:, req:, headers:, page_data:)
|
60
60
|
super
|
@@ -47,7 +47,7 @@ module OpenAI
|
|
47
47
|
# @api private
|
48
48
|
#
|
49
49
|
# @param status [Integer]
|
50
|
-
# @param headers [Hash{String=>String}
|
50
|
+
# @param headers [Hash{String=>String}]
|
51
51
|
#
|
52
52
|
# @return [Boolean]
|
53
53
|
def should_retry?(status, headers:)
|
@@ -85,7 +85,7 @@ module OpenAI
|
|
85
85
|
#
|
86
86
|
# @param status [Integer]
|
87
87
|
#
|
88
|
-
# @param response_headers [Hash{String=>String}
|
88
|
+
# @param response_headers [Hash{String=>String}]
|
89
89
|
#
|
90
90
|
# @return [Hash{Symbol=>Object}]
|
91
91
|
def follow_redirect(request, status:, response_headers:)
|
@@ -378,6 +378,7 @@ module OpenAI
|
|
378
378
|
rescue OpenAI::Errors::APIConnectionError => e
|
379
379
|
status = e
|
380
380
|
end
|
381
|
+
headers = OpenAI::Internal::Util.normalized_headers(response&.each_header&.to_h)
|
381
382
|
|
382
383
|
case status
|
383
384
|
in ..299
|
@@ -390,7 +391,7 @@ module OpenAI
|
|
390
391
|
in 300..399
|
391
392
|
self.class.reap_connection!(status, stream: stream)
|
392
393
|
|
393
|
-
request = self.class.follow_redirect(request, status: status, response_headers:
|
394
|
+
request = self.class.follow_redirect(request, status: status, response_headers: headers)
|
394
395
|
send_request(
|
395
396
|
request,
|
396
397
|
redirect_count: redirect_count + 1,
|
@@ -399,9 +400,9 @@ module OpenAI
|
|
399
400
|
)
|
400
401
|
in OpenAI::Errors::APIConnectionError if retry_count >= max_retries
|
401
402
|
raise status
|
402
|
-
in (400..) if retry_count >= max_retries || !self.class.should_retry?(status, headers:
|
403
|
+
in (400..) if retry_count >= max_retries || !self.class.should_retry?(status, headers: headers)
|
403
404
|
decoded = Kernel.then do
|
404
|
-
OpenAI::Internal::Util.decode_content(
|
405
|
+
OpenAI::Internal::Util.decode_content(headers, stream: stream, suppress_error: true)
|
405
406
|
ensure
|
406
407
|
self.class.reap_connection!(status, stream: stream)
|
407
408
|
end
|
@@ -409,6 +410,7 @@ module OpenAI
|
|
409
410
|
raise OpenAI::Errors::APIStatusError.for(
|
410
411
|
url: url,
|
411
412
|
status: status,
|
413
|
+
headers: headers,
|
412
414
|
body: decoded,
|
413
415
|
request: nil,
|
414
416
|
response: response
|
@@ -485,19 +487,21 @@ module OpenAI
|
|
485
487
|
send_retry_header: send_retry_header
|
486
488
|
)
|
487
489
|
|
488
|
-
|
490
|
+
headers = OpenAI::Internal::Util.normalized_headers(response.each_header.to_h)
|
491
|
+
decoded = OpenAI::Internal::Util.decode_content(headers, stream: stream)
|
489
492
|
case req
|
490
493
|
in {stream: Class => st}
|
491
494
|
st.new(
|
492
495
|
model: model,
|
493
496
|
url: url,
|
494
497
|
status: status,
|
498
|
+
headers: headers,
|
495
499
|
response: response,
|
496
500
|
unwrap: unwrap,
|
497
501
|
stream: decoded
|
498
502
|
)
|
499
503
|
in {page: Class => page}
|
500
|
-
page.new(client: self, req: req, headers:
|
504
|
+
page.new(client: self, req: req, headers: headers, page_data: decoded)
|
501
505
|
else
|
502
506
|
unwrapped = OpenAI::Internal::Util.dig(decoded, unwrap)
|
503
507
|
OpenAI::Internal::Type::Converter.coerce(model, unwrapped)
|
@@ -39,7 +39,7 @@ module OpenAI
|
|
39
39
|
#
|
40
40
|
# @param client [OpenAI::Internal::Transport::BaseClient]
|
41
41
|
# @param req [Hash{Symbol=>Object}]
|
42
|
-
# @param headers [Hash{String=>String}
|
42
|
+
# @param headers [Hash{String=>String}]
|
43
43
|
# @param page_data [Object]
|
44
44
|
def initialize(client:, req:, headers:, page_data:)
|
45
45
|
@client = client
|
@@ -28,6 +28,12 @@ module OpenAI
|
|
28
28
|
def defer_closing(stream) = ->(_id) { OpenAI::Internal::Util.close_fused!(stream) }
|
29
29
|
end
|
30
30
|
|
31
|
+
# @return [Integer]
|
32
|
+
attr_reader :status
|
33
|
+
|
34
|
+
# @return [Hash{String=>String}]
|
35
|
+
attr_reader :headers
|
36
|
+
|
31
37
|
# @api public
|
32
38
|
#
|
33
39
|
# @return [void]
|
@@ -63,13 +69,15 @@ module OpenAI
|
|
63
69
|
# @param model [Class, OpenAI::Internal::Type::Converter]
|
64
70
|
# @param url [URI::Generic]
|
65
71
|
# @param status [Integer]
|
72
|
+
# @param headers [Hash{String=>String}]
|
66
73
|
# @param response [Net::HTTPResponse]
|
67
74
|
# @param unwrap [Symbol, Integer, Array<Symbol, Integer>, Proc]
|
68
75
|
# @param stream [Enumerable<Object>]
|
69
|
-
def initialize(model:, url:, status:, response:, unwrap:, stream:)
|
76
|
+
def initialize(model:, url:, status:, headers:, response:, unwrap:, stream:)
|
70
77
|
@model = model
|
71
78
|
@url = url
|
72
79
|
@status = status
|
80
|
+
@headers = headers
|
73
81
|
@response = response
|
74
82
|
@unwrap = unwrap
|
75
83
|
@stream = stream
|
data/lib/openai/internal/util.rb
CHANGED
@@ -647,7 +647,7 @@ module OpenAI
|
|
647
647
|
#
|
648
648
|
# Assumes each chunk in stream has `Encoding::BINARY`.
|
649
649
|
#
|
650
|
-
# @param headers [Hash{String=>String}
|
650
|
+
# @param headers [Hash{String=>String}]
|
651
651
|
# @param stream [Enumerable<String>]
|
652
652
|
# @param suppress_error [Boolean]
|
653
653
|
#
|
@@ -27,6 +27,8 @@ module OpenAI
|
|
27
27
|
# Some parameter documentations has been truncated, see
|
28
28
|
# {OpenAI::Models::Conversations::ComputerScreenshotContent} for more details.
|
29
29
|
#
|
30
|
+
# A screenshot of a computer.
|
31
|
+
#
|
30
32
|
# @param file_id [String, nil] The identifier of an uploaded file that contains the screenshot.
|
31
33
|
#
|
32
34
|
# @param image_url [String, nil] The URL of the screenshot image.
|
@@ -3,40 +3,7 @@
|
|
3
3
|
module OpenAI
|
4
4
|
module Models
|
5
5
|
module Conversations
|
6
|
-
|
7
|
-
# @!attribute file_id
|
8
|
-
# The ID of the file to be sent to the model.
|
9
|
-
#
|
10
|
-
# @return [String, nil]
|
11
|
-
required :file_id, String, nil?: true
|
12
|
-
|
13
|
-
# @!attribute type
|
14
|
-
# The type of the input item. Always `input_file`.
|
15
|
-
#
|
16
|
-
# @return [Symbol, :input_file]
|
17
|
-
required :type, const: :input_file
|
18
|
-
|
19
|
-
# @!attribute file_url
|
20
|
-
# The URL of the file to be sent to the model.
|
21
|
-
#
|
22
|
-
# @return [String, nil]
|
23
|
-
optional :file_url, String
|
24
|
-
|
25
|
-
# @!attribute filename
|
26
|
-
# The name of the file to be sent to the model.
|
27
|
-
#
|
28
|
-
# @return [String, nil]
|
29
|
-
optional :filename, String
|
30
|
-
|
31
|
-
# @!method initialize(file_id:, file_url: nil, filename: nil, type: :input_file)
|
32
|
-
# @param file_id [String, nil] The ID of the file to be sent to the model.
|
33
|
-
#
|
34
|
-
# @param file_url [String] The URL of the file to be sent to the model.
|
35
|
-
#
|
36
|
-
# @param filename [String] The name of the file to be sent to the model.
|
37
|
-
#
|
38
|
-
# @param type [Symbol, :input_file] The type of the input item. Always `input_file`.
|
39
|
-
end
|
6
|
+
InputFileContent = OpenAI::Models::Responses::ResponseInputFile
|
40
7
|
end
|
41
8
|
end
|
42
9
|
end
|
@@ -3,60 +3,7 @@
|
|
3
3
|
module OpenAI
|
4
4
|
module Models
|
5
5
|
module Conversations
|
6
|
-
|
7
|
-
# @!attribute detail
|
8
|
-
# The detail level of the image to be sent to the model. One of `high`, `low`, or
|
9
|
-
# `auto`. Defaults to `auto`.
|
10
|
-
#
|
11
|
-
# @return [Symbol, OpenAI::Models::Conversations::InputImageContent::Detail]
|
12
|
-
required :detail, enum: -> { OpenAI::Conversations::InputImageContent::Detail }
|
13
|
-
|
14
|
-
# @!attribute file_id
|
15
|
-
# The ID of the file to be sent to the model.
|
16
|
-
#
|
17
|
-
# @return [String, nil]
|
18
|
-
required :file_id, String, nil?: true
|
19
|
-
|
20
|
-
# @!attribute image_url
|
21
|
-
# The URL of the image to be sent to the model. A fully qualified URL or base64
|
22
|
-
# encoded image in a data URL.
|
23
|
-
#
|
24
|
-
# @return [String, nil]
|
25
|
-
required :image_url, String, nil?: true
|
26
|
-
|
27
|
-
# @!attribute type
|
28
|
-
# The type of the input item. Always `input_image`.
|
29
|
-
#
|
30
|
-
# @return [Symbol, :input_image]
|
31
|
-
required :type, const: :input_image
|
32
|
-
|
33
|
-
# @!method initialize(detail:, file_id:, image_url:, type: :input_image)
|
34
|
-
# Some parameter documentations has been truncated, see
|
35
|
-
# {OpenAI::Models::Conversations::InputImageContent} for more details.
|
36
|
-
#
|
37
|
-
# @param detail [Symbol, OpenAI::Models::Conversations::InputImageContent::Detail] The detail level of the image to be sent to the model. One of `high`, `low`, or
|
38
|
-
#
|
39
|
-
# @param file_id [String, nil] The ID of the file to be sent to the model.
|
40
|
-
#
|
41
|
-
# @param image_url [String, nil] The URL of the image to be sent to the model. A fully qualified URL or base64 en
|
42
|
-
#
|
43
|
-
# @param type [Symbol, :input_image] The type of the input item. Always `input_image`.
|
44
|
-
|
45
|
-
# The detail level of the image to be sent to the model. One of `high`, `low`, or
|
46
|
-
# `auto`. Defaults to `auto`.
|
47
|
-
#
|
48
|
-
# @see OpenAI::Models::Conversations::InputImageContent#detail
|
49
|
-
module Detail
|
50
|
-
extend OpenAI::Internal::Type::Enum
|
51
|
-
|
52
|
-
LOW = :low
|
53
|
-
HIGH = :high
|
54
|
-
AUTO = :auto
|
55
|
-
|
56
|
-
# @!method self.values
|
57
|
-
# @return [Array<Symbol>]
|
58
|
-
end
|
59
|
-
end
|
6
|
+
InputImageContent = OpenAI::Models::Responses::ResponseInputImage
|
60
7
|
end
|
61
8
|
end
|
62
9
|
end
|
@@ -3,24 +3,7 @@
|
|
3
3
|
module OpenAI
|
4
4
|
module Models
|
5
5
|
module Conversations
|
6
|
-
|
7
|
-
# @!attribute text
|
8
|
-
# The text input to the model.
|
9
|
-
#
|
10
|
-
# @return [String]
|
11
|
-
required :text, String
|
12
|
-
|
13
|
-
# @!attribute type
|
14
|
-
# The type of the input item. Always `input_text`.
|
15
|
-
#
|
16
|
-
# @return [Symbol, :input_text]
|
17
|
-
required :type, const: :input_text
|
18
|
-
|
19
|
-
# @!method initialize(text:, type: :input_text)
|
20
|
-
# @param text [String] The text input to the model.
|
21
|
-
#
|
22
|
-
# @param type [Symbol, :input_text] The type of the input item. Always `input_text`.
|
23
|
-
end
|
6
|
+
InputTextContent = OpenAI::Models::Responses::ResponseInputText
|
24
7
|
end
|
25
8
|
end
|
26
9
|
end
|
@@ -13,7 +13,7 @@ module OpenAI
|
|
13
13
|
# @!attribute content
|
14
14
|
# The content of the message
|
15
15
|
#
|
16
|
-
# @return [Array<OpenAI::Models::
|
16
|
+
# @return [Array<OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Responses::ResponseOutputText, OpenAI::Models::Conversations::TextContent, OpenAI::Models::Conversations::SummaryTextContent, OpenAI::Models::Responses::ResponseOutputRefusal, OpenAI::Models::Responses::ResponseInputImage, OpenAI::Models::Conversations::ComputerScreenshotContent, OpenAI::Models::Responses::ResponseInputFile>]
|
17
17
|
required :content, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Conversations::Message::Content] }
|
18
18
|
|
19
19
|
# @!attribute role
|
@@ -40,9 +40,11 @@ module OpenAI
|
|
40
40
|
# Some parameter documentations has been truncated, see
|
41
41
|
# {OpenAI::Models::Conversations::Message} for more details.
|
42
42
|
#
|
43
|
+
# A message to or from the model.
|
44
|
+
#
|
43
45
|
# @param id [String] The unique ID of the message.
|
44
46
|
#
|
45
|
-
# @param content [Array<OpenAI::Models::
|
47
|
+
# @param content [Array<OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Responses::ResponseOutputText, OpenAI::Models::Conversations::TextContent, OpenAI::Models::Conversations::SummaryTextContent, OpenAI::Models::Responses::ResponseOutputRefusal, OpenAI::Models::Responses::ResponseInputImage, OpenAI::Models::Conversations::ComputerScreenshotContent, OpenAI::Models::Responses::ResponseInputFile>] The content of the message
|
46
48
|
#
|
47
49
|
# @param role [Symbol, OpenAI::Models::Conversations::Message::Role] The role of the message. One of `unknown`, `user`, `assistant`, `system`, `criti
|
48
50
|
#
|
@@ -50,29 +52,38 @@ module OpenAI
|
|
50
52
|
#
|
51
53
|
# @param type [Symbol, :message] The type of the message. Always set to `message`.
|
52
54
|
|
55
|
+
# A text input to the model.
|
53
56
|
module Content
|
54
57
|
extend OpenAI::Internal::Type::Union
|
55
58
|
|
56
59
|
discriminator :type
|
57
60
|
|
58
|
-
|
61
|
+
# A text input to the model.
|
62
|
+
variant :input_text, -> { OpenAI::Responses::ResponseInputText }
|
59
63
|
|
60
|
-
|
64
|
+
# A text output from the model.
|
65
|
+
variant :output_text, -> { OpenAI::Responses::ResponseOutputText }
|
61
66
|
|
67
|
+
# A text content.
|
62
68
|
variant :text, -> { OpenAI::Conversations::TextContent }
|
63
69
|
|
70
|
+
# A summary text from the model.
|
64
71
|
variant :summary_text, -> { OpenAI::Conversations::SummaryTextContent }
|
65
72
|
|
66
|
-
|
73
|
+
# A refusal from the model.
|
74
|
+
variant :refusal, -> { OpenAI::Responses::ResponseOutputRefusal }
|
67
75
|
|
68
|
-
|
76
|
+
# An image input to the model. Learn about [image inputs](https://platform.openai.com/docs/guides/vision).
|
77
|
+
variant :input_image, -> { OpenAI::Responses::ResponseInputImage }
|
69
78
|
|
79
|
+
# A screenshot of a computer.
|
70
80
|
variant :computer_screenshot, -> { OpenAI::Conversations::ComputerScreenshotContent }
|
71
81
|
|
72
|
-
|
82
|
+
# A file input to the model.
|
83
|
+
variant :input_file, -> { OpenAI::Responses::ResponseInputFile }
|
73
84
|
|
74
85
|
# @!method self.variants
|
75
|
-
# @return [Array(OpenAI::Models::
|
86
|
+
# @return [Array(OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Responses::ResponseOutputText, OpenAI::Models::Conversations::TextContent, OpenAI::Models::Conversations::SummaryTextContent, OpenAI::Models::Responses::ResponseOutputRefusal, OpenAI::Models::Responses::ResponseInputImage, OpenAI::Models::Conversations::ComputerScreenshotContent, OpenAI::Models::Responses::ResponseInputFile)]
|
76
87
|
end
|
77
88
|
|
78
89
|
# The role of the message. One of `unknown`, `user`, `assistant`, `system`,
|
@@ -3,55 +3,7 @@
|
|
3
3
|
module OpenAI
|
4
4
|
module Models
|
5
5
|
module Conversations
|
6
|
-
|
7
|
-
# @!attribute annotations
|
8
|
-
# The annotations of the text output.
|
9
|
-
#
|
10
|
-
# @return [Array<OpenAI::Models::Conversations::FileCitationBody, OpenAI::Models::Conversations::URLCitationBody, OpenAI::Models::Conversations::ContainerFileCitationBody>]
|
11
|
-
required :annotations,
|
12
|
-
-> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Conversations::OutputTextContent::Annotation] }
|
13
|
-
|
14
|
-
# @!attribute text
|
15
|
-
# The text output from the model.
|
16
|
-
#
|
17
|
-
# @return [String]
|
18
|
-
required :text, String
|
19
|
-
|
20
|
-
# @!attribute type
|
21
|
-
# The type of the output text. Always `output_text`.
|
22
|
-
#
|
23
|
-
# @return [Symbol, :output_text]
|
24
|
-
required :type, const: :output_text
|
25
|
-
|
26
|
-
# @!attribute logprobs
|
27
|
-
#
|
28
|
-
# @return [Array<OpenAI::Models::Conversations::LobProb>, nil]
|
29
|
-
optional :logprobs, -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Conversations::LobProb] }
|
30
|
-
|
31
|
-
# @!method initialize(annotations:, text:, logprobs: nil, type: :output_text)
|
32
|
-
# @param annotations [Array<OpenAI::Models::Conversations::FileCitationBody, OpenAI::Models::Conversations::URLCitationBody, OpenAI::Models::Conversations::ContainerFileCitationBody>] The annotations of the text output.
|
33
|
-
#
|
34
|
-
# @param text [String] The text output from the model.
|
35
|
-
#
|
36
|
-
# @param logprobs [Array<OpenAI::Models::Conversations::LobProb>]
|
37
|
-
#
|
38
|
-
# @param type [Symbol, :output_text] The type of the output text. Always `output_text`.
|
39
|
-
|
40
|
-
module Annotation
|
41
|
-
extend OpenAI::Internal::Type::Union
|
42
|
-
|
43
|
-
discriminator :type
|
44
|
-
|
45
|
-
variant :file_citation, -> { OpenAI::Conversations::FileCitationBody }
|
46
|
-
|
47
|
-
variant :url_citation, -> { OpenAI::Conversations::URLCitationBody }
|
48
|
-
|
49
|
-
variant :container_file_citation, -> { OpenAI::Conversations::ContainerFileCitationBody }
|
50
|
-
|
51
|
-
# @!method self.variants
|
52
|
-
# @return [Array(OpenAI::Models::Conversations::FileCitationBody, OpenAI::Models::Conversations::URLCitationBody, OpenAI::Models::Conversations::ContainerFileCitationBody)]
|
53
|
-
end
|
54
|
-
end
|
6
|
+
OutputTextContent = OpenAI::Models::Responses::ResponseOutputText
|
55
7
|
end
|
56
8
|
end
|
57
9
|
end
|
@@ -3,24 +3,7 @@
|
|
3
3
|
module OpenAI
|
4
4
|
module Models
|
5
5
|
module Conversations
|
6
|
-
|
7
|
-
# @!attribute refusal
|
8
|
-
# The refusal explanation from the model.
|
9
|
-
#
|
10
|
-
# @return [String]
|
11
|
-
required :refusal, String
|
12
|
-
|
13
|
-
# @!attribute type
|
14
|
-
# The type of the refusal. Always `refusal`.
|
15
|
-
#
|
16
|
-
# @return [Symbol, :refusal]
|
17
|
-
required :type, const: :refusal
|
18
|
-
|
19
|
-
# @!method initialize(refusal:, type: :refusal)
|
20
|
-
# @param refusal [String] The refusal explanation from the model.
|
21
|
-
#
|
22
|
-
# @param type [Symbol, :refusal] The type of the refusal. Always `refusal`.
|
23
|
-
end
|
6
|
+
RefusalContent = OpenAI::Models::Responses::ResponseOutputRefusal
|
24
7
|
end
|
25
8
|
end
|
26
9
|
end
|