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.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/README.md +1 -1
  4. data/lib/openai/errors.rb +25 -11
  5. data/lib/openai/internal/conversation_cursor_page.rb +1 -1
  6. data/lib/openai/internal/cursor_page.rb +1 -1
  7. data/lib/openai/internal/page.rb +1 -1
  8. data/lib/openai/internal/stream.rb +1 -0
  9. data/lib/openai/internal/transport/base_client.rb +11 -7
  10. data/lib/openai/internal/type/base_page.rb +1 -1
  11. data/lib/openai/internal/type/base_stream.rb +9 -1
  12. data/lib/openai/internal/util.rb +1 -1
  13. data/lib/openai/models/conversations/computer_screenshot_content.rb +2 -0
  14. data/lib/openai/models/conversations/conversation_item.rb +1 -0
  15. data/lib/openai/models/conversations/input_file_content.rb +1 -34
  16. data/lib/openai/models/conversations/input_image_content.rb +1 -54
  17. data/lib/openai/models/conversations/input_text_content.rb +1 -18
  18. data/lib/openai/models/conversations/message.rb +19 -8
  19. data/lib/openai/models/conversations/output_text_content.rb +1 -49
  20. data/lib/openai/models/conversations/refusal_content.rb +1 -18
  21. data/lib/openai/models/conversations/summary_text_content.rb +2 -0
  22. data/lib/openai/models/conversations/text_content.rb +2 -0
  23. data/lib/openai/models/evals/create_eval_completions_run_data_source.rb +13 -1
  24. data/lib/openai/models/evals/run_cancel_response.rb +13 -1
  25. data/lib/openai/models/evals/run_create_params.rb +13 -1
  26. data/lib/openai/models/evals/run_create_response.rb +13 -1
  27. data/lib/openai/models/evals/run_list_response.rb +13 -1
  28. data/lib/openai/models/evals/run_retrieve_response.rb +13 -1
  29. data/lib/openai/models/evals/runs/output_item_list_response.rb +49 -4
  30. data/lib/openai/models/evals/runs/output_item_retrieve_response.rb +49 -4
  31. data/lib/openai/models/graders/score_model_grader.rb +56 -3
  32. data/lib/openai/version.rb +1 -1
  33. data/lib/openai.rb +5 -10
  34. data/rbi/openai/errors.rbi +29 -2
  35. data/rbi/openai/internal/transport/base_client.rbi +4 -5
  36. data/rbi/openai/internal/type/base_page.rbi +1 -1
  37. data/rbi/openai/internal/type/base_stream.rbi +16 -1
  38. data/rbi/openai/internal/util.rbi +1 -1
  39. data/rbi/openai/models/conversations/computer_screenshot_content.rbi +1 -0
  40. data/rbi/openai/models/conversations/input_file_content.rbi +1 -64
  41. data/rbi/openai/models/conversations/input_image_content.rbi +1 -105
  42. data/rbi/openai/models/conversations/input_text_content.rbi +1 -30
  43. data/rbi/openai/models/conversations/message.rbi +12 -10
  44. data/rbi/openai/models/conversations/output_text_content.rbi +1 -102
  45. data/rbi/openai/models/conversations/refusal_content.rbi +1 -30
  46. data/rbi/openai/models/conversations/summary_text_content.rbi +1 -0
  47. data/rbi/openai/models/conversations/text_content.rbi +1 -0
  48. data/rbi/openai/models/evals/create_eval_completions_run_data_source.rbi +16 -0
  49. data/rbi/openai/models/evals/run_cancel_response.rbi +18 -0
  50. data/rbi/openai/models/evals/run_create_params.rbi +18 -0
  51. data/rbi/openai/models/evals/run_create_response.rbi +18 -0
  52. data/rbi/openai/models/evals/run_list_response.rbi +18 -0
  53. data/rbi/openai/models/evals/run_retrieve_response.rbi +18 -0
  54. data/rbi/openai/models/evals/runs/output_item_list_response.rbi +88 -5
  55. data/rbi/openai/models/evals/runs/output_item_retrieve_response.rbi +88 -5
  56. data/rbi/openai/models/graders/score_model_grader.rbi +88 -4
  57. data/sig/openai/errors.rbs +7 -0
  58. data/sig/openai/internal/type/base_stream.rbs +5 -0
  59. data/sig/openai/models/conversations/input_file_content.rbs +1 -35
  60. data/sig/openai/models/conversations/input_image_content.rbs +1 -43
  61. data/sig/openai/models/conversations/input_text_content.rbs +1 -11
  62. data/sig/openai/models/conversations/message.rbs +5 -5
  63. data/sig/openai/models/conversations/output_text_content.rbs +1 -46
  64. data/sig/openai/models/conversations/refusal_content.rbs +1 -11
  65. data/sig/openai/models/evals/create_eval_completions_run_data_source.rbs +5 -0
  66. data/sig/openai/models/evals/run_cancel_response.rbs +5 -0
  67. data/sig/openai/models/evals/run_create_params.rbs +5 -0
  68. data/sig/openai/models/evals/run_create_response.rbs +5 -0
  69. data/sig/openai/models/evals/run_list_response.rbs +5 -0
  70. data/sig/openai/models/evals/run_retrieve_response.rbs +5 -0
  71. data/sig/openai/models/evals/runs/output_item_list_response.rbs +43 -4
  72. data/sig/openai/models/evals/runs/output_item_retrieve_response.rbs +43 -4
  73. data/sig/openai/models/graders/score_model_grader.rbs +44 -5
  74. metadata +2 -17
  75. data/lib/openai/models/conversations/container_file_citation_body.rb +0 -58
  76. data/lib/openai/models/conversations/file_citation_body.rb +0 -42
  77. data/lib/openai/models/conversations/lob_prob.rb +0 -35
  78. data/lib/openai/models/conversations/top_log_prob.rb +0 -29
  79. data/lib/openai/models/conversations/url_citation_body.rb +0 -50
  80. data/rbi/openai/models/conversations/container_file_citation_body.rbi +0 -82
  81. data/rbi/openai/models/conversations/file_citation_body.rbi +0 -61
  82. data/rbi/openai/models/conversations/lob_prob.rbi +0 -50
  83. data/rbi/openai/models/conversations/top_log_prob.rbi +0 -41
  84. data/rbi/openai/models/conversations/url_citation_body.rbi +0 -74
  85. data/sig/openai/models/conversations/container_file_citation_body.rbs +0 -47
  86. data/sig/openai/models/conversations/file_citation_body.rbs +0 -37
  87. data/sig/openai/models/conversations/lob_prob.rbs +0 -37
  88. data/sig/openai/models/conversations/top_log_prob.rbs +0 -28
  89. 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: 78de67c6327d605033609ccd07e0d74abf3435c29fca8a16814e47bb9a3adccb
