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
|
@@ -1111,6 +1111,14 @@ module OpenAI
|
|
|
1111
1111
|
sig { params(max_completion_tokens: Integer).void }
|
|
1112
1112
|
attr_writer :max_completion_tokens
|
|
1113
1113
|
|
|
1114
|
+
# Constrains effort on reasoning for
|
|
1115
|
+
# [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
|
1116
|
+
# supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
|
1117
|
+
# effort can result in faster responses and fewer tokens used on reasoning in a
|
|
1118
|
+
# response.
|
|
1119
|
+
sig { returns(T.nilable(OpenAI::ReasoningEffort::TaggedSymbol)) }
|
|
1120
|
+
attr_accessor :reasoning_effort
|
|
1121
|
+
|
|
1114
1122
|
# A seed value to initialize the randomness, during sampling.
|
|
1115
1123
|
sig { returns(T.nilable(Integer)) }
|
|
1116
1124
|
attr_reader :seed
|
|
@@ -1197,6 +1205,8 @@ module OpenAI
|
|
|
1197
1205
|
sig do
|
|
1198
1206
|
params(
|
|
1199
1207
|
max_completion_tokens: Integer,
|
|
1208
|
+
reasoning_effort:
|
|
1209
|
+
T.nilable(OpenAI::ReasoningEffort::OrSymbol),
|
|
1200
1210
|
seed: Integer,
|
|
1201
1211
|
temperature: Float,
|
|
1202
1212
|
text:
|
|
@@ -1222,6 +1232,12 @@ module OpenAI
|
|
|
1222
1232
|
def self.new(
|
|
1223
1233
|
# The maximum number of tokens in the generated output.
|
|
1224
1234
|
max_completion_tokens: nil,
|
|
1235
|
+
# Constrains effort on reasoning for
|
|
1236
|
+
# [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
|
1237
|
+
# supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
|
1238
|
+
# effort can result in faster responses and fewer tokens used on reasoning in a
|
|
1239
|
+
# response.
|
|
1240
|
+
reasoning_effort: nil,
|
|
1225
1241
|
# A seed value to initialize the randomness, during sampling.
|
|
1226
1242
|
seed: nil,
|
|
1227
1243
|
# A higher temperature increases randomness in the outputs.
|
|
@@ -1256,6 +1272,8 @@ module OpenAI
|
|
|
1256
1272
|
override.returns(
|
|
1257
1273
|
{
|
|
1258
1274
|
max_completion_tokens: Integer,
|
|
1275
|
+
reasoning_effort:
|
|
1276
|
+
T.nilable(OpenAI::ReasoningEffort::TaggedSymbol),
|
|
1259
1277
|
seed: Integer,
|
|
1260
1278
|
temperature: Float,
|
|
1261
1279
|
text:
|
|
@@ -1117,6 +1117,14 @@ module OpenAI
|
|
|
1117
1117
|
sig { params(max_completion_tokens: Integer).void }
|
|
1118
1118
|
attr_writer :max_completion_tokens
|
|
1119
1119
|
|
|
1120
|
+
# Constrains effort on reasoning for
|
|
1121
|
+
# [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
|
1122
|
+
# supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
|
1123
|
+
# effort can result in faster responses and fewer tokens used on reasoning in a
|
|
1124
|
+
# response.
|
|
1125
|
+
sig { returns(T.nilable(OpenAI::ReasoningEffort::TaggedSymbol)) }
|
|
1126
|
+
attr_accessor :reasoning_effort
|
|
1127
|
+
|
|
1120
1128
|
# A seed value to initialize the randomness, during sampling.
|
|
1121
1129
|
sig { returns(T.nilable(Integer)) }
|
|
1122
1130
|
attr_reader :seed
|
|
@@ -1203,6 +1211,8 @@ module OpenAI
|
|
|
1203
1211
|
sig do
|
|
1204
1212
|
params(
|
|
1205
1213
|
max_completion_tokens: Integer,
|
|
1214
|
+
reasoning_effort:
|
|
1215
|
+
T.nilable(OpenAI::ReasoningEffort::OrSymbol),
|
|
1206
1216
|
seed: Integer,
|
|
1207
1217
|
temperature: Float,
|
|
1208
1218
|
text:
|
|
@@ -1228,6 +1238,12 @@ module OpenAI
|
|
|
1228
1238
|
def self.new(
|
|
1229
1239
|
# The maximum number of tokens in the generated output.
|
|
1230
1240
|
max_completion_tokens: nil,
|
|
1241
|
+
# Constrains effort on reasoning for
|
|
1242
|
+
# [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
|
1243
|
+
# supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
|
1244
|
+
# effort can result in faster responses and fewer tokens used on reasoning in a
|
|
1245
|
+
# response.
|
|
1246
|
+
reasoning_effort: nil,
|
|
1231
1247
|
# A seed value to initialize the randomness, during sampling.
|
|
1232
1248
|
seed: nil,
|
|
1233
1249
|
# A higher temperature increases randomness in the outputs.
|
|
@@ -1262,6 +1278,8 @@ module OpenAI
|
|
|
1262
1278
|
override.returns(
|
|
1263
1279
|
{
|
|
1264
1280
|
max_completion_tokens: Integer,
|
|
1281
|
+
reasoning_effort:
|
|
1282
|
+
T.nilable(OpenAI::ReasoningEffort::TaggedSymbol),
|
|
1265
1283
|
seed: Integer,
|
|
1266
1284
|
temperature: Float,
|
|
1267
1285
|
text:
|
|
@@ -37,8 +37,14 @@ module OpenAI
|
|
|
37
37
|
sig { returns(Symbol) }
|
|
38
38
|
attr_accessor :object
|
|
39
39
|
|
|
40
|
-
# A list of results
|
|
41
|
-
sig
|
|
40
|
+
# A list of grader results for this output item.
|
|
41
|
+
sig do
|
|
42
|
+
returns(
|
|
43
|
+
T::Array[
|
|
44
|
+
OpenAI::Models::Evals::Runs::OutputItemListResponse::Result
|
|
45
|
+
]
|
|
46
|
+
)
|
|
47
|
+
end
|
|
42
48
|
attr_accessor :results
|
|
43
49
|
|
|
44
50
|
# The identifier of the evaluation run associated with this output item.
|
|
@@ -71,7 +77,10 @@ module OpenAI
|
|
|
71
77
|
datasource_item: T::Hash[Symbol, T.anything],
|
|
72
78
|
datasource_item_id: Integer,
|
|
73
79
|
eval_id: String,
|
|
74
|
-
results:
|
|
80
|
+
results:
|
|
81
|
+
T::Array[
|
|
82
|
+
OpenAI::Models::Evals::Runs::OutputItemListResponse::Result::OrHash
|
|
83
|
+
],
|
|
75
84
|
run_id: String,
|
|
76
85
|
sample:
|
|
77
86
|
OpenAI::Models::Evals::Runs::OutputItemListResponse::Sample::OrHash,
|
|
@@ -90,7 +99,7 @@ module OpenAI
|
|
|
90
99
|
datasource_item_id:,
|
|
91
100
|
# The identifier of the evaluation group.
|
|
92
101
|
eval_id:,
|
|
93
|
-
# A list of results
|
|
102
|
+
# A list of grader results for this output item.
|
|
94
103
|
results:,
|
|
95
104
|
# The identifier of the evaluation run associated with this output item.
|
|
96
105
|
run_id:,
|
|
@@ -112,7 +121,10 @@ module OpenAI
|
|
|
112
121
|
datasource_item_id: Integer,
|
|
113
122
|
eval_id: String,
|
|
114
123
|
object: Symbol,
|
|
115
|
-
results:
|
|
124
|
+
results:
|
|
125
|
+
T::Array[
|
|
126
|
+
OpenAI::Models::Evals::Runs::OutputItemListResponse::Result
|
|
127
|
+
],
|
|
116
128
|
run_id: String,
|
|
117
129
|
sample:
|
|
118
130
|
OpenAI::Models::Evals::Runs::OutputItemListResponse::Sample,
|
|
@@ -123,6 +135,77 @@ module OpenAI
|
|
|
123
135
|
def to_hash
|
|
124
136
|
end
|
|
125
137
|
|
|
138
|
+
class Result < OpenAI::Internal::Type::BaseModel
|
|
139
|
+
OrHash =
|
|
140
|
+
T.type_alias do
|
|
141
|
+
T.any(
|
|
142
|
+
OpenAI::Models::Evals::Runs::OutputItemListResponse::Result,
|
|
143
|
+
OpenAI::Internal::AnyHash
|
|
144
|
+
)
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# The name of the grader.
|
|
148
|
+
sig { returns(String) }
|
|
149
|
+
attr_accessor :name
|
|
150
|
+
|
|
151
|
+
# Whether the grader considered the output a pass.
|
|
152
|
+
sig { returns(T::Boolean) }
|
|
153
|
+
attr_accessor :passed
|
|
154
|
+
|
|
155
|
+
# The numeric score produced by the grader.
|
|
156
|
+
sig { returns(Float) }
|
|
157
|
+
attr_accessor :score
|
|
158
|
+
|
|
159
|
+
# Optional sample or intermediate data produced by the grader.
|
|
160
|
+
sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
|
|
161
|
+
attr_accessor :sample
|
|
162
|
+
|
|
163
|
+
# The grader type (for example, "string-check-grader").
|
|
164
|
+
sig { returns(T.nilable(String)) }
|
|
165
|
+
attr_reader :type
|
|
166
|
+
|
|
167
|
+
sig { params(type: String).void }
|
|
168
|
+
attr_writer :type
|
|
169
|
+
|
|
170
|
+
# A single grader result for an evaluation run output item.
|
|
171
|
+
sig do
|
|
172
|
+
params(
|
|
173
|
+
name: String,
|
|
174
|
+
passed: T::Boolean,
|
|
175
|
+
score: Float,
|
|
176
|
+
sample: T.nilable(T::Hash[Symbol, T.anything]),
|
|
177
|
+
type: String
|
|
178
|
+
).returns(T.attached_class)
|
|
179
|
+
end
|
|
180
|
+
def self.new(
|
|
181
|
+
# The name of the grader.
|
|
182
|
+
name:,
|
|
183
|
+
# Whether the grader considered the output a pass.
|
|
184
|
+
passed:,
|
|
185
|
+
# The numeric score produced by the grader.
|
|
186
|
+
score:,
|
|
187
|
+
# Optional sample or intermediate data produced by the grader.
|
|
188
|
+
sample: nil,
|
|
189
|
+
# The grader type (for example, "string-check-grader").
|
|
190
|
+
type: nil
|
|
191
|
+
)
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
sig do
|
|
195
|
+
override.returns(
|
|
196
|
+
{
|
|
197
|
+
name: String,
|
|
198
|
+
passed: T::Boolean,
|
|
199
|
+
score: Float,
|
|
200
|
+
sample: T.nilable(T::Hash[Symbol, T.anything]),
|
|
201
|
+
type: String
|
|
202
|
+
}
|
|
203
|
+
)
|
|
204
|
+
end
|
|
205
|
+
def to_hash
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
|
|
126
209
|
class Sample < OpenAI::Internal::Type::BaseModel
|
|
127
210
|
OrHash =
|
|
128
211
|
T.type_alias do
|
|
@@ -37,8 +37,14 @@ module OpenAI
|
|
|
37
37
|
sig { returns(Symbol) }
|
|
38
38
|
attr_accessor :object
|
|
39
39
|
|
|
40
|
-
# A list of results
|
|
41
|
-
sig
|
|
40
|
+
# A list of grader results for this output item.
|
|
41
|
+
sig do
|
|
42
|
+
returns(
|
|
43
|
+
T::Array[
|
|
44
|
+
OpenAI::Models::Evals::Runs::OutputItemRetrieveResponse::Result
|
|
45
|
+
]
|
|
46
|
+
)
|
|
47
|
+
end
|
|
42
48
|
attr_accessor :results
|
|
43
49
|
|
|
44
50
|
# The identifier of the evaluation run associated with this output item.
|
|
@@ -73,7 +79,10 @@ module OpenAI
|
|
|
73
79
|
datasource_item: T::Hash[Symbol, T.anything],
|
|
74
80
|
datasource_item_id: Integer,
|
|
75
81
|
eval_id: String,
|
|
76
|
-
results:
|
|
82
|
+
results:
|
|
83
|
+
T::Array[
|
|
84
|
+
OpenAI::Models::Evals::Runs::OutputItemRetrieveResponse::Result::OrHash
|
|
85
|
+
],
|
|
77
86
|
run_id: String,
|
|
78
87
|
sample:
|
|
79
88
|
OpenAI::Models::Evals::Runs::OutputItemRetrieveResponse::Sample::OrHash,
|
|
@@ -92,7 +101,7 @@ module OpenAI
|
|
|
92
101
|
datasource_item_id:,
|
|
93
102
|
# The identifier of the evaluation group.
|
|
94
103
|
eval_id:,
|
|
95
|
-
# A list of results
|
|
104
|
+
# A list of grader results for this output item.
|
|
96
105
|
results:,
|
|
97
106
|
# The identifier of the evaluation run associated with this output item.
|
|
98
107
|
run_id:,
|
|
@@ -114,7 +123,10 @@ module OpenAI
|
|
|
114
123
|
datasource_item_id: Integer,
|
|
115
124
|
eval_id: String,
|
|
116
125
|
object: Symbol,
|
|
117
|
-
results:
|
|
126
|
+
results:
|
|
127
|
+
T::Array[
|
|
128
|
+
OpenAI::Models::Evals::Runs::OutputItemRetrieveResponse::Result
|
|
129
|
+
],
|
|
118
130
|
run_id: String,
|
|
119
131
|
sample:
|
|
120
132
|
OpenAI::Models::Evals::Runs::OutputItemRetrieveResponse::Sample,
|
|
@@ -125,6 +137,77 @@ module OpenAI
|
|
|
125
137
|
def to_hash
|
|
126
138
|
end
|
|
127
139
|
|
|
140
|
+
class Result < OpenAI::Internal::Type::BaseModel
|
|
141
|
+
OrHash =
|
|
142
|
+
T.type_alias do
|
|
143
|
+
T.any(
|
|
144
|
+
OpenAI::Models::Evals::Runs::OutputItemRetrieveResponse::Result,
|
|
145
|
+
OpenAI::Internal::AnyHash
|
|
146
|
+
)
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# The name of the grader.
|
|
150
|
+
sig { returns(String) }
|
|
151
|
+
attr_accessor :name
|
|
152
|
+
|
|
153
|
+
# Whether the grader considered the output a pass.
|
|
154
|
+
sig { returns(T::Boolean) }
|
|
155
|
+
attr_accessor :passed
|
|
156
|
+
|
|
157
|
+
# The numeric score produced by the grader.
|
|
158
|
+
sig { returns(Float) }
|
|
159
|
+
attr_accessor :score
|
|
160
|
+
|
|
161
|
+
# Optional sample or intermediate data produced by the grader.
|
|
162
|
+
sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
|
|
163
|
+
attr_accessor :sample
|
|
164
|
+
|
|
165
|
+
# The grader type (for example, "string-check-grader").
|
|
166
|
+
sig { returns(T.nilable(String)) }
|
|
167
|
+
attr_reader :type
|
|
168
|
+
|
|
169
|
+
sig { params(type: String).void }
|
|
170
|
+
attr_writer :type
|
|
171
|
+
|
|
172
|
+
# A single grader result for an evaluation run output item.
|
|
173
|
+
sig do
|
|
174
|
+
params(
|
|
175
|
+
name: String,
|
|
176
|
+
passed: T::Boolean,
|
|
177
|
+
score: Float,
|
|
178
|
+
sample: T.nilable(T::Hash[Symbol, T.anything]),
|
|
179
|
+
type: String
|
|
180
|
+
).returns(T.attached_class)
|
|
181
|
+
end
|
|
182
|
+
def self.new(
|
|
183
|
+
# The name of the grader.
|
|
184
|
+
name:,
|
|
185
|
+
# Whether the grader considered the output a pass.
|
|
186
|
+
passed:,
|
|
187
|
+
# The numeric score produced by the grader.
|
|
188
|
+
score:,
|
|
189
|
+
# Optional sample or intermediate data produced by the grader.
|
|
190
|
+
sample: nil,
|
|
191
|
+
# The grader type (for example, "string-check-grader").
|
|
192
|
+
type: nil
|
|
193
|
+
)
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
sig do
|
|
197
|
+
override.returns(
|
|
198
|
+
{
|
|
199
|
+
name: String,
|
|
200
|
+
passed: T::Boolean,
|
|
201
|
+
score: Float,
|
|
202
|
+
sample: T.nilable(T::Hash[Symbol, T.anything]),
|
|
203
|
+
type: String
|
|
204
|
+
}
|
|
205
|
+
)
|
|
206
|
+
end
|
|
207
|
+
def to_hash
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
|
|
128
211
|
class Sample < OpenAI::Internal::Type::BaseModel
|
|
129
212
|
OrHash =
|
|
130
213
|
T.type_alias do
|
|
@@ -35,10 +35,17 @@ module OpenAI
|
|
|
35
35
|
attr_writer :range
|
|
36
36
|
|
|
37
37
|
# The sampling parameters for the model.
|
|
38
|
-
sig
|
|
38
|
+
sig do
|
|
39
|
+
returns(T.nilable(OpenAI::Graders::ScoreModelGrader::SamplingParams))
|
|
40
|
+
end
|
|
39
41
|
attr_reader :sampling_params
|
|
40
42
|
|
|
41
|
-
sig
|
|
43
|
+
sig do
|
|
44
|
+
params(
|
|
45
|
+
sampling_params:
|
|
46
|
+
OpenAI::Graders::ScoreModelGrader::SamplingParams::OrHash
|
|
47
|
+
).void
|
|
48
|
+
end
|
|
42
49
|
attr_writer :sampling_params
|
|
43
50
|
|
|
44
51
|
# A ScoreModelGrader object that uses a model to assign a score to the input.
|
|
@@ -48,7 +55,8 @@ module OpenAI
|
|
|
48
55
|
model: String,
|
|
49
56
|
name: String,
|
|
50
57
|
range: T::Array[Float],
|
|
51
|
-
sampling_params:
|
|
58
|
+
sampling_params:
|
|
59
|
+
OpenAI::Graders::ScoreModelGrader::SamplingParams::OrHash,
|
|
52
60
|
type: Symbol
|
|
53
61
|
).returns(T.attached_class)
|
|
54
62
|
end
|
|
@@ -76,7 +84,7 @@ module OpenAI
|
|
|
76
84
|
name: String,
|
|
77
85
|
type: Symbol,
|
|
78
86
|
range: T::Array[Float],
|
|
79
|
-
sampling_params:
|
|
87
|
+
sampling_params: OpenAI::Graders::ScoreModelGrader::SamplingParams
|
|
80
88
|
}
|
|
81
89
|
)
|
|
82
90
|
end
|
|
@@ -372,6 +380,82 @@ module OpenAI
|
|
|
372
380
|
end
|
|
373
381
|
end
|
|
374
382
|
end
|
|
383
|
+
|
|
384
|
+
class SamplingParams < OpenAI::Internal::Type::BaseModel
|
|
385
|
+
OrHash =
|
|
386
|
+
T.type_alias do
|
|
387
|
+
T.any(
|
|
388
|
+
OpenAI::Graders::ScoreModelGrader::SamplingParams,
|
|
389
|
+
OpenAI::Internal::AnyHash
|
|
390
|
+
)
|
|
391
|
+
end
|
|
392
|
+
|
|
393
|
+
# The maximum number of tokens the grader model may generate in its response.
|
|
394
|
+
sig { returns(T.nilable(Integer)) }
|
|
395
|
+
attr_accessor :max_completions_tokens
|
|
396
|
+
|
|
397
|
+
# Constrains effort on reasoning for
|
|
398
|
+
# [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
|
399
|
+
# supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
|
400
|
+
# effort can result in faster responses and fewer tokens used on reasoning in a
|
|
401
|
+
# response.
|
|
402
|
+
sig { returns(T.nilable(OpenAI::ReasoningEffort::OrSymbol)) }
|
|
403
|
+
attr_accessor :reasoning_effort
|
|
404
|
+
|
|
405
|
+
# A seed value to initialize the randomness, during sampling.
|
|
406
|
+
sig { returns(T.nilable(Integer)) }
|
|
407
|
+
attr_accessor :seed
|
|
408
|
+
|
|
409
|
+
# A higher temperature increases randomness in the outputs.
|
|
410
|
+
sig { returns(T.nilable(Float)) }
|
|
411
|
+
attr_accessor :temperature
|
|
412
|
+
|
|
413
|
+
# An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
|
|
414
|
+
sig { returns(T.nilable(Float)) }
|
|
415
|
+
attr_accessor :top_p
|
|
416
|
+
|
|
417
|
+
# The sampling parameters for the model.
|
|
418
|
+
sig do
|
|
419
|
+
params(
|
|
420
|
+
max_completions_tokens: T.nilable(Integer),
|
|
421
|
+
reasoning_effort: T.nilable(OpenAI::ReasoningEffort::OrSymbol),
|
|
422
|
+
seed: T.nilable(Integer),
|
|
423
|
+
temperature: T.nilable(Float),
|
|
424
|
+
top_p: T.nilable(Float)
|
|
425
|
+
).returns(T.attached_class)
|
|
426
|
+
end
|
|
427
|
+
def self.new(
|
|
428
|
+
# The maximum number of tokens the grader model may generate in its response.
|
|
429
|
+
max_completions_tokens: nil,
|
|
430
|
+
# Constrains effort on reasoning for
|
|
431
|
+
# [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
|
432
|
+
# supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
|
433
|
+
# effort can result in faster responses and fewer tokens used on reasoning in a
|
|
434
|
+
# response.
|
|
435
|
+
reasoning_effort: nil,
|
|
436
|
+
# A seed value to initialize the randomness, during sampling.
|
|
437
|
+
seed: nil,
|
|
438
|
+
# A higher temperature increases randomness in the outputs.
|
|
439
|
+
temperature: nil,
|
|
440
|
+
# An alternative to temperature for nucleus sampling; 1.0 includes all tokens.
|
|
441
|
+
top_p: nil
|
|
442
|
+
)
|
|
443
|
+
end
|
|
444
|
+
|
|
445
|
+
sig do
|
|
446
|
+
override.returns(
|
|
447
|
+
{
|
|
448
|
+
max_completions_tokens: T.nilable(Integer),
|
|
449
|
+
reasoning_effort: T.nilable(OpenAI::ReasoningEffort::OrSymbol),
|
|
450
|
+
seed: T.nilable(Integer),
|
|
451
|
+
temperature: T.nilable(Float),
|
|
452
|
+
top_p: T.nilable(Float)
|
|
453
|
+
}
|
|
454
|
+
)
|
|
455
|
+
end
|
|
456
|
+
def to_hash
|
|
457
|
+
end
|
|
458
|
+
end
|
|
375
459
|
end
|
|
376
460
|
end
|
|
377
461
|
end
|
data/sig/openai/errors.rbs
CHANGED
|
@@ -21,6 +21,8 @@ module OpenAI
|
|
|
21
21
|
|
|
22
22
|
attr_accessor status: Integer?
|
|
23
23
|
|
|
24
|
+
attr_accessor headers: ::Hash[String, String]?
|
|
25
|
+
|
|
24
26
|
attr_accessor body: top?
|
|
25
27
|
|
|
26
28
|
attr_accessor code: String?
|
|
@@ -32,6 +34,7 @@ module OpenAI
|
|
|
32
34
|
def initialize: (
|
|
33
35
|
url: URI::Generic,
|
|
34
36
|
?status: Integer?,
|
|
37
|
+
?headers: ::Hash[String, String]?,
|
|
35
38
|
?body: Object?,
|
|
36
39
|
?request: nil,
|
|
37
40
|
?response: nil,
|
|
@@ -43,6 +46,7 @@ module OpenAI
|
|
|
43
46
|
def initialize: (
|
|
44
47
|
url: URI::Generic,
|
|
45
48
|
?status: nil,
|
|
49
|
+
?headers: ::Hash[String, String]?,
|
|
46
50
|
?body: nil,
|
|
47
51
|
?request: nil,
|
|
48
52
|
?response: nil,
|
|
@@ -54,6 +58,7 @@ module OpenAI
|
|
|
54
58
|
def initialize: (
|
|
55
59
|
url: URI::Generic,
|
|
56
60
|
?status: nil,
|
|
61
|
+
?headers: ::Hash[String, String]?,
|
|
57
62
|
?body: nil,
|
|
58
63
|
?request: nil,
|
|
59
64
|
?response: nil,
|
|
@@ -65,6 +70,7 @@ module OpenAI
|
|
|
65
70
|
def self.for: (
|
|
66
71
|
url: URI::Generic,
|
|
67
72
|
status: Integer,
|
|
73
|
+
headers: ::Hash[String, String]?,
|
|
68
74
|
body: Object?,
|
|
69
75
|
request: nil,
|
|
70
76
|
response: nil,
|
|
@@ -74,6 +80,7 @@ module OpenAI
|
|
|
74
80
|
def initialize: (
|
|
75
81
|
url: URI::Generic,
|
|
76
82
|
status: Integer,
|
|
83
|
+
headers: ::Hash[String, String]?,
|
|
77
84
|
body: Object?,
|
|
78
85
|
request: nil,
|
|
79
86
|
response: nil,
|
|
@@ -8,6 +8,10 @@ module OpenAI
|
|
|
8
8
|
Enumerable[top] stream
|
|
9
9
|
) -> (^(Integer arg0) -> void)
|
|
10
10
|
|
|
11
|
+
attr_reader status: Integer
|
|
12
|
+
|
|
13
|
+
attr_reader headers: ::Hash[String, String]
|
|
14
|
+
|
|
11
15
|
def close: -> void
|
|
12
16
|
|
|
13
17
|
private def iterator: -> Enumerable[Elem]
|
|
@@ -22,6 +26,7 @@ module OpenAI
|
|
|
22
26
|
model: Class | OpenAI::Internal::Type::Converter,
|
|
23
27
|
url: URI::Generic,
|
|
24
28
|
status: Integer,
|
|
29
|
+
headers: ::Hash[String, String],
|
|
25
30
|
response: top,
|
|
26
31
|
unwrap: Symbol
|
|
27
32
|
| Integer
|
|
@@ -1,41 +1,7 @@
|
|
|
1
1
|
module OpenAI
|
|
2
2
|
module Models
|
|
3
3
|
module Conversations
|
|
4
|
-
|
|
5
|
-
{
|
|
6
|
-
file_id: String?,
|
|
7
|
-
type: :input_file,
|
|
8
|
-
file_url: String,
|
|
9
|
-
filename: String
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
class InputFileContent < OpenAI::Internal::Type::BaseModel
|
|
13
|
-
attr_accessor file_id: String?
|
|
14
|
-
|
|
15
|
-
attr_accessor type: :input_file
|
|
16
|
-
|
|
17
|
-
attr_reader file_url: String?
|
|
18
|
-
|
|
19
|
-
def file_url=: (String) -> String
|
|
20
|
-
|
|
21
|
-
attr_reader filename: String?
|
|
22
|
-
|
|
23
|
-
def filename=: (String) -> String
|
|
24
|
-
|
|
25
|
-
def initialize: (
|
|
26
|
-
file_id: String?,
|
|
27
|
-
?file_url: String,
|
|
28
|
-
?filename: String,
|
|
29
|
-
?type: :input_file
|
|
30
|
-
) -> void
|
|
31
|
-
|
|
32
|
-
def to_hash: -> {
|
|
33
|
-
file_id: String?,
|
|
34
|
-
type: :input_file,
|
|
35
|
-
file_url: String,
|
|
36
|
-
filename: String
|
|
37
|
-
}
|
|
38
|
-
end
|
|
4
|
+
class InputFileContent = OpenAI::Models::Responses::ResponseInputFile
|
|
39
5
|
end
|
|
40
6
|
end
|
|
41
7
|
end
|
|
@@ -1,49 +1,7 @@
|
|
|
1
1
|
module OpenAI
|
|
2
2
|
module Models
|
|
3
3
|
module Conversations
|
|
4
|
-
|
|
5
|
-
{
|
|
6
|
-
detail: OpenAI::Models::Conversations::InputImageContent::detail,
|
|
7
|
-
file_id: String?,
|
|
8
|
-
image_url: String?,
|
|
9
|
-
type: :input_image
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
class InputImageContent < OpenAI::Internal::Type::BaseModel
|
|
13
|
-
attr_accessor detail: OpenAI::Models::Conversations::InputImageContent::detail
|
|
14
|
-
|
|
15
|
-
attr_accessor file_id: String?
|
|
16
|
-
|
|
17
|
-
attr_accessor image_url: String?
|
|
18
|
-
|
|
19
|
-
attr_accessor type: :input_image
|
|
20
|
-
|
|
21
|
-
def initialize: (
|
|
22
|
-
detail: OpenAI::Models::Conversations::InputImageContent::detail,
|
|
23
|
-
file_id: String?,
|
|
24
|
-
image_url: String?,
|
|
25
|
-
?type: :input_image
|
|
26
|
-
) -> void
|
|
27
|
-
|
|
28
|
-
def to_hash: -> {
|
|
29
|
-
detail: OpenAI::Models::Conversations::InputImageContent::detail,
|
|
30
|
-
file_id: String?,
|
|
31
|
-
image_url: String?,
|
|
32
|
-
type: :input_image
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
type detail = :low | :high | :auto
|
|
36
|
-
|
|
37
|
-
module Detail
|
|
38
|
-
extend OpenAI::Internal::Type::Enum
|
|
39
|
-
|
|
40
|
-
LOW: :low
|
|
41
|
-
HIGH: :high
|
|
42
|
-
AUTO: :auto
|
|
43
|
-
|
|
44
|
-
def self?.values: -> ::Array[OpenAI::Models::Conversations::InputImageContent::detail]
|
|
45
|
-
end
|
|
46
|
-
end
|
|
4
|
+
class InputImageContent = OpenAI::Models::Responses::ResponseInputImage
|
|
47
5
|
end
|
|
48
6
|
end
|
|
49
7
|
end
|
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
module OpenAI
|
|
2
2
|
module Models
|
|
3
3
|
module Conversations
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class InputTextContent < OpenAI::Internal::Type::BaseModel
|
|
7
|
-
attr_accessor text: String
|
|
8
|
-
|
|
9
|
-
attr_accessor type: :input_text
|
|
10
|
-
|
|
11
|
-
def initialize: (text: String, ?type: :input_text) -> void
|
|
12
|
-
|
|
13
|
-
def to_hash: -> { text: String, type: :input_text }
|
|
14
|
-
end
|
|
4
|
+
class InputTextContent = OpenAI::Models::Responses::ResponseInputText
|
|
15
5
|
end
|
|
16
6
|
end
|
|
17
7
|
end
|
|
@@ -38,14 +38,14 @@ module OpenAI
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
type content =
|
|
41
|
-
OpenAI::
|
|
42
|
-
| OpenAI::
|
|
41
|
+
OpenAI::Responses::ResponseInputText
|
|
42
|
+
| OpenAI::Responses::ResponseOutputText
|
|
43
43
|
| OpenAI::Conversations::TextContent
|
|
44
44
|
| OpenAI::Conversations::SummaryTextContent
|
|
45
|
-
| OpenAI::
|
|
46
|
-
| OpenAI::
|
|
45
|
+
| OpenAI::Responses::ResponseOutputRefusal
|
|
46
|
+
| OpenAI::Responses::ResponseInputImage
|
|
47
47
|
| OpenAI::Conversations::ComputerScreenshotContent
|
|
48
|
-
| OpenAI::
|
|
48
|
+
| OpenAI::Responses::ResponseInputFile
|
|
49
49
|
|
|
50
50
|
module Content
|
|
51
51
|
extend OpenAI::Internal::Type::Union
|