openai 0.8.0 → 0.10.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 +41 -0
- data/README.md +115 -4
- data/lib/openai/errors.rb +22 -0
- data/lib/openai/internal/type/array_of.rb +6 -1
- data/lib/openai/internal/type/base_model.rb +76 -24
- data/lib/openai/internal/type/boolean.rb +7 -1
- data/lib/openai/internal/type/converter.rb +42 -34
- data/lib/openai/internal/type/enum.rb +10 -2
- data/lib/openai/internal/type/file_input.rb +6 -1
- data/lib/openai/internal/type/hash_of.rb +6 -1
- data/lib/openai/internal/type/union.rb +12 -7
- data/lib/openai/internal/type/unknown.rb +7 -1
- data/lib/openai/models/audio/speech_create_params.rb +23 -2
- data/lib/openai/models/audio/transcription.rb +118 -1
- data/lib/openai/models/audio/transcription_text_done_event.rb +80 -1
- data/lib/openai/models/audio/transcription_verbose.rb +31 -1
- data/lib/openai/models/chat/chat_completion.rb +1 -0
- data/lib/openai/models/chat/chat_completion_chunk.rb +1 -0
- data/lib/openai/models/chat/completion_create_params.rb +1 -0
- data/lib/openai/models/fine_tuning/job_create_params.rb +4 -2
- data/lib/openai/models/image_edit_params.rb +35 -1
- data/lib/openai/models/responses/response.rb +41 -6
- data/lib/openai/models/responses/response_code_interpreter_call_code_delta_event.rb +17 -8
- data/lib/openai/models/responses/response_code_interpreter_call_code_done_event.rb +14 -10
- data/lib/openai/models/responses/response_code_interpreter_call_completed_event.rb +11 -10
- data/lib/openai/models/responses/response_code_interpreter_call_in_progress_event.rb +11 -10
- data/lib/openai/models/responses/response_code_interpreter_call_interpreting_event.rb +11 -10
- data/lib/openai/models/responses/response_code_interpreter_tool_call.rb +49 -78
- data/lib/openai/models/responses/response_create_params.rb +41 -32
- data/lib/openai/models/responses/response_output_text.rb +18 -2
- data/lib/openai/models/responses/response_prompt.rb +63 -0
- data/lib/openai/models/responses/response_stream_event.rb +2 -2
- data/lib/openai/resources/audio/speech.rb +3 -1
- data/lib/openai/resources/chat/completions.rb +8 -0
- data/lib/openai/resources/fine_tuning/jobs.rb +2 -2
- data/lib/openai/resources/images.rb +5 -1
- data/lib/openai/resources/responses.rb +18 -14
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +1 -0
- data/rbi/openai/errors.rbi +16 -0
- data/rbi/openai/internal/type/boolean.rbi +2 -0
- data/rbi/openai/internal/type/converter.rbi +15 -15
- data/rbi/openai/internal/type/union.rbi +5 -0
- data/rbi/openai/internal/type/unknown.rbi +2 -0
- data/rbi/openai/models/audio/speech_create_params.rbi +59 -2
- data/rbi/openai/models/audio/transcription.rbi +213 -3
- data/rbi/openai/models/audio/transcription_text_done_event.rbi +146 -1
- data/rbi/openai/models/audio/transcription_verbose.rbi +47 -0
- data/rbi/openai/models/chat/chat_completion.rbi +5 -0
- data/rbi/openai/models/chat/chat_completion_chunk.rbi +5 -0
- data/rbi/openai/models/chat/completion_create_params.rbi +5 -0
- data/rbi/openai/models/fine_tuning/job_create_params.rbi +8 -4
- data/rbi/openai/models/image_edit_params.rbi +51 -0
- data/rbi/openai/models/responses/response.rbi +66 -7
- data/rbi/openai/models/responses/response_code_interpreter_call_code_delta_event.rbi +17 -7
- data/rbi/openai/models/responses/response_code_interpreter_call_code_done_event.rbi +13 -5
- data/rbi/openai/models/responses/response_code_interpreter_call_completed_event.rbi +13 -21
- data/rbi/openai/models/responses/response_code_interpreter_call_in_progress_event.rbi +13 -21
- data/rbi/openai/models/responses/response_code_interpreter_call_interpreting_event.rbi +13 -21
- data/rbi/openai/models/responses/response_code_interpreter_tool_call.rbi +83 -125
- data/rbi/openai/models/responses/response_create_params.rbi +107 -64
- data/rbi/openai/models/responses/response_output_text.rbi +26 -4
- data/rbi/openai/models/responses/response_prompt.rbi +120 -0
- data/rbi/openai/resources/audio/speech.rbi +6 -1
- data/rbi/openai/resources/fine_tuning/jobs.rbi +6 -4
- data/rbi/openai/resources/images.rbi +11 -0
- data/rbi/openai/resources/responses.rbi +56 -50
- data/sig/openai/errors.rbs +9 -0
- data/sig/openai/internal/type/converter.rbs +7 -1
- data/sig/openai/models/audio/speech_create_params.rbs +21 -1
- data/sig/openai/models/audio/transcription.rbs +95 -3
- data/sig/openai/models/audio/transcription_text_done_event.rbs +72 -2
- data/sig/openai/models/audio/transcription_verbose.rbs +21 -0
- data/sig/openai/models/chat/chat_completion.rbs +2 -1
- data/sig/openai/models/chat/chat_completion_chunk.rbs +2 -1
- data/sig/openai/models/chat/completion_create_params.rbs +2 -1
- data/sig/openai/models/image_edit_params.rbs +22 -0
- data/sig/openai/models/responses/response.rbs +22 -5
- data/sig/openai/models/responses/response_code_interpreter_call_code_delta_event.rbs +5 -0
- data/sig/openai/models/responses/response_code_interpreter_call_code_done_event.rbs +5 -0
- data/sig/openai/models/responses/response_code_interpreter_call_completed_event.rbs +4 -4
- data/sig/openai/models/responses/response_code_interpreter_call_in_progress_event.rbs +4 -4
- data/sig/openai/models/responses/response_code_interpreter_call_interpreting_event.rbs +4 -4
- data/sig/openai/models/responses/response_code_interpreter_tool_call.rbs +31 -52
- data/sig/openai/models/responses/response_create_params.rbs +25 -11
- data/sig/openai/models/responses/response_output_text.rbs +15 -1
- data/sig/openai/models/responses/response_prompt.rbs +44 -0
- data/sig/openai/resources/audio/speech.rbs +1 -0
- data/sig/openai/resources/images.rbs +2 -0
- data/sig/openai/resources/responses.rbs +6 -4
- metadata +5 -2
@@ -0,0 +1,120 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
module Responses
|
6
|
+
class ResponsePrompt < OpenAI::Internal::Type::BaseModel
|
7
|
+
OrHash =
|
8
|
+
T.type_alias do
|
9
|
+
T.any(OpenAI::Responses::ResponsePrompt, OpenAI::Internal::AnyHash)
|
10
|
+
end
|
11
|
+
|
12
|
+
# The unique identifier of the prompt template to use.
|
13
|
+
sig { returns(String) }
|
14
|
+
attr_accessor :id
|
15
|
+
|
16
|
+
# Optional map of values to substitute in for variables in your prompt. The
|
17
|
+
# substitution values can either be strings, or other Response input types like
|
18
|
+
# images or files.
|
19
|
+
sig do
|
20
|
+
returns(
|
21
|
+
T.nilable(
|
22
|
+
T::Hash[
|
23
|
+
Symbol,
|
24
|
+
T.any(
|
25
|
+
String,
|
26
|
+
OpenAI::Responses::ResponseInputText,
|
27
|
+
OpenAI::Responses::ResponseInputImage,
|
28
|
+
OpenAI::Responses::ResponseInputFile
|
29
|
+
)
|
30
|
+
]
|
31
|
+
)
|
32
|
+
)
|
33
|
+
end
|
34
|
+
attr_accessor :variables
|
35
|
+
|
36
|
+
# Optional version of the prompt template.
|
37
|
+
sig { returns(T.nilable(String)) }
|
38
|
+
attr_accessor :version
|
39
|
+
|
40
|
+
# Reference to a prompt template and its variables.
|
41
|
+
# [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
|
42
|
+
sig do
|
43
|
+
params(
|
44
|
+
id: String,
|
45
|
+
variables:
|
46
|
+
T.nilable(
|
47
|
+
T::Hash[
|
48
|
+
Symbol,
|
49
|
+
T.any(
|
50
|
+
String,
|
51
|
+
OpenAI::Responses::ResponseInputText::OrHash,
|
52
|
+
OpenAI::Responses::ResponseInputImage::OrHash,
|
53
|
+
OpenAI::Responses::ResponseInputFile::OrHash
|
54
|
+
)
|
55
|
+
]
|
56
|
+
),
|
57
|
+
version: T.nilable(String)
|
58
|
+
).returns(T.attached_class)
|
59
|
+
end
|
60
|
+
def self.new(
|
61
|
+
# The unique identifier of the prompt template to use.
|
62
|
+
id:,
|
63
|
+
# Optional map of values to substitute in for variables in your prompt. The
|
64
|
+
# substitution values can either be strings, or other Response input types like
|
65
|
+
# images or files.
|
66
|
+
variables: nil,
|
67
|
+
# Optional version of the prompt template.
|
68
|
+
version: nil
|
69
|
+
)
|
70
|
+
end
|
71
|
+
|
72
|
+
sig do
|
73
|
+
override.returns(
|
74
|
+
{
|
75
|
+
id: String,
|
76
|
+
variables:
|
77
|
+
T.nilable(
|
78
|
+
T::Hash[
|
79
|
+
Symbol,
|
80
|
+
T.any(
|
81
|
+
String,
|
82
|
+
OpenAI::Responses::ResponseInputText,
|
83
|
+
OpenAI::Responses::ResponseInputImage,
|
84
|
+
OpenAI::Responses::ResponseInputFile
|
85
|
+
)
|
86
|
+
]
|
87
|
+
),
|
88
|
+
version: T.nilable(String)
|
89
|
+
}
|
90
|
+
)
|
91
|
+
end
|
92
|
+
def to_hash
|
93
|
+
end
|
94
|
+
|
95
|
+
# A text input to the model.
|
96
|
+
module Variable
|
97
|
+
extend OpenAI::Internal::Type::Union
|
98
|
+
|
99
|
+
Variants =
|
100
|
+
T.type_alias do
|
101
|
+
T.any(
|
102
|
+
String,
|
103
|
+
OpenAI::Responses::ResponseInputText,
|
104
|
+
OpenAI::Responses::ResponseInputImage,
|
105
|
+
OpenAI::Responses::ResponseInputFile
|
106
|
+
)
|
107
|
+
end
|
108
|
+
|
109
|
+
sig do
|
110
|
+
override.returns(
|
111
|
+
T::Array[OpenAI::Responses::ResponsePrompt::Variable::Variants]
|
112
|
+
)
|
113
|
+
end
|
114
|
+
def self.variants
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
@@ -15,6 +15,8 @@ module OpenAI
|
|
15
15
|
response_format:
|
16
16
|
OpenAI::Audio::SpeechCreateParams::ResponseFormat::OrSymbol,
|
17
17
|
speed: Float,
|
18
|
+
stream_format:
|
19
|
+
OpenAI::Audio::SpeechCreateParams::StreamFormat::OrSymbol,
|
18
20
|
request_options: OpenAI::RequestOptions::OrHash
|
19
21
|
).returns(StringIO)
|
20
22
|
end
|
@@ -36,8 +38,11 @@ module OpenAI
|
|
36
38
|
# `wav`, and `pcm`.
|
37
39
|
response_format: nil,
|
38
40
|
# The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is
|
39
|
-
# the default.
|
41
|
+
# the default.
|
40
42
|
speed: nil,
|
43
|
+
# The format to stream the audio in. Supported formats are `sse` and `audio`.
|
44
|
+
# `sse` is not supported for `tts-1` or `tts-1-hd`.
|
45
|
+
stream_format: nil,
|
41
46
|
request_options: {}
|
42
47
|
)
|
43
48
|
end
|
@@ -13,7 +13,7 @@ module OpenAI
|
|
13
13
|
# Response includes details of the enqueued job including job status and the name
|
14
14
|
# of the fine-tuned models once complete.
|
15
15
|
#
|
16
|
-
# [Learn more about fine-tuning](https://platform.openai.com/docs/guides/
|
16
|
+
# [Learn more about fine-tuning](https://platform.openai.com/docs/guides/model-optimization)
|
17
17
|
sig do
|
18
18
|
params(
|
19
19
|
model:
|
@@ -57,7 +57,8 @@ module OpenAI
|
|
57
57
|
# [preference](https://platform.openai.com/docs/api-reference/fine-tuning/preference-input)
|
58
58
|
# format.
|
59
59
|
#
|
60
|
-
# See the
|
60
|
+
# See the
|
61
|
+
# [fine-tuning guide](https://platform.openai.com/docs/guides/model-optimization)
|
61
62
|
# for more details.
|
62
63
|
training_file:,
|
63
64
|
# The hyperparameters used for the fine-tuning job. This value is now deprecated
|
@@ -94,7 +95,8 @@ module OpenAI
|
|
94
95
|
# Your dataset must be formatted as a JSONL file. You must upload your file with
|
95
96
|
# the purpose `fine-tune`.
|
96
97
|
#
|
97
|
-
# See the
|
98
|
+
# See the
|
99
|
+
# [fine-tuning guide](https://platform.openai.com/docs/guides/model-optimization)
|
98
100
|
# for more details.
|
99
101
|
validation_file: nil,
|
100
102
|
request_options: {}
|
@@ -103,7 +105,7 @@ module OpenAI
|
|
103
105
|
|
104
106
|
# Get info about a fine-tuning job.
|
105
107
|
#
|
106
|
-
# [Learn more about fine-tuning](https://platform.openai.com/docs/guides/
|
108
|
+
# [Learn more about fine-tuning](https://platform.openai.com/docs/guides/model-optimization)
|
107
109
|
sig do
|
108
110
|
params(
|
109
111
|
fine_tuning_job_id: String,
|
@@ -52,6 +52,9 @@ module OpenAI
|
|
52
52
|
mask: OpenAI::Internal::FileInput,
|
53
53
|
model: T.nilable(T.any(String, OpenAI::ImageModel::OrSymbol)),
|
54
54
|
n: T.nilable(Integer),
|
55
|
+
output_compression: T.nilable(Integer),
|
56
|
+
output_format:
|
57
|
+
T.nilable(OpenAI::ImageEditParams::OutputFormat::OrSymbol),
|
55
58
|
quality: T.nilable(OpenAI::ImageEditParams::Quality::OrSymbol),
|
56
59
|
response_format:
|
57
60
|
T.nilable(OpenAI::ImageEditParams::ResponseFormat::OrSymbol),
|
@@ -91,6 +94,14 @@ module OpenAI
|
|
91
94
|
model: nil,
|
92
95
|
# The number of images to generate. Must be between 1 and 10.
|
93
96
|
n: nil,
|
97
|
+
# The compression level (0-100%) for the generated images. This parameter is only
|
98
|
+
# supported for `gpt-image-1` with the `webp` or `jpeg` output formats, and
|
99
|
+
# defaults to 100.
|
100
|
+
output_compression: nil,
|
101
|
+
# The format in which the generated images are returned. This parameter is only
|
102
|
+
# supported for `gpt-image-1`. Must be one of `png`, `jpeg`, or `webp`. The
|
103
|
+
# default value is `png`.
|
104
|
+
output_format: nil,
|
94
105
|
# The quality of the image that will be generated. `high`, `medium` and `low` are
|
95
106
|
# only supported for `gpt-image-1`. `dall-e-2` only supports `standard` quality.
|
96
107
|
# Defaults to `auto`.
|
@@ -21,23 +21,24 @@ module OpenAI
|
|
21
21
|
# your own data as input for the model's response.
|
22
22
|
sig do
|
23
23
|
params(
|
24
|
-
input: OpenAI::Responses::ResponseCreateParams::Input::Variants,
|
25
|
-
model:
|
26
|
-
T.any(
|
27
|
-
String,
|
28
|
-
OpenAI::ChatModel::OrSymbol,
|
29
|
-
OpenAI::ResponsesModel::ResponsesOnlyModel::OrSymbol
|
30
|
-
),
|
31
24
|
background: T.nilable(T::Boolean),
|
32
25
|
include:
|
33
26
|
T.nilable(
|
34
27
|
T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol]
|
35
28
|
),
|
29
|
+
input: OpenAI::Responses::ResponseCreateParams::Input::Variants,
|
36
30
|
instructions: T.nilable(String),
|
37
31
|
max_output_tokens: T.nilable(Integer),
|
38
32
|
metadata: T.nilable(T::Hash[Symbol, String]),
|
33
|
+
model:
|
34
|
+
T.any(
|
35
|
+
String,
|
36
|
+
OpenAI::ChatModel::OrSymbol,
|
37
|
+
OpenAI::ResponsesModel::ResponsesOnlyModel::OrSymbol
|
38
|
+
),
|
39
39
|
parallel_tool_calls: T.nilable(T::Boolean),
|
40
40
|
previous_response_id: T.nilable(String),
|
41
|
+
prompt: T.nilable(OpenAI::Responses::ResponsePrompt::OrHash),
|
41
42
|
reasoning: T.nilable(OpenAI::Reasoning::OrHash),
|
42
43
|
service_tier:
|
43
44
|
T.nilable(
|
@@ -80,22 +81,6 @@ module OpenAI
|
|
80
81
|
).returns(OpenAI::Responses::Response)
|
81
82
|
end
|
82
83
|
def create(
|
83
|
-
# Text, image, or file inputs to the model, used to generate a response.
|
84
|
-
#
|
85
|
-
# Learn more:
|
86
|
-
#
|
87
|
-
# - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
|
88
|
-
# - [Image inputs](https://platform.openai.com/docs/guides/images)
|
89
|
-
# - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
|
90
|
-
# - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
|
91
|
-
# - [Function calling](https://platform.openai.com/docs/guides/function-calling)
|
92
|
-
input:,
|
93
|
-
# Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
|
94
|
-
# wide range of models with different capabilities, performance characteristics,
|
95
|
-
# and price points. Refer to the
|
96
|
-
# [model guide](https://platform.openai.com/docs/models) to browse and compare
|
97
|
-
# available models.
|
98
|
-
model:,
|
99
84
|
# Whether to run the model response in the background.
|
100
85
|
# [Learn more](https://platform.openai.com/docs/guides/background).
|
101
86
|
background: nil,
|
@@ -115,8 +100,17 @@ module OpenAI
|
|
115
100
|
# - `code_interpreter_call.outputs`: Includes the outputs of python code execution
|
116
101
|
# in code interpreter tool call items.
|
117
102
|
include: nil,
|
118
|
-
#
|
119
|
-
#
|
103
|
+
# Text, image, or file inputs to the model, used to generate a response.
|
104
|
+
#
|
105
|
+
# Learn more:
|
106
|
+
#
|
107
|
+
# - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
|
108
|
+
# - [Image inputs](https://platform.openai.com/docs/guides/images)
|
109
|
+
# - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
|
110
|
+
# - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
|
111
|
+
# - [Function calling](https://platform.openai.com/docs/guides/function-calling)
|
112
|
+
input: nil,
|
113
|
+
# A system (or developer) message inserted into the model's context.
|
120
114
|
#
|
121
115
|
# When using along with `previous_response_id`, the instructions from a previous
|
122
116
|
# response will not be carried over to the next response. This makes it simple to
|
@@ -133,12 +127,21 @@ module OpenAI
|
|
133
127
|
# Keys are strings with a maximum length of 64 characters. Values are strings with
|
134
128
|
# a maximum length of 512 characters.
|
135
129
|
metadata: nil,
|
130
|
+
# Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
|
131
|
+
# wide range of models with different capabilities, performance characteristics,
|
132
|
+
# and price points. Refer to the
|
133
|
+
# [model guide](https://platform.openai.com/docs/models) to browse and compare
|
134
|
+
# available models.
|
135
|
+
model: nil,
|
136
136
|
# Whether to allow the model to run tool calls in parallel.
|
137
137
|
parallel_tool_calls: nil,
|
138
138
|
# The unique ID of the previous response to the model. Use this to create
|
139
139
|
# multi-turn conversations. Learn more about
|
140
140
|
# [conversation state](https://platform.openai.com/docs/guides/conversation-state).
|
141
141
|
previous_response_id: nil,
|
142
|
+
# Reference to a prompt template and its variables.
|
143
|
+
# [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
|
144
|
+
prompt: nil,
|
142
145
|
# **o-series models only**
|
143
146
|
#
|
144
147
|
# Configuration options for
|
@@ -234,23 +237,24 @@ module OpenAI
|
|
234
237
|
# your own data as input for the model's response.
|
235
238
|
sig do
|
236
239
|
params(
|
237
|
-
input: OpenAI::Responses::ResponseCreateParams::Input::Variants,
|
238
|
-
model:
|
239
|
-
T.any(
|
240
|
-
String,
|
241
|
-
OpenAI::ChatModel::OrSymbol,
|
242
|
-
OpenAI::ResponsesModel::ResponsesOnlyModel::OrSymbol
|
243
|
-
),
|
244
240
|
background: T.nilable(T::Boolean),
|
245
241
|
include:
|
246
242
|
T.nilable(
|
247
243
|
T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol]
|
248
244
|
),
|
245
|
+
input: OpenAI::Responses::ResponseCreateParams::Input::Variants,
|
249
246
|
instructions: T.nilable(String),
|
250
247
|
max_output_tokens: T.nilable(Integer),
|
251
248
|
metadata: T.nilable(T::Hash[Symbol, String]),
|
249
|
+
model:
|
250
|
+
T.any(
|
251
|
+
String,
|
252
|
+
OpenAI::ChatModel::OrSymbol,
|
253
|
+
OpenAI::ResponsesModel::ResponsesOnlyModel::OrSymbol
|
254
|
+
),
|
252
255
|
parallel_tool_calls: T.nilable(T::Boolean),
|
253
256
|
previous_response_id: T.nilable(String),
|
257
|
+
prompt: T.nilable(OpenAI::Responses::ResponsePrompt::OrHash),
|
254
258
|
reasoning: T.nilable(OpenAI::Reasoning::OrHash),
|
255
259
|
service_tier:
|
256
260
|
T.nilable(
|
@@ -293,22 +297,6 @@ module OpenAI
|
|
293
297
|
)
|
294
298
|
end
|
295
299
|
def stream_raw(
|
296
|
-
# Text, image, or file inputs to the model, used to generate a response.
|
297
|
-
#
|
298
|
-
# Learn more:
|
299
|
-
#
|
300
|
-
# - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
|
301
|
-
# - [Image inputs](https://platform.openai.com/docs/guides/images)
|
302
|
-
# - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
|
303
|
-
# - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
|
304
|
-
# - [Function calling](https://platform.openai.com/docs/guides/function-calling)
|
305
|
-
input:,
|
306
|
-
# Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
|
307
|
-
# wide range of models with different capabilities, performance characteristics,
|
308
|
-
# and price points. Refer to the
|
309
|
-
# [model guide](https://platform.openai.com/docs/models) to browse and compare
|
310
|
-
# available models.
|
311
|
-
model:,
|
312
300
|
# Whether to run the model response in the background.
|
313
301
|
# [Learn more](https://platform.openai.com/docs/guides/background).
|
314
302
|
background: nil,
|
@@ -328,8 +316,17 @@ module OpenAI
|
|
328
316
|
# - `code_interpreter_call.outputs`: Includes the outputs of python code execution
|
329
317
|
# in code interpreter tool call items.
|
330
318
|
include: nil,
|
331
|
-
#
|
332
|
-
#
|
319
|
+
# Text, image, or file inputs to the model, used to generate a response.
|
320
|
+
#
|
321
|
+
# Learn more:
|
322
|
+
#
|
323
|
+
# - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
|
324
|
+
# - [Image inputs](https://platform.openai.com/docs/guides/images)
|
325
|
+
# - [File inputs](https://platform.openai.com/docs/guides/pdf-files)
|
326
|
+
# - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)
|
327
|
+
# - [Function calling](https://platform.openai.com/docs/guides/function-calling)
|
328
|
+
input: nil,
|
329
|
+
# A system (or developer) message inserted into the model's context.
|
333
330
|
#
|
334
331
|
# When using along with `previous_response_id`, the instructions from a previous
|
335
332
|
# response will not be carried over to the next response. This makes it simple to
|
@@ -346,12 +343,21 @@ module OpenAI
|
|
346
343
|
# Keys are strings with a maximum length of 64 characters. Values are strings with
|
347
344
|
# a maximum length of 512 characters.
|
348
345
|
metadata: nil,
|
346
|
+
# Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a
|
347
|
+
# wide range of models with different capabilities, performance characteristics,
|
348
|
+
# and price points. Refer to the
|
349
|
+
# [model guide](https://platform.openai.com/docs/models) to browse and compare
|
350
|
+
# available models.
|
351
|
+
model: nil,
|
349
352
|
# Whether to allow the model to run tool calls in parallel.
|
350
353
|
parallel_tool_calls: nil,
|
351
354
|
# The unique ID of the previous response to the model. Use this to create
|
352
355
|
# multi-turn conversations. Learn more about
|
353
356
|
# [conversation state](https://platform.openai.com/docs/guides/conversation-state).
|
354
357
|
previous_response_id: nil,
|
358
|
+
# Reference to a prompt template and its variables.
|
359
|
+
# [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
|
360
|
+
prompt: nil,
|
355
361
|
# **o-series models only**
|
356
362
|
#
|
357
363
|
# Configuration options for
|
data/sig/openai/errors.rbs
CHANGED
@@ -5,6 +5,15 @@ module OpenAI
|
|
5
5
|
end
|
6
6
|
|
7
7
|
class ConversionError < OpenAI::Errors::Error
|
8
|
+
def cause: -> StandardError?
|
9
|
+
|
10
|
+
def initialize: (
|
11
|
+
on: Class,
|
12
|
+
method: Symbol,
|
13
|
+
target: top,
|
14
|
+
value: top,
|
15
|
+
?cause: StandardError?
|
16
|
+
) -> void
|
8
17
|
end
|
9
18
|
|
10
19
|
class APIError < OpenAI::Errors::Error
|
@@ -8,8 +8,10 @@ module OpenAI
|
|
8
8
|
|
9
9
|
type coerce_state =
|
10
10
|
{
|
11
|
-
|
11
|
+
translate_names: bool,
|
12
|
+
strictness: bool,
|
12
13
|
exactness: { yes: Integer, no: Integer, maybe: Integer },
|
14
|
+
error: Class,
|
13
15
|
branched: Integer
|
14
16
|
}
|
15
17
|
|
@@ -37,6 +39,10 @@ module OpenAI
|
|
37
39
|
| OpenAI::Internal::Type::Converter::input spec
|
38
40
|
) -> (^-> top)
|
39
41
|
|
42
|
+
def self.new_coerce_state: (
|
43
|
+
?translate_names: bool
|
44
|
+
) -> OpenAI::Internal::Type::Converter::coerce_state
|
45
|
+
|
40
46
|
def self.coerce: (
|
41
47
|
OpenAI::Internal::Type::Converter::input target,
|
42
48
|
top value,
|
@@ -8,7 +8,8 @@ module OpenAI
|
|
8
8
|
voice: OpenAI::Models::Audio::SpeechCreateParams::voice,
|
9
9
|
instructions: String,
|
10
10
|
response_format: OpenAI::Models::Audio::SpeechCreateParams::response_format,
|
11
|
-
speed: Float
|
11
|
+
speed: Float,
|
12
|
+
stream_format: OpenAI::Models::Audio::SpeechCreateParams::stream_format
|
12
13
|
}
|
13
14
|
& OpenAI::Internal::Type::request_parameters
|
14
15
|
|
@@ -36,6 +37,12 @@ module OpenAI
|
|
36
37
|
|
37
38
|
def speed=: (Float) -> Float
|
38
39
|
|
40
|
+
attr_reader stream_format: OpenAI::Models::Audio::SpeechCreateParams::stream_format?
|
41
|
+
|
42
|
+
def stream_format=: (
|
43
|
+
OpenAI::Models::Audio::SpeechCreateParams::stream_format
|
44
|
+
) -> OpenAI::Models::Audio::SpeechCreateParams::stream_format
|
45
|
+
|
39
46
|
def initialize: (
|
40
47
|
input: String,
|
41
48
|
model: OpenAI::Models::Audio::SpeechCreateParams::model,
|
@@ -43,6 +50,7 @@ module OpenAI
|
|
43
50
|
?instructions: String,
|
44
51
|
?response_format: OpenAI::Models::Audio::SpeechCreateParams::response_format,
|
45
52
|
?speed: Float,
|
53
|
+
?stream_format: OpenAI::Models::Audio::SpeechCreateParams::stream_format,
|
46
54
|
?request_options: OpenAI::request_opts
|
47
55
|
) -> void
|
48
56
|
|
@@ -53,6 +61,7 @@ module OpenAI
|
|
53
61
|
instructions: String,
|
54
62
|
response_format: OpenAI::Models::Audio::SpeechCreateParams::response_format,
|
55
63
|
speed: Float,
|
64
|
+
stream_format: OpenAI::Models::Audio::SpeechCreateParams::stream_format,
|
56
65
|
request_options: OpenAI::RequestOptions
|
57
66
|
}
|
58
67
|
|
@@ -110,6 +119,17 @@ module OpenAI
|
|
110
119
|
|
111
120
|
def self?.values: -> ::Array[OpenAI::Models::Audio::SpeechCreateParams::response_format]
|
112
121
|
end
|
122
|
+
|
123
|
+
type stream_format = :sse | :audio
|
124
|
+
|
125
|
+
module StreamFormat
|
126
|
+
extend OpenAI::Internal::Type::Enum
|
127
|
+
|
128
|
+
SSE: :sse
|
129
|
+
AUDIO: :audio
|
130
|
+
|
131
|
+
def self?.values: -> ::Array[OpenAI::Models::Audio::SpeechCreateParams::stream_format]
|
132
|
+
end
|
113
133
|
end
|
114
134
|
end
|
115
135
|
end
|
@@ -4,7 +4,8 @@ module OpenAI
|
|
4
4
|
type transcription =
|
5
5
|
{
|
6
6
|
text: String,
|
7
|
-
logprobs: ::Array[OpenAI::Audio::Transcription::Logprob]
|
7
|
+
logprobs: ::Array[OpenAI::Audio::Transcription::Logprob],
|
8
|
+
usage: OpenAI::Models::Audio::Transcription::usage
|
8
9
|
}
|
9
10
|
|
10
11
|
class Transcription < OpenAI::Internal::Type::BaseModel
|
@@ -16,14 +17,22 @@ module OpenAI
|
|
16
17
|
::Array[OpenAI::Audio::Transcription::Logprob]
|
17
18
|
) -> ::Array[OpenAI::Audio::Transcription::Logprob]
|
18
19
|
|
20
|
+
attr_reader usage: OpenAI::Models::Audio::Transcription::usage?
|
21
|
+
|
22
|
+
def usage=: (
|
23
|
+
OpenAI::Models::Audio::Transcription::usage
|
24
|
+
) -> OpenAI::Models::Audio::Transcription::usage
|
25
|
+
|
19
26
|
def initialize: (
|
20
27
|
text: String,
|
21
|
-
?logprobs: ::Array[OpenAI::Audio::Transcription::Logprob]
|
28
|
+
?logprobs: ::Array[OpenAI::Audio::Transcription::Logprob],
|
29
|
+
?usage: OpenAI::Models::Audio::Transcription::usage
|
22
30
|
) -> void
|
23
31
|
|
24
32
|
def to_hash: -> {
|
25
33
|
text: String,
|
26
|
-
logprobs: ::Array[OpenAI::Audio::Transcription::Logprob]
|
34
|
+
logprobs: ::Array[OpenAI::Audio::Transcription::Logprob],
|
35
|
+
usage: OpenAI::Models::Audio::Transcription::usage
|
27
36
|
}
|
28
37
|
|
29
38
|
type logprob = { token: String, bytes: ::Array[Float], logprob: Float }
|
@@ -53,6 +62,89 @@ module OpenAI
|
|
53
62
|
logprob: Float
|
54
63
|
}
|
55
64
|
end
|
65
|
+
|
66
|
+
type usage =
|
67
|
+
OpenAI::Audio::Transcription::Usage::Tokens
|
68
|
+
| OpenAI::Audio::Transcription::Usage::Duration
|
69
|
+
|
70
|
+
module Usage
|
71
|
+
extend OpenAI::Internal::Type::Union
|
72
|
+
|
73
|
+
type tokens =
|
74
|
+
{
|
75
|
+
input_tokens: Integer,
|
76
|
+
output_tokens: Integer,
|
77
|
+
total_tokens: Integer,
|
78
|
+
type: :tokens,
|
79
|
+
input_token_details: OpenAI::Audio::Transcription::Usage::Tokens::InputTokenDetails
|
80
|
+
}
|
81
|
+
|
82
|
+
class Tokens < OpenAI::Internal::Type::BaseModel
|
83
|
+
attr_accessor input_tokens: Integer
|
84
|
+
|
85
|
+
attr_accessor output_tokens: Integer
|
86
|
+
|
87
|
+
attr_accessor total_tokens: Integer
|
88
|
+
|
89
|
+
attr_accessor type: :tokens
|
90
|
+
|
91
|
+
attr_reader input_token_details: OpenAI::Audio::Transcription::Usage::Tokens::InputTokenDetails?
|
92
|
+
|
93
|
+
def input_token_details=: (
|
94
|
+
OpenAI::Audio::Transcription::Usage::Tokens::InputTokenDetails
|
95
|
+
) -> OpenAI::Audio::Transcription::Usage::Tokens::InputTokenDetails
|
96
|
+
|
97
|
+
def initialize: (
|
98
|
+
input_tokens: Integer,
|
99
|
+
output_tokens: Integer,
|
100
|
+
total_tokens: Integer,
|
101
|
+
?input_token_details: OpenAI::Audio::Transcription::Usage::Tokens::InputTokenDetails,
|
102
|
+
?type: :tokens
|
103
|
+
) -> void
|
104
|
+
|
105
|
+
def to_hash: -> {
|
106
|
+
input_tokens: Integer,
|
107
|
+
output_tokens: Integer,
|
108
|
+
total_tokens: Integer,
|
109
|
+
type: :tokens,
|
110
|
+
input_token_details: OpenAI::Audio::Transcription::Usage::Tokens::InputTokenDetails
|
111
|
+
}
|
112
|
+
|
113
|
+
type input_token_details =
|
114
|
+
{ audio_tokens: Integer, text_tokens: Integer }
|
115
|
+
|
116
|
+
class InputTokenDetails < OpenAI::Internal::Type::BaseModel
|
117
|
+
attr_reader audio_tokens: Integer?
|
118
|
+
|
119
|
+
def audio_tokens=: (Integer) -> Integer
|
120
|
+
|
121
|
+
attr_reader text_tokens: Integer?
|
122
|
+
|
123
|
+
def text_tokens=: (Integer) -> Integer
|
124
|
+
|
125
|
+
def initialize: (
|
126
|
+
?audio_tokens: Integer,
|
127
|
+
?text_tokens: Integer
|
128
|
+
) -> void
|
129
|
+
|
130
|
+
def to_hash: -> { audio_tokens: Integer, text_tokens: Integer }
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
type duration = { duration: Float, type: :duration }
|
135
|
+
|
136
|
+
class Duration < OpenAI::Internal::Type::BaseModel
|
137
|
+
attr_accessor duration: Float
|
138
|
+
|
139
|
+
attr_accessor type: :duration
|
140
|
+
|
141
|
+
def initialize: (duration: Float, ?type: :duration) -> void
|
142
|
+
|
143
|
+
def to_hash: -> { duration: Float, type: :duration }
|
144
|
+
end
|
145
|
+
|
146
|
+
def self?.variants: -> ::Array[OpenAI::Models::Audio::Transcription::usage]
|
147
|
+
end
|
56
148
|
end
|
57
149
|
end
|
58
150
|
end
|