4
- data.tar.gz: 5acaec7441b93b103201e5b5f9848537f6e61126baaaffaf468073a063970d48
3
+ metadata.gz: b9739da617fa34b8a5add655141558b5f984fa8c349236cf521605e748024cdb
4
+ data.tar.gz: 44064a7817af7fc80e2e9e7bf5bb1df722472d074cfc9daa3abb6ae3f877f25d
5
5
  SHA512:
6
- metadata.gz: 0c3830e5b495692fa49be0fb6f23da597a75f08c376105e98fd7ede52ec06374dbb4e0234739edf2c355f7a76a8e8d77a858dbce211d512f74bddc818717e47e
7
- data.tar.gz: 751b22f53a5176438c4a8ee65a67393860ebecd282b8847fc50b0a9ccfe1c39ecc9940c501cb51f2e67ff8746816ff385f3d2721a527533c02e95ab0cc1eaf2d
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
@@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
15
15
  <!-- x-release-please-start-version -->
16
16
 
17
17
  ```ruby
18
- gem "openai", "~> 0.23.3"
18
+ gem "openai", "~> 0.24.0"
19
19
  ```
20
20
 
21
21
  <!-- x-release-please-end -->
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
- url: url,
152
- status: status,
153
- body: body,
154
- request: request,
155
- response: response,
156
- message: message
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}, Net::HTTPHeader]
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}, Net::HTTPHeader]
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
@@ -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}, Net::HTTPHeader]
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
@@ -41,6 +41,7 @@ module OpenAI
41
41
  err = OpenAI::Errors::APIStatusError.for(
42
42
  url: @url,
43
43
  status: @status,
44
+ headers: @headers,
44
45
  body: data,
45
46
  request: nil,
46
47
  response: @response,
@@ -47,7 +47,7 @@ module OpenAI
47
47
  # @api private
48
48
  #
49
49
  # @param status [Integer]
50
- # @param headers [Hash{String=>String}, Net::HTTPHeader]
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}, Net::HTTPHeader]
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: response)
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: response)
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(response, stream: stream, suppress_error: true)
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
- decoded = OpenAI::Internal::Util.decode_content(response, stream: stream)
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: response, page_data: decoded)
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}, Net::HTTPHeader]
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
@@ -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}, Net::HTTPHeader]
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.
@@ -13,6 +13,7 @@ module OpenAI
13
13
 
