openai 0.27.1 → 0.28.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 +17 -0
- data/README.md +1 -1
- data/lib/openai/internal/transport/pooled_net_requester.rb +7 -10
- data/lib/openai/internal/type/base_stream.rb +0 -17
- data/lib/openai/models/batch.rb +23 -1
- data/lib/openai/models/batch_usage.rb +84 -0
- data/lib/openai/models/responses/response_custom_tool_call_output.rb +47 -4
- data/lib/openai/models/responses/response_function_call_arguments_done_event.rb +9 -1
- data/lib/openai/models/responses/response_function_call_output_item.rb +26 -0
- data/lib/openai/models/responses/response_function_call_output_item_list.rb +11 -0
- data/lib/openai/models/responses/response_function_tool_call_output_item.rb +47 -4
- data/lib/openai/models/responses/response_input_file_content.rb +52 -0
- data/lib/openai/models/responses/response_input_image_content.rb +65 -0
- data/lib/openai/models/responses/response_input_item.rb +19 -4
- data/lib/openai/models/responses/response_input_text_content.rb +28 -0
- data/lib/openai/models.rb +2 -0
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +6 -0
- data/rbi/openai/internal/type/base_stream.rbi +0 -15
- data/rbi/openai/models/batch.rbi +35 -1
- data/rbi/openai/models/batch_usage.rbi +139 -0
- data/rbi/openai/models/responses/response_custom_tool_call_output.rbi +77 -5
- data/rbi/openai/models/responses/response_function_call_arguments_done_event.rbi +8 -0
- data/rbi/openai/models/responses/response_function_call_output_item.rbi +31 -0
- data/rbi/openai/models/responses/response_function_call_output_item_list.rbi +15 -0
- data/rbi/openai/models/responses/response_function_tool_call_output_item.rbi +72 -5
- data/rbi/openai/models/responses/response_input_file_content.rbi +75 -0
- data/rbi/openai/models/responses/response_input_image_content.rbi +125 -0
- data/rbi/openai/models/responses/response_input_item.rbi +36 -5
- data/rbi/openai/models/responses/response_input_text_content.rbi +39 -0
- data/rbi/openai/models.rbi +2 -0
- data/sig/openai/internal/type/base_stream.rbs +0 -4
- data/sig/openai/models/batch.rbs +16 -2
- data/sig/openai/models/batch_usage.rbs +60 -0
- data/sig/openai/models/responses/response_custom_tool_call_output.rbs +27 -4
- data/sig/openai/models/responses/response_function_call_arguments_done_event.rbs +5 -0
- data/sig/openai/models/responses/response_function_call_output_item.rbs +16 -0
- data/sig/openai/models/responses/response_function_call_output_item_list.rbs +10 -0
- data/sig/openai/models/responses/response_function_tool_call_output_item.rbs +27 -4
- data/sig/openai/models/responses/response_input_file_content.rbs +42 -0
- data/sig/openai/models/responses/response_input_image_content.rbs +49 -0
- data/sig/openai/models/responses/response_input_item.rbs +14 -4
- data/sig/openai/models/responses/response_input_text_content.rbs +17 -0
- data/sig/openai/models.rbs +2 -0
- metadata +19 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01342bdfdf8f3ad25ed0b3266cae9dc3022f3356ed7b6268d01164e10702ce69
|
4
|
+
data.tar.gz: f49a9c99e8441520c6ed0fcfc5acac72d0622c73c811ae5462d2c4d615f66e54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ce27503d671f912a27cd1e9e0dfb78088ec362aa1697c9fbaf938882bb5f7e6fc25e7c7e50b2a6b8bb7ec84acb356a9ce3756885084ddf6aa0def3f8841c245
|
7
|
+
data.tar.gz: bad48c4d256ff7d274432f6361432adca1c0cba1696f75c42f656757f3cdc9bd5913c695184bb3307e9f93e360d745c87002cbc96333bd6af960a912ee19e7dd
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.28.0 (2025-09-30)
|
4
|
+
|
5
|
+
Full Changelog: [v0.27.1...v0.28.0](https://github.com/openai/openai-ruby/compare/v0.27.1...v0.28.0)
|
6
|
+
|
7
|
+
### ⚠ BREAKING CHANGES
|
8
|
+
|
9
|
+
* **api:** `ResponseFunctionToolCallOutputItem.output` and `ResponseCustomToolCallOutput.output` now return `string | Array<ResponseInputText | ResponseInputImage | ResponseInputFile>` instead of `string` only. This may break existing callsites that assume `output` is always a string.
|
10
|
+
|
11
|
+
### Features
|
12
|
+
|
13
|
+
* **api:** Support images and files for function call outputs in responses, BatchUsage ([904348a](https://github.com/openai/openai-ruby/commit/904348a26c713601f10063fef73f9982088aa438))
|
14
|
+
|
15
|
+
|
16
|
+
### Bug Fixes
|
17
|
+
|
18
|
+
* coroutine leaks from connection pool ([7f0b3cd](https://github.com/openai/openai-ruby/commit/7f0b3cdfee0232dbfa1800029ba80f5470f95c13))
|
19
|
+
|
3
20
|
## 0.27.1 (2025-09-29)
|
4
21
|
|
5
22
|
Full Changelog: [v0.27.0...v0.27.1](https://github.com/openai/openai-ruby/compare/v0.27.0...v0.27.1)
|
data/README.md
CHANGED
@@ -134,9 +134,9 @@ module OpenAI
|
|
134
134
|
|
135
135
|
# rubocop:disable Metrics/BlockLength
|
136
136
|
enum = Enumerator.new do |y|
|
137
|
-
|
138
|
-
next if finished
|
137
|
+
next if finished
|
139
138
|
|
139
|
+
with_pool(url, deadline: deadline) do |conn|
|
140
140
|
req, closing = self.class.build_request(request) do
|
141
141
|
self.class.calibrate_socket_timeout(conn, deadline)
|
142
142
|
end
|
@@ -149,7 +149,7 @@ module OpenAI
|
|
149
149
|
|
150
150
|
self.class.calibrate_socket_timeout(conn, deadline)
|
151
151
|
conn.request(req) do |rsp|
|
152
|
-
y << [
|
152
|
+
y << [req, rsp]
|
153
153
|
break if finished
|
154
154
|
|
155
155
|
rsp.read_body do |bytes|
|
@@ -160,6 +160,8 @@ module OpenAI
|
|
160
160
|
end
|
161
161
|
eof = true
|
162
162
|
end
|
163
|
+
ensure
|
164
|
+
conn.finish if !eof && conn&.started?
|
163
165
|
end
|
164
166
|
rescue Timeout::Error
|
165
167
|
raise OpenAI::Errors::APITimeoutError.new(url: url, request: req)
|
@@ -168,16 +170,11 @@ module OpenAI
|
|
168
170
|
end
|
169
171
|
# rubocop:enable Metrics/BlockLength
|
170
172
|
|
171
|
-
|
173
|
+
_, response = enum.next
|
172
174
|
body = OpenAI::Internal::Util.fused_enum(enum, external: true) do
|
173
175
|
finished = true
|
174
|
-
|
175
|
-
enum.next
|
176
|
-
rescue StopIteration
|
177
|
-
nil
|
178
|
-
end
|
176
|
+
loop { enum.next }
|
179
177
|
ensure
|
180
|
-
conn.finish if !eof && conn&.started?
|
181
178
|
closing&.call
|
182
179
|
end
|
183
180
|
[Integer(response.code), response, body]
|
@@ -13,21 +13,6 @@ module OpenAI
|
|
13
13
|
module BaseStream
|
14
14
|
include Enumerable
|
15
15
|
|
16
|
-
class << self
|
17
|
-
# Attempt to close the underlying transport when the stream itself is garbage
|
18
|
-
# collected.
|
19
|
-
#
|
20
|
-
# This should not be relied upon for resource clean up, as the garbage collector
|
21
|
-
# is not guaranteed to run.
|
22
|
-
#
|
23
|
-
# @param stream [Enumerable<Object>]
|
24
|
-
#
|
25
|
-
# @return [Proc]
|
26
|
-
#
|
27
|
-
# @see https://rubyapi.org/3.2/o/objectspace#method-c-define_finalizer
|
28
|
-
def defer_closing(stream) = ->(_id) { OpenAI::Internal::Util.close_fused!(stream) }
|
29
|
-
end
|
30
|
-
|
31
16
|
# @return [Integer]
|
32
17
|
attr_reader :status
|
33
18
|
|
@@ -82,8 +67,6 @@ module OpenAI
|
|
82
67
|
@unwrap = unwrap
|
83
68
|
@stream = stream
|
84
69
|
@iterator = iterator
|
85
|
-
|
86
|
-
ObjectSpace.define_finalizer(self, OpenAI::Internal::Type::BaseStream.defer_closing(@stream))
|
87
70
|
end
|
88
71
|
|
89
72
|
# @api private
|
data/lib/openai/models/batch.rb
CHANGED
@@ -115,6 +115,16 @@ module OpenAI
|
|
115
115
|
# @return [Hash{Symbol=>String}, nil]
|
116
116
|
optional :metadata, OpenAI::Internal::Type::HashOf[String], nil?: true
|
117
117
|
|
118
|
+
# @!attribute model
|
119
|
+
# Model ID used to process the batch, like `gpt-5-2025-08-07`. OpenAI offers a
|
120
|
+
# wide range of models with different capabilities, performance characteristics,
|
121
|
+
# and price points. Refer to the
|
122
|
+
# [model guide](https://platform.openai.com/docs/models) to browse and compare
|
123
|
+
# available models.
|
124
|
+
#
|
125
|
+
# @return [String, nil]
|
126
|
+
optional :model, String
|
127
|
+
|
118
128
|
# @!attribute output_file_id
|
119
129
|
# The ID of the file containing the outputs of successfully executed requests.
|
120
130
|
#
|
@@ -127,7 +137,15 @@ module OpenAI
|
|
127
137
|
# @return [OpenAI::Models::BatchRequestCounts, nil]
|
128
138
|
optional :request_counts, -> { OpenAI::BatchRequestCounts }
|
129
139
|
|
130
|
-
# @!
|
140
|
+
# @!attribute usage
|
141
|
+
# Represents token usage details including input tokens, output tokens, a
|
142
|
+
# breakdown of output tokens, and the total tokens used. Only populated on batches
|
143
|
+
# created after September 7, 2025.
|
144
|
+
#
|
145
|
+
# @return [OpenAI::Models::BatchUsage, nil]
|
146
|
+
optional :usage, -> { OpenAI::BatchUsage }
|
147
|
+
|
148
|
+
# @!method initialize(id:, completion_window:, created_at:, endpoint:, input_file_id:, status:, cancelled_at: nil, cancelling_at: nil, completed_at: nil, error_file_id: nil, errors: nil, expired_at: nil, expires_at: nil, failed_at: nil, finalizing_at: nil, in_progress_at: nil, metadata: nil, model: nil, output_file_id: nil, request_counts: nil, usage: nil, object: :batch)
|
131
149
|
# Some parameter documentations has been truncated, see {OpenAI::Models::Batch}
|
132
150
|
# for more details.
|
133
151
|
#
|
@@ -165,10 +183,14 @@ module OpenAI
|
|
165
183
|
#
|
166
184
|
# @param metadata [Hash{Symbol=>String}, nil] Set of 16 key-value pairs that can be attached to an object. This can be
|
167
185
|
#
|
186
|
+
# @param model [String] Model ID used to process the batch, like `gpt-5-2025-08-07`. OpenAI
|
187
|
+
#
|
168
188
|
# @param output_file_id [String] The ID of the file containing the outputs of successfully executed requests.
|
169
189
|
#
|
170
190
|
# @param request_counts [OpenAI::Models::BatchRequestCounts] The request counts for different statuses within the batch.
|
171
191
|
#
|
192
|
+
# @param usage [OpenAI::Models::BatchUsage] Represents token usage details including input tokens, output tokens, a
|
193
|
+
#
|
172
194
|
# @param object [Symbol, :batch] The object type, which is always `batch`.
|
173
195
|
|
174
196
|
# The current status of the batch.
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
class BatchUsage < OpenAI::Internal::Type::BaseModel
|
6
|
+
# @!attribute input_tokens
|
7
|
+
# The number of input tokens.
|
8
|
+
#
|
9
|
+
# @return [Integer]
|
10
|
+
required :input_tokens, Integer
|
11
|
+
|
12
|
+
# @!attribute input_tokens_details
|
13
|
+
# A detailed breakdown of the input tokens.
|
14
|
+
#
|
15
|
+
# @return [OpenAI::Models::BatchUsage::InputTokensDetails]
|
16
|
+
required :input_tokens_details, -> { OpenAI::BatchUsage::InputTokensDetails }
|
17
|
+
|
18
|
+
# @!attribute output_tokens
|
19
|
+
# The number of output tokens.
|
20
|
+
#
|
21
|
+
# @return [Integer]
|
22
|
+
required :output_tokens, Integer
|
23
|
+
|
24
|
+
# @!attribute output_tokens_details
|
25
|
+
# A detailed breakdown of the output tokens.
|
26
|
+
#
|
27
|
+
# @return [OpenAI::Models::BatchUsage::OutputTokensDetails]
|
28
|
+
required :output_tokens_details, -> { OpenAI::BatchUsage::OutputTokensDetails }
|
29
|
+
|
30
|
+
# @!attribute total_tokens
|
31
|
+
# The total number of tokens used.
|
32
|
+
#
|
33
|
+
# @return [Integer]
|
34
|
+
required :total_tokens, Integer
|
35
|
+
|
36
|
+
# @!method initialize(input_tokens:, input_tokens_details:, output_tokens:, output_tokens_details:, total_tokens:)
|
37
|
+
# Represents token usage details including input tokens, output tokens, a
|
38
|
+
# breakdown of output tokens, and the total tokens used. Only populated on batches
|
39
|
+
# created after September 7, 2025.
|
40
|
+
#
|
41
|
+
# @param input_tokens [Integer] The number of input tokens.
|
42
|
+
#
|
43
|
+
# @param input_tokens_details [OpenAI::Models::BatchUsage::InputTokensDetails] A detailed breakdown of the input tokens.
|
44
|
+
#
|
45
|
+
# @param output_tokens [Integer] The number of output tokens.
|
46
|
+
#
|
47
|
+
# @param output_tokens_details [OpenAI::Models::BatchUsage::OutputTokensDetails] A detailed breakdown of the output tokens.
|
48
|
+
#
|
49
|
+
# @param total_tokens [Integer] The total number of tokens used.
|
50
|
+
|
51
|
+
# @see OpenAI::Models::BatchUsage#input_tokens_details
|
52
|
+
class InputTokensDetails < OpenAI::Internal::Type::BaseModel
|
53
|
+
# @!attribute cached_tokens
|
54
|
+
# The number of tokens that were retrieved from the cache.
|
55
|
+
# [More on prompt caching](https://platform.openai.com/docs/guides/prompt-caching).
|
56
|
+
#
|
57
|
+
# @return [Integer]
|
58
|
+
required :cached_tokens, Integer
|
59
|
+
|
60
|
+
# @!method initialize(cached_tokens:)
|
61
|
+
# Some parameter documentations has been truncated, see
|
62
|
+
# {OpenAI::Models::BatchUsage::InputTokensDetails} for more details.
|
63
|
+
#
|
64
|
+
# A detailed breakdown of the input tokens.
|
65
|
+
#
|
66
|
+
# @param cached_tokens [Integer] The number of tokens that were retrieved from the cache. [More on
|
67
|
+
end
|
68
|
+
|
69
|
+
# @see OpenAI::Models::BatchUsage#output_tokens_details
|
70
|
+
class OutputTokensDetails < OpenAI::Internal::Type::BaseModel
|
71
|
+
# @!attribute reasoning_tokens
|
72
|
+
# The number of reasoning tokens.
|
73
|
+
#
|
74
|
+
# @return [Integer]
|
75
|
+
required :reasoning_tokens, Integer
|
76
|
+
|
77
|
+
# @!method initialize(reasoning_tokens:)
|
78
|
+
# A detailed breakdown of the output tokens.
|
79
|
+
#
|
80
|
+
# @param reasoning_tokens [Integer] The number of reasoning tokens.
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -11,10 +11,11 @@ module OpenAI
|
|
11
11
|
required :call_id, String
|
12
12
|
|
13
13
|
# @!attribute output
|
14
|
-
# The output from the custom tool call generated by your code.
|
14
|
+
# The output from the custom tool call generated by your code. Can be a string or
|
15
|
+
# an list of output content.
|
15
16
|
#
|
16
|
-
# @return [String]
|
17
|
-
required :output,
|
17
|
+
# @return [String, Array<OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Responses::ResponseInputImage, OpenAI::Models::Responses::ResponseInputFile>]
|
18
|
+
required :output, union: -> { OpenAI::Responses::ResponseCustomToolCallOutput::Output }
|
18
19
|
|
19
20
|
# @!attribute type
|
20
21
|
# The type of the custom tool call output. Always `custom_tool_call_output`.
|
@@ -36,11 +37,53 @@ module OpenAI
|
|
36
37
|
#
|
37
38
|
# @param call_id [String] The call ID, used to map this custom tool call output to a custom tool call.
|
38
39
|
#
|
39
|
-
# @param output [String] The output from the custom tool call generated by your code.
|
40
|
+
# @param output [String, Array<OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Responses::ResponseInputImage, OpenAI::Models::Responses::ResponseInputFile>] The output from the custom tool call generated by your code.
|
40
41
|
#
|
41
42
|
# @param id [String] The unique ID of the custom tool call output in the OpenAI platform.
|
42
43
|
#
|
43
44
|
# @param type [Symbol, :custom_tool_call_output] The type of the custom tool call output. Always `custom_tool_call_output`.
|
45
|
+
|
46
|
+
# The output from the custom tool call generated by your code. Can be a string or
|
47
|
+
# an list of output content.
|
48
|
+
#
|
49
|
+
# @see OpenAI::Models::Responses::ResponseCustomToolCallOutput#output
|
50
|
+
module Output
|
51
|
+
extend OpenAI::Internal::Type::Union
|
52
|
+
|
53
|
+
# A string of the output of the custom tool call.
|
54
|
+
variant String
|
55
|
+
|
56
|
+
# Text, image, or file output of the custom tool call.
|
57
|
+
variant -> { OpenAI::Models::Responses::ResponseCustomToolCallOutput::Output::OutputContentListArray }
|
58
|
+
|
59
|
+
# A text input to the model.
|
60
|
+
module OutputContentList
|
61
|
+
extend OpenAI::Internal::Type::Union
|
62
|
+
|
63
|
+
discriminator :type
|
64
|
+
|
65
|
+
# A text input to the model.
|
66
|
+
variant :input_text, -> { OpenAI::Responses::ResponseInputText }
|
67
|
+
|
68
|
+
# An image input to the model. Learn about [image inputs](https://platform.openai.com/docs/guides/vision).
|
69
|
+
variant :input_image, -> { OpenAI::Responses::ResponseInputImage }
|
70
|
+
|
71
|
+
# A file input to the model.
|
72
|
+
variant :input_file, -> { OpenAI::Responses::ResponseInputFile }
|
73
|
+
|
74
|
+
# @!method self.variants
|
75
|
+
# @return [Array(OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Responses::ResponseInputImage, OpenAI::Models::Responses::ResponseInputFile)]
|
76
|
+
end
|
77
|
+
|
78
|
+
# @!method self.variants
|
79
|
+
# @return [Array(String, Array<OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Responses::ResponseInputImage, OpenAI::Models::Responses::ResponseInputFile>)]
|
80
|
+
|
81
|
+
# @type [OpenAI::Internal::Type::Converter]
|
82
|
+
OutputContentListArray =
|
83
|
+
OpenAI::Internal::Type::ArrayOf[union: -> {
|
84
|
+
OpenAI::Responses::ResponseCustomToolCallOutput::Output::OutputContentList
|
85
|
+
}]
|
86
|
+
end
|
44
87
|
end
|
45
88
|
end
|
46
89
|
end
|
@@ -16,6 +16,12 @@ module OpenAI
|
|
16
16
|
# @return [String]
|
17
17
|
required :item_id, String
|
18
18
|
|
19
|
+
# @!attribute name
|
20
|
+
# The name of the function that was called.
|
21
|
+
#
|
22
|
+
# @return [String]
|
23
|
+
required :name, String
|
24
|
+
|
19
25
|
# @!attribute output_index
|
20
26
|
# The index of the output item.
|
21
27
|
#
|
@@ -33,13 +39,15 @@ module OpenAI
|
|
33
39
|
# @return [Symbol, :"response.function_call_arguments.done"]
|
34
40
|
required :type, const: :"response.function_call_arguments.done"
|
35
41
|
|
36
|
-
# @!method initialize(arguments:, item_id:, output_index:, sequence_number:, type: :"response.function_call_arguments.done")
|
42
|
+
# @!method initialize(arguments:, item_id:, name:, output_index:, sequence_number:, type: :"response.function_call_arguments.done")
|
37
43
|
# Emitted when function-call arguments are finalized.
|
38
44
|
#
|
39
45
|
# @param arguments [String] The function-call arguments.
|
40
46
|
#
|
41
47
|
# @param item_id [String] The ID of the item.
|
42
48
|
#
|
49
|
+
# @param name [String] The name of the function that was called.
|
50
|
+
#
|
43
51
|
# @param output_index [Integer] The index of the output item.
|
44
52
|
#
|
45
53
|
# @param sequence_number [Integer] The sequence number of this event.
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
module Responses
|
6
|
+
# A text input to the model.
|
7
|
+
module ResponseFunctionCallOutputItem
|
8
|
+
extend OpenAI::Internal::Type::Union
|
9
|
+
|
10
|
+
discriminator :type
|
11
|
+
|
12
|
+
# A text input to the model.
|
13
|
+
variant :input_text, -> { OpenAI::Responses::ResponseInputTextContent }
|
14
|
+
|
15
|
+
# An image input to the model. Learn about [image inputs](https://platform.openai.com/docs/guides/vision)
|
16
|
+
variant :input_image, -> { OpenAI::Responses::ResponseInputImageContent }
|
17
|
+
|
18
|
+
# A file input to the model.
|
19
|
+
variant :input_file, -> { OpenAI::Responses::ResponseInputFileContent }
|
20
|
+
|
21
|
+
# @!method self.variants
|
22
|
+
# @return [Array(OpenAI::Models::Responses::ResponseInputTextContent, OpenAI::Models::Responses::ResponseInputImageContent, OpenAI::Models::Responses::ResponseInputFileContent)]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
module Responses
|
6
|
+
# @type [OpenAI::Internal::Type::Converter]
|
7
|
+
ResponseFunctionCallOutputItemList =
|
8
|
+
OpenAI::Internal::Type::ArrayOf[union: -> { OpenAI::Responses::ResponseFunctionCallOutputItem }]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -17,10 +17,11 @@ module OpenAI
|
|
17
17
|
required :call_id, String
|
18
18
|
|
19
19
|
# @!attribute output
|
20
|
-
#
|
20
|
+
# The output from the function call generated by your code. Can be a string or an
|
21
|
+
# list of output content.
|
21
22
|
#
|
22
|
-
# @return [String]
|
23
|
-
required :output,
|
23
|
+
# @return [String, Array<OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Responses::ResponseInputImage, OpenAI::Models::Responses::ResponseInputFile>]
|
24
|
+
required :output, union: -> { OpenAI::Responses::ResponseFunctionToolCallOutputItem::Output }
|
24
25
|
|
25
26
|
# @!attribute type
|
26
27
|
# The type of the function tool call output. Always `function_call_output`.
|
@@ -44,12 +45,54 @@ module OpenAI
|
|
44
45
|
#
|
45
46
|
# @param call_id [String] The unique ID of the function tool call generated by the model.
|
46
47
|
#
|
47
|
-
# @param output [String
|
48
|
+
# @param output [String, Array<OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Responses::ResponseInputImage, OpenAI::Models::Responses::ResponseInputFile>] The output from the function call generated by your code.
|
48
49
|
#
|
49
50
|
# @param status [Symbol, OpenAI::Models::Responses::ResponseFunctionToolCallOutputItem::Status] The status of the item. One of `in_progress`, `completed`, or
|
50
51
|
#
|
51
52
|
# @param type [Symbol, :function_call_output] The type of the function tool call output. Always `function_call_output`.
|
52
53
|
|
54
|
+
# The output from the function call generated by your code. Can be a string or an
|
55
|
+
# list of output content.
|
56
|
+
#
|
57
|
+
# @see OpenAI::Models::Responses::ResponseFunctionToolCallOutputItem#output
|
58
|
+
module Output
|
59
|
+
extend OpenAI::Internal::Type::Union
|
60
|
+
|
61
|
+
# A string of the output of the function call.
|
62
|
+
variant String
|
63
|
+
|
64
|
+
# Text, image, or file output of the function call.
|
65
|
+
variant -> { OpenAI::Models::Responses::ResponseFunctionToolCallOutputItem::Output::OutputContentListArray }
|
66
|
+
|
67
|
+
# A text input to the model.
|
68
|
+
module OutputContentList
|
69
|
+
extend OpenAI::Internal::Type::Union
|
70
|
+
|
71
|
+
discriminator :type
|
72
|
+
|
73
|
+
# A text input to the model.
|
74
|
+
variant :input_text, -> { OpenAI::Responses::ResponseInputText }
|
75
|
+
|
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 }
|
78
|
+
|
79
|
+
# A file input to the model.
|
80
|
+
variant :input_file, -> { OpenAI::Responses::ResponseInputFile }
|
81
|
+
|
82
|
+
# @!method self.variants
|
83
|
+
# @return [Array(OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Responses::ResponseInputImage, OpenAI::Models::Responses::ResponseInputFile)]
|
84
|
+
end
|
85
|
+
|
86
|
+
# @!method self.variants
|
87
|
+
# @return [Array(String, Array<OpenAI::Models::Responses::ResponseInputText, OpenAI::Models::Responses::ResponseInputImage, OpenAI::Models::Responses::ResponseInputFile>)]
|
88
|
+
|
89
|
+
# @type [OpenAI::Internal::Type::Converter]
|
90
|
+
OutputContentListArray =
|
91
|
+
OpenAI::Internal::Type::ArrayOf[union: -> {
|
92
|
+
OpenAI::Responses::ResponseFunctionToolCallOutputItem::Output::OutputContentList
|
93
|
+
}]
|
94
|
+
end
|
95
|
+
|
53
96
|
# The status of the item. One of `in_progress`, `completed`, or `incomplete`.
|
54
97
|
# Populated when items are returned via API.
|
55
98
|
#
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
module Responses
|
6
|
+
class ResponseInputFileContent < OpenAI::Internal::Type::BaseModel
|
7
|
+
# @!attribute type
|
8
|
+
# The type of the input item. Always `input_file`.
|
9
|
+
#
|
10
|
+
# @return [Symbol, :input_file]
|
11
|
+
required :type, const: :input_file
|
12
|
+
|
13
|
+
# @!attribute file_data
|
14
|
+
# The base64-encoded data of the file to be sent to the model.
|
15
|
+
#
|
16
|
+
# @return [String, nil]
|
17
|
+
optional :file_data, String, nil?: true
|
18
|
+
|
19
|
+
# @!attribute file_id
|
20
|
+
# The ID of the file to be sent to the model.
|
21
|
+
#
|
22
|
+
# @return [String, nil]
|
23
|
+
optional :file_id, String, nil?: true
|
24
|
+
|
25
|
+
# @!attribute file_url
|
26
|
+
# The URL of the file to be sent to the model.
|
27
|
+
#
|
28
|
+
# @return [String, nil]
|
29
|
+
optional :file_url, String, nil?: true
|
30
|
+
|
31
|
+
# @!attribute filename
|
32
|
+
# The name of the file to be sent to the model.
|
33
|
+
#
|
34
|
+
# @return [String, nil]
|
35
|
+
optional :filename, String, nil?: true
|
36
|
+
|
37
|
+
# @!method initialize(file_data: nil, file_id: nil, file_url: nil, filename: nil, type: :input_file)
|
38
|
+
# A file input to the model.
|
39
|
+
#
|
40
|
+
# @param file_data [String, nil] The base64-encoded data of the file to be sent to the model.
|
41
|
+
#
|
42
|
+
# @param file_id [String, nil] The ID of the file to be sent to the model.
|
43
|
+
#
|
44
|
+
# @param file_url [String, nil] The URL of the file to be sent to the model.
|
45
|
+
#
|
46
|
+
# @param filename [String, nil] The name of the file to be sent to the model.
|
47
|
+
#
|
48
|
+
# @param type [Symbol, :input_file] The type of the input item. Always `input_file`.
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
module Responses
|
6
|
+
class ResponseInputImageContent < OpenAI::Internal::Type::BaseModel
|
7
|
+
# @!attribute type
|
8
|
+
# The type of the input item. Always `input_image`.
|
9
|
+
#
|
10
|
+
# @return [Symbol, :input_image]
|
11
|
+
required :type, const: :input_image
|
12
|
+
|
13
|
+
# @!attribute detail
|
14
|
+
# The detail level of the image to be sent to the model. One of `high`, `low`, or
|
15
|
+
# `auto`. Defaults to `auto`.
|
16
|
+
#
|
17
|
+
# @return [Symbol, OpenAI::Models::Responses::ResponseInputImageContent::Detail, nil]
|
18
|
+
optional :detail, enum: -> { OpenAI::Responses::ResponseInputImageContent::Detail }, nil?: true
|
19
|
+
|
20
|
+
# @!attribute file_id
|
21
|
+
# The ID of the file to be sent to the model.
|
22
|
+
#
|
23
|
+
# @return [String, nil]
|
24
|
+
optional :file_id, String, nil?: true
|
25
|
+
|
26
|
+
# @!attribute image_url
|
27
|
+
# The URL of the image to be sent to the model. A fully qualified URL or base64
|
28
|
+
# encoded image in a data URL.
|
29
|
+
#
|
30
|
+
# @return [String, nil]
|
31
|
+
optional :image_url, String, nil?: true
|
32
|
+
|
33
|
+
# @!method initialize(detail: nil, file_id: nil, image_url: nil, type: :input_image)
|
34
|
+
# Some parameter documentations has been truncated, see
|
35
|
+
# {OpenAI::Models::Responses::ResponseInputImageContent} for more details.
|
36
|
+
#
|
37
|
+
# An image input to the model. Learn about
|
38
|
+
# [image inputs](https://platform.openai.com/docs/guides/vision)
|
39
|
+
#
|
40
|
+
# @param detail [Symbol, OpenAI::Models::Responses::ResponseInputImageContent::Detail, nil] The detail level of the image to be sent to the model. One of `high`, `low`, or
|
41
|
+
#
|
42
|
+
# @param file_id [String, nil] The ID of the file to be sent to the model.
|
43
|
+
#
|
44
|
+
# @param image_url [String, nil] The URL of the image to be sent to the model. A fully qualified URL or base64 en
|
45
|
+
#
|
46
|
+
# @param type [Symbol, :input_image] The type of the input item. Always `input_image`.
|
47
|
+
|
48
|
+
# The detail level of the image to be sent to the model. One of `high`, `low`, or
|
49
|
+
# `auto`. Defaults to `auto`.
|
50
|
+
#
|
51
|
+
# @see OpenAI::Models::Responses::ResponseInputImageContent#detail
|
52
|
+
module Detail
|
53
|
+
extend OpenAI::Internal::Type::Enum
|
54
|
+
|
55
|
+
LOW = :low
|
56
|
+
HIGH = :high
|
57
|
+
AUTO = :auto
|
58
|
+
|
59
|
+
# @!method self.values
|
60
|
+
# @return [Array<Symbol>]
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -291,10 +291,10 @@ module OpenAI
|
|
291
291
|
required :call_id, String
|
292
292
|
|
293
293
|
# @!attribute output
|
294
|
-
#
|
294
|
+
# Text, image, or file output of the function tool call.
|
295
295
|
#
|
296
|
-
# @return [String]
|
297
|
-
required :output,
|
296
|
+
# @return [String, Array<OpenAI::Models::Responses::ResponseInputTextContent, OpenAI::Models::Responses::ResponseInputImageContent, OpenAI::Models::Responses::ResponseInputFileContent>]
|
297
|
+
required :output, union: -> { OpenAI::Responses::ResponseInputItem::FunctionCallOutput::Output }
|
298
298
|
|
299
299
|
# @!attribute type
|
300
300
|
# The type of the function tool call output. Always `function_call_output`.
|
@@ -327,7 +327,7 @@ module OpenAI
|
|
327
327
|
#
|
328
328
|
# @param call_id [String] The unique ID of the function tool call generated by the model.
|
329
329
|
#
|
330
|
-
# @param output [String]
|
330
|
+
# @param output [String, Array<OpenAI::Models::Responses::ResponseInputTextContent, OpenAI::Models::Responses::ResponseInputImageContent, OpenAI::Models::Responses::ResponseInputFileContent>] Text, image, or file output of the function tool call.
|
331
331
|
#
|
332
332
|
# @param id [String, nil] The unique ID of the function tool call output. Populated when this item is retu
|
333
333
|
#
|
@@ -335,6 +335,21 @@ module OpenAI
|
|
335
335
|
#
|
336
336
|
# @param type [Symbol, :function_call_output] The type of the function tool call output. Always `function_call_output`.
|
337
337
|
|
338
|
+
# Text, image, or file output of the function tool call.
|
339
|
+
#
|
340
|
+
# @see OpenAI::Models::Responses::ResponseInputItem::FunctionCallOutput#output
|
341
|
+
module Output
|
342
|
+
extend OpenAI::Internal::Type::Union
|
343
|
+
|
344
|
+
# A JSON string of the output of the function tool call.
|
345
|
+
variant String
|
346
|
+
|
347
|
+
variant -> { OpenAI::Responses::ResponseFunctionCallOutputItemList }
|
348
|
+
|
349
|
+
# @!method self.variants
|
350
|
+
# @return [Array(String, Array<OpenAI::Models::Responses::ResponseInputTextContent, OpenAI::Models::Responses::ResponseInputImageContent, OpenAI::Models::Responses::ResponseInputFileContent>)]
|
351
|
+
end
|
352
|
+
|
338
353
|
# The status of the item. One of `in_progress`, `completed`, or `incomplete`.
|
339
354
|
# Populated when items are returned via API.
|
340
355
|
#
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
module Responses
|
6
|
+
class ResponseInputTextContent < 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
|
+
# A text input to the model.
|
21
|
+
#
|
22
|
+
# @param text [String] The text input to the model.
|
23
|
+
#
|
24
|
+
# @param type [Symbol, :input_text] The type of the input item. Always `input_text`.
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|