14
14
  discriminator :type
15
15
 
16
+ # A message to or from the model.
16
17
  variant :message, -> { OpenAI::Conversations::Message }
17
18
 
18
19
  # A tool call to run a function. See the
@@ -3,40 +3,7 @@
3
3
  module OpenAI
4
4
  module Models
5
5
  module Conversations
6
- class InputFileContent < OpenAI::Internal::Type::BaseModel
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
- class InputImageContent < OpenAI::Internal::Type::BaseModel
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
- class InputTextContent < OpenAI::Internal::Type::BaseModel
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::Conversations::InputTextContent, OpenAI::Models::Conversations::OutputTextContent, OpenAI::Models::Conversations::TextContent, OpenAI::Models::Conversations::SummaryTextContent, OpenAI::Models::Conversations::RefusalContent, OpenAI::Models::Conversations::InputImageContent, OpenAI::Models::Conversations::ComputerScreenshotContent, OpenAI::Models::Conversations::InputFileContent>]
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::Conversations::InputTextContent, OpenAI::Models::Conversations::OutputTextContent, OpenAI::Models::Conversations::TextContent, OpenAI::Models::Conversations::SummaryTextContent, OpenAI::Models::Conversations::RefusalContent, OpenAI::Models::Conversations::InputImageContent, OpenAI::Models::Conversations::ComputerScreenshotContent, OpenAI::Models::Conversations::InputFileContent>] The content of the message
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
- variant :input_text, -> { OpenAI::Conversations::InputTextContent }
61
+ # A text input to the model.
62
+ variant :input_text, -> { OpenAI::Responses::ResponseInputText }
59
63
 
60
- variant :output_text, -> { OpenAI::Conversations::OutputTextContent }
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
- variant :refusal, -> { OpenAI::Conversations::RefusalContent }
73
+ # A refusal from the model.
74
+ variant :refusal, -> { OpenAI::Responses::ResponseOutputRefusal }
67
75
 
68
- variant :input_image, -> { OpenAI::Conversations::InputImageContent }
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
- variant :input_file, -> { OpenAI::Conversations::InputFileContent }
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::Conversations::InputTextContent, OpenAI::Models::Conversations::OutputTextContent, OpenAI::Models::Conversations::TextContent, OpenAI::Models::Conversations::SummaryTextContent, OpenAI::Models::Conversations::RefusalContent, OpenAI::Models::Conversations::InputImageContent, OpenAI::Models::Conversations::ComputerScreenshotContent, OpenAI::Models::Conversations::InputFileContent)]
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
- class OutputTextContent < OpenAI::Internal::Type::BaseModel
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
- class RefusalContent < OpenAI::Internal::Type::BaseModel
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
@@ -15,6 +15,8 @@ module OpenAI
15
15
  required :type, const: :summary_text
16
16
 
17
17
  # @!method initialize(text:, type: :summary_text)
18
+ # A summary text from the model.
19
+ #
18
20
  # @param text [String]
19
21
  # @param type [Symbol, :summary_text]
20
22
  end
@@ -15,6 +15,8 @@ module OpenAI
15
15
  required :type, const: :text
16
16
 
17
17
  # @!method initialize(text:, type: :text)
18
+ # A text content.
19
+ #
18
20
  # @param text [String]
19
21
  # @param type [Symbol, :text]
20
22
  end