openai 0.10.0 → 0.12.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 +36 -0
- data/README.md +83 -7
- data/lib/openai/client.rb +11 -0
- data/lib/openai/errors.rb +3 -0
- data/lib/openai/helpers/streaming/events.rb +23 -0
- data/lib/openai/helpers/streaming/response_stream.rb +232 -0
- data/lib/openai/helpers/structured_output/parsed_json.rb +39 -0
- data/lib/openai/internal/stream.rb +2 -1
- data/lib/openai/internal/transport/base_client.rb +10 -2
- data/lib/openai/internal/type/base_stream.rb +3 -1
- data/lib/openai/models/all_models.rb +4 -0
- data/lib/openai/models/chat/chat_completion.rb +32 -31
- data/lib/openai/models/chat/chat_completion_chunk.rb +30 -29
- data/lib/openai/models/chat/chat_completion_message.rb +1 -1
- data/lib/openai/models/chat/chat_completion_message_tool_call.rb +1 -1
- data/lib/openai/models/chat/completion_create_params.rb +34 -31
- data/lib/openai/models/images_response.rb +92 -1
- data/lib/openai/models/responses/response.rb +59 -35
- data/lib/openai/models/responses/response_create_params.rb +64 -39
- data/lib/openai/models/responses/response_function_tool_call.rb +1 -1
- data/lib/openai/models/responses/response_function_web_search.rb +115 -1
- data/lib/openai/models/responses/response_includable.rb +8 -6
- data/lib/openai/models/responses/response_output_text.rb +1 -1
- data/lib/openai/models/responses/tool_choice_mcp.rb +40 -0
- data/lib/openai/models/responses/tool_choice_types.rb +0 -3
- data/lib/openai/models/responses_model.rb +4 -0
- data/lib/openai/models/webhooks/batch_cancelled_webhook_event.rb +84 -0
- data/lib/openai/models/webhooks/batch_completed_webhook_event.rb +84 -0
- data/lib/openai/models/webhooks/batch_expired_webhook_event.rb +84 -0
- data/lib/openai/models/webhooks/batch_failed_webhook_event.rb +84 -0
- data/lib/openai/models/webhooks/eval_run_canceled_webhook_event.rb +84 -0
- data/lib/openai/models/webhooks/eval_run_failed_webhook_event.rb +84 -0
- data/lib/openai/models/webhooks/eval_run_succeeded_webhook_event.rb +84 -0
- data/lib/openai/models/webhooks/fine_tuning_job_cancelled_webhook_event.rb +85 -0
- data/lib/openai/models/webhooks/fine_tuning_job_failed_webhook_event.rb +85 -0
- data/lib/openai/models/webhooks/fine_tuning_job_succeeded_webhook_event.rb +85 -0
- data/lib/openai/models/webhooks/response_cancelled_webhook_event.rb +85 -0
- data/lib/openai/models/webhooks/response_completed_webhook_event.rb +85 -0
- data/lib/openai/models/webhooks/response_failed_webhook_event.rb +84 -0
- data/lib/openai/models/webhooks/response_incomplete_webhook_event.rb +85 -0
- data/lib/openai/models/webhooks/unwrap_webhook_event.rb +59 -0
- data/lib/openai/models/webhooks/webhook_unwrap_params.rb +16 -0
- data/lib/openai/models.rb +2 -0
- data/lib/openai/resources/chat/completions.rb +14 -6
- data/lib/openai/resources/responses.rb +262 -81
- data/lib/openai/resources/webhooks.rb +124 -0
- data/lib/openai/streaming.rb +5 -0
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +22 -0
- data/rbi/openai/client.rbi +3 -0
- data/rbi/openai/helpers/streaming/events.rbi +31 -0
- data/rbi/openai/helpers/streaming/response_stream.rbi +104 -0
- data/rbi/openai/internal/type/base_stream.rbi +8 -1
- data/rbi/openai/models/all_models.rbi +20 -0
- data/rbi/openai/models/chat/chat_completion.rbi +47 -42
- data/rbi/openai/models/chat/chat_completion_chunk.rbi +47 -42
- data/rbi/openai/models/chat/completion_create_params.rbi +51 -42
- data/rbi/openai/models/images_response.rbi +146 -0
- data/rbi/openai/models/responses/response.rbi +75 -44
- data/rbi/openai/models/responses/response_create_params.rbi +91 -55
- data/rbi/openai/models/responses/response_function_web_search.rbi +163 -0
- data/rbi/openai/models/responses/response_includable.rbi +17 -11
- data/rbi/openai/models/responses/tool_choice_mcp.rbi +53 -0
- data/rbi/openai/models/responses/tool_choice_types.rbi +0 -5
- data/rbi/openai/models/responses_model.rbi +20 -0
- data/rbi/openai/models/webhooks/batch_cancelled_webhook_event.rbi +154 -0
- data/rbi/openai/models/webhooks/batch_completed_webhook_event.rbi +154 -0
- data/rbi/openai/models/webhooks/batch_expired_webhook_event.rbi +150 -0
- data/rbi/openai/models/webhooks/batch_failed_webhook_event.rbi +149 -0
- data/rbi/openai/models/webhooks/eval_run_canceled_webhook_event.rbi +154 -0
- data/rbi/openai/models/webhooks/eval_run_failed_webhook_event.rbi +151 -0
- data/rbi/openai/models/webhooks/eval_run_succeeded_webhook_event.rbi +154 -0
- data/rbi/openai/models/webhooks/fine_tuning_job_cancelled_webhook_event.rbi +158 -0
- data/rbi/openai/models/webhooks/fine_tuning_job_failed_webhook_event.rbi +156 -0
- data/rbi/openai/models/webhooks/fine_tuning_job_succeeded_webhook_event.rbi +158 -0
- data/rbi/openai/models/webhooks/response_cancelled_webhook_event.rbi +154 -0
- data/rbi/openai/models/webhooks/response_completed_webhook_event.rbi +154 -0
- data/rbi/openai/models/webhooks/response_failed_webhook_event.rbi +154 -0
- data/rbi/openai/models/webhooks/response_incomplete_webhook_event.rbi +155 -0
- data/rbi/openai/models/webhooks/unwrap_webhook_event.rbi +40 -0
- data/rbi/openai/models/webhooks/webhook_unwrap_params.rbi +32 -0
- data/rbi/openai/models.rbi +2 -0
- data/rbi/openai/resources/chat/completions.rbi +34 -30
- data/rbi/openai/resources/responses.rbi +188 -39
- data/rbi/openai/resources/webhooks.rbi +68 -0
- data/rbi/openai/streaming.rbi +5 -0
- data/sig/openai/client.rbs +2 -0
- data/sig/openai/internal/type/base_stream.rbs +4 -0
- data/sig/openai/models/all_models.rbs +8 -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/images_response.rbs +83 -0
- data/sig/openai/models/responses/response.rbs +13 -1
- data/sig/openai/models/responses/response_create_params.rbs +13 -1
- data/sig/openai/models/responses/response_function_web_search.rbs +54 -0
- data/sig/openai/models/responses/response_includable.rbs +7 -5
- data/sig/openai/models/responses/tool_choice_mcp.rbs +23 -0
- data/sig/openai/models/responses/tool_choice_types.rbs +0 -2
- data/sig/openai/models/responses_model.rbs +8 -0
- data/sig/openai/models/webhooks/batch_cancelled_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/batch_completed_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/batch_expired_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/batch_failed_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/eval_run_canceled_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/eval_run_failed_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/eval_run_succeeded_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/fine_tuning_job_cancelled_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/fine_tuning_job_failed_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/fine_tuning_job_succeeded_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/response_cancelled_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/response_completed_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/response_failed_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/response_incomplete_webhook_event.rbs +66 -0
- data/sig/openai/models/webhooks/unwrap_webhook_event.rbs +27 -0
- data/sig/openai/models/webhooks/webhook_unwrap_params.rbs +17 -0
- data/sig/openai/models.rbs +2 -0
- data/sig/openai/resources/responses.rbs +4 -0
- data/sig/openai/resources/webhooks.rbs +33 -0
- metadata +63 -2
@@ -0,0 +1,104 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Helpers
|
5
|
+
module Streaming
|
6
|
+
class ResponseStream
|
7
|
+
include OpenAI::Internal::Type::BaseStream
|
8
|
+
|
9
|
+
# Define the type union for streaming events that can be yielded
|
10
|
+
ResponseStreamEvent =
|
11
|
+
T.type_alias do
|
12
|
+
T.any(
|
13
|
+
OpenAI::Streaming::ResponseTextDeltaEvent,
|
14
|
+
OpenAI::Streaming::ResponseTextDoneEvent,
|
15
|
+
OpenAI::Streaming::ResponseCompletedEvent,
|
16
|
+
OpenAI::Streaming::ResponseFunctionCallArgumentsDeltaEvent,
|
17
|
+
# Pass through other raw events
|
18
|
+
OpenAI::Models::Responses::ResponseStreamEvent::Variants
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
Message = type_member { { fixed: ResponseStreamEvent } }
|
23
|
+
Elem = type_member { { fixed: ResponseStreamEvent } }
|
24
|
+
|
25
|
+
sig do
|
26
|
+
params(
|
27
|
+
raw_stream: T.untyped,
|
28
|
+
text_format: T.untyped,
|
29
|
+
starting_after: T.nilable(Integer)
|
30
|
+
).void
|
31
|
+
end
|
32
|
+
def initialize(raw_stream:, text_format:, starting_after:)
|
33
|
+
end
|
34
|
+
|
35
|
+
sig { void }
|
36
|
+
def close
|
37
|
+
end
|
38
|
+
|
39
|
+
sig { returns(T.self_type) }
|
40
|
+
def until_done
|
41
|
+
end
|
42
|
+
|
43
|
+
sig { returns(OpenAI::Models::Responses::Response) }
|
44
|
+
def get_final_response
|
45
|
+
end
|
46
|
+
|
47
|
+
sig { returns(String) }
|
48
|
+
def get_output_text
|
49
|
+
end
|
50
|
+
|
51
|
+
sig { returns(T::Enumerator::Lazy[String]) }
|
52
|
+
def text
|
53
|
+
end
|
54
|
+
|
55
|
+
# Override the each method to properly type the yielded events
|
56
|
+
sig do
|
57
|
+
params(
|
58
|
+
block: T.nilable(T.proc.params(event: ResponseStreamEvent).void)
|
59
|
+
).returns(T.any(T.self_type, T::Enumerator[ResponseStreamEvent]))
|
60
|
+
end
|
61
|
+
def each(&block)
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
sig { returns(T.untyped) }
|
67
|
+
def iterator
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
class ResponseStreamState
|
72
|
+
sig { returns(T.nilable(OpenAI::Models::Responses::Response)) }
|
73
|
+
attr_reader :completed_response
|
74
|
+
|
75
|
+
sig { params(text_format: T.untyped).void }
|
76
|
+
def initialize(text_format:)
|
77
|
+
end
|
78
|
+
|
79
|
+
sig { params(event: T.untyped).returns(T::Array[T.untyped]) }
|
80
|
+
def handle_event(event)
|
81
|
+
end
|
82
|
+
|
83
|
+
sig do
|
84
|
+
params(
|
85
|
+
event: T.untyped,
|
86
|
+
current_snapshot: T.nilable(OpenAI::Models::Responses::Response)
|
87
|
+
).returns(OpenAI::Models::Responses::Response)
|
88
|
+
end
|
89
|
+
def accumulate_event(event:, current_snapshot:)
|
90
|
+
end
|
91
|
+
|
92
|
+
private
|
93
|
+
|
94
|
+
sig { params(text: T.nilable(String)).returns(T.untyped) }
|
95
|
+
def parse_structured_text(text)
|
96
|
+
end
|
97
|
+
|
98
|
+
sig { params(object: T.untyped, expected_type: Symbol).void }
|
99
|
+
def assert_type(object, expected_type)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -52,10 +52,17 @@ module OpenAI
|
|
52
52
|
url: URI::Generic,
|
53
53
|
status: Integer,
|
54
54
|
response: Net::HTTPResponse,
|
55
|
+
unwrap:
|
56
|
+
T.any(
|
57
|
+
Symbol,
|
58
|
+
Integer,
|
59
|
+
T::Array[T.any(Symbol, Integer)],
|
60
|
+
T.proc.params(arg0: T.anything).returns(T.anything)
|
61
|
+
),
|
55
62
|
stream: T::Enumerable[Message]
|
56
63
|
).void
|
57
64
|
end
|
58
|
-
def initialize(model:, url:, status:, response:, stream:)
|
65
|
+
def initialize(model:, url:, status:, response:, unwrap:, stream:)
|
59
66
|
end
|
60
67
|
|
61
68
|
# @api private
|
@@ -35,6 +35,26 @@ module OpenAI
|
|
35
35
|
:"o3-pro-2025-06-10",
|
36
36
|
OpenAI::AllModels::ResponsesOnlyModel::TaggedSymbol
|
37
37
|
)
|
38
|
+
O3_DEEP_RESEARCH =
|
39
|
+
T.let(
|
40
|
+
:"o3-deep-research",
|
41
|
+
OpenAI::AllModels::ResponsesOnlyModel::TaggedSymbol
|
42
|
+
)
|
43
|
+
O3_DEEP_RESEARCH_2025_06_26 =
|
44
|
+
T.let(
|
45
|
+
:"o3-deep-research-2025-06-26",
|
46
|
+
OpenAI::AllModels::ResponsesOnlyModel::TaggedSymbol
|
47
|
+
)
|
48
|
+
O4_MINI_DEEP_RESEARCH =
|
49
|
+
T.let(
|
50
|
+
:"o4-mini-deep-research",
|
51
|
+
OpenAI::AllModels::ResponsesOnlyModel::TaggedSymbol
|
52
|
+
)
|
53
|
+
O4_MINI_DEEP_RESEARCH_2025_06_26 =
|
54
|
+
T.let(
|
55
|
+
:"o4-mini-deep-research-2025-06-26",
|
56
|
+
OpenAI::AllModels::ResponsesOnlyModel::TaggedSymbol
|
57
|
+
)
|
38
58
|
COMPUTER_USE_PREVIEW =
|
39
59
|
T.let(
|
40
60
|
:"computer-use-preview",
|
@@ -32,23 +32,23 @@ module OpenAI
|
|
32
32
|
sig { returns(Symbol) }
|
33
33
|
attr_accessor :object
|
34
34
|
|
35
|
-
# Specifies the
|
36
|
-
# relevant for customers subscribed to the scale tier service:
|
35
|
+
# Specifies the processing type used for serving the request.
|
37
36
|
#
|
38
|
-
# - If set to 'auto',
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
#
|
43
|
-
# - If set to '
|
44
|
-
#
|
45
|
-
# -
|
46
|
-
#
|
47
|
-
# [Learn more](https://platform.openai.com/docs/guides/flex-processing).
|
37
|
+
# - If set to 'auto', then the request will be processed with the service tier
|
38
|
+
# configured in the Project settings. Unless otherwise configured, the Project
|
39
|
+
# will use 'default'.
|
40
|
+
# - If set to 'default', then the requset will be processed with the standard
|
41
|
+
# pricing and performance for the selected model.
|
42
|
+
# - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
|
43
|
+
# 'priority', then the request will be processed with the corresponding service
|
44
|
+
# tier. [Contact sales](https://openai.com/contact-sales) to learn more about
|
45
|
+
# Priority processing.
|
48
46
|
# - When not set, the default behavior is 'auto'.
|
49
47
|
#
|
50
|
-
# When
|
51
|
-
#
|
48
|
+
# When the `service_tier` parameter is set, the response body will include the
|
49
|
+
# `service_tier` value based on the processing mode actually used to serve the
|
50
|
+
# request. This response value may be different from the value set in the
|
51
|
+
# parameter.
|
52
52
|
sig do
|
53
53
|
returns(
|
54
54
|
T.nilable(OpenAI::Chat::ChatCompletion::ServiceTier::TaggedSymbol)
|
@@ -98,23 +98,23 @@ module OpenAI
|
|
98
98
|
created:,
|
99
99
|
# The model used for the chat completion.
|
100
100
|
model:,
|
101
|
-
# Specifies the
|
102
|
-
# relevant for customers subscribed to the scale tier service:
|
101
|
+
# Specifies the processing type used for serving the request.
|
103
102
|
#
|
104
|
-
# - If set to 'auto',
|
105
|
-
#
|
106
|
-
#
|
107
|
-
#
|
108
|
-
#
|
109
|
-
# - If set to '
|
110
|
-
#
|
111
|
-
# -
|
112
|
-
#
|
113
|
-
# [Learn more](https://platform.openai.com/docs/guides/flex-processing).
|
103
|
+
# - If set to 'auto', then the request will be processed with the service tier
|
104
|
+
# configured in the Project settings. Unless otherwise configured, the Project
|
105
|
+
# will use 'default'.
|
106
|
+
# - If set to 'default', then the requset will be processed with the standard
|
107
|
+
# pricing and performance for the selected model.
|
108
|
+
# - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
|
109
|
+
# 'priority', then the request will be processed with the corresponding service
|
110
|
+
# tier. [Contact sales](https://openai.com/contact-sales) to learn more about
|
111
|
+
# Priority processing.
|
114
112
|
# - When not set, the default behavior is 'auto'.
|
115
113
|
#
|
116
|
-
# When
|
117
|
-
#
|
114
|
+
# When the `service_tier` parameter is set, the response body will include the
|
115
|
+
# `service_tier` value based on the processing mode actually used to serve the
|
116
|
+
# request. This response value may be different from the value set in the
|
117
|
+
# parameter.
|
118
118
|
service_tier: nil,
|
119
119
|
# This fingerprint represents the backend configuration that the model runs with.
|
120
120
|
#
|
@@ -363,23 +363,23 @@ module OpenAI
|
|
363
363
|
end
|
364
364
|
end
|
365
365
|
|
366
|
-
# Specifies the
|
367
|
-
# relevant for customers subscribed to the scale tier service:
|
366
|
+
# Specifies the processing type used for serving the request.
|
368
367
|
#
|
369
|
-
# - If set to 'auto',
|
370
|
-
#
|
371
|
-
#
|
372
|
-
#
|
373
|
-
#
|
374
|
-
# - If set to '
|
375
|
-
#
|
376
|
-
# -
|
377
|
-
#
|
378
|
-
# [Learn more](https://platform.openai.com/docs/guides/flex-processing).
|
368
|
+
# - If set to 'auto', then the request will be processed with the service tier
|
369
|
+
# configured in the Project settings. Unless otherwise configured, the Project
|
370
|
+
# will use 'default'.
|
371
|
+
# - If set to 'default', then the requset will be processed with the standard
|
372
|
+
# pricing and performance for the selected model.
|
373
|
+
# - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
|
374
|
+
# 'priority', then the request will be processed with the corresponding service
|
375
|
+
# tier. [Contact sales](https://openai.com/contact-sales) to learn more about
|
376
|
+
# Priority processing.
|
379
377
|
# - When not set, the default behavior is 'auto'.
|
380
378
|
#
|
381
|
-
# When
|
382
|
-
#
|
379
|
+
# When the `service_tier` parameter is set, the response body will include the
|
380
|
+
# `service_tier` value based on the processing mode actually used to serve the
|
381
|
+
# request. This response value may be different from the value set in the
|
382
|
+
# parameter.
|
383
383
|
module ServiceTier
|
384
384
|
extend OpenAI::Internal::Type::Enum
|
385
385
|
|
@@ -409,6 +409,11 @@ module OpenAI
|
|
409
409
|
:scale,
|
410
410
|
OpenAI::Chat::ChatCompletion::ServiceTier::TaggedSymbol
|
411
411
|
)
|
412
|
+
PRIORITY =
|
413
|
+
T.let(
|
414
|
+
:priority,
|
415
|
+
OpenAI::Chat::ChatCompletion::ServiceTier::TaggedSymbol
|
416
|
+
)
|
412
417
|
|
413
418
|
sig do
|
414
419
|
override.returns(
|
@@ -34,23 +34,23 @@ module OpenAI
|
|
34
34
|
sig { returns(Symbol) }
|
35
35
|
attr_accessor :object
|
36
36
|
|
37
|
-
# Specifies the
|
38
|
-
# relevant for customers subscribed to the scale tier service:
|
37
|
+
# Specifies the processing type used for serving the request.
|
39
38
|
#
|
40
|
-
# - If set to 'auto',
|
41
|
-
#
|
42
|
-
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
# - If set to '
|
46
|
-
#
|
47
|
-
# -
|
48
|
-
#
|
49
|
-
# [Learn more](https://platform.openai.com/docs/guides/flex-processing).
|
39
|
+
# - If set to 'auto', then the request will be processed with the service tier
|
40
|
+
# configured in the Project settings. Unless otherwise configured, the Project
|
41
|
+
# will use 'default'.
|
42
|
+
# - If set to 'default', then the requset will be processed with the standard
|
43
|
+
# pricing and performance for the selected model.
|
44
|
+
# - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
|
45
|
+
# 'priority', then the request will be processed with the corresponding service
|
46
|
+
# tier. [Contact sales](https://openai.com/contact-sales) to learn more about
|
47
|
+
# Priority processing.
|
50
48
|
# - When not set, the default behavior is 'auto'.
|
51
49
|
#
|
52
|
-
# When
|
53
|
-
#
|
50
|
+
# When the `service_tier` parameter is set, the response body will include the
|
51
|
+
# `service_tier` value based on the processing mode actually used to serve the
|
52
|
+
# request. This response value may be different from the value set in the
|
53
|
+
# parameter.
|
54
54
|
sig do
|
55
55
|
returns(
|
56
56
|
T.nilable(
|
@@ -113,23 +113,23 @@ module OpenAI
|
|
113
113
|
created:,
|
114
114
|
# The model to generate the completion.
|
115
115
|
model:,
|
116
|
-
# Specifies the
|
117
|
-
# relevant for customers subscribed to the scale tier service:
|
116
|
+
# Specifies the processing type used for serving the request.
|
118
117
|
#
|
119
|
-
# - If set to 'auto',
|
120
|
-
#
|
121
|
-
#
|
122
|
-
#
|
123
|
-
#
|
124
|
-
# - If set to '
|
125
|
-
#
|
126
|
-
# -
|
127
|
-
#
|
128
|
-
# [Learn more](https://platform.openai.com/docs/guides/flex-processing).
|
118
|
+
# - If set to 'auto', then the request will be processed with the service tier
|
119
|
+
# configured in the Project settings. Unless otherwise configured, the Project
|
120
|
+
# will use 'default'.
|
121
|
+
# - If set to 'default', then the requset will be processed with the standard
|
122
|
+
# pricing and performance for the selected model.
|
123
|
+
# - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
|
124
|
+
# 'priority', then the request will be processed with the corresponding service
|
125
|
+
# tier. [Contact sales](https://openai.com/contact-sales) to learn more about
|
126
|
+
# Priority processing.
|
129
127
|
# - When not set, the default behavior is 'auto'.
|
130
128
|
#
|
131
|
-
# When
|
132
|
-
#
|
129
|
+
# When the `service_tier` parameter is set, the response body will include the
|
130
|
+
# `service_tier` value based on the processing mode actually used to serve the
|
131
|
+
# request. This response value may be different from the value set in the
|
132
|
+
# parameter.
|
133
133
|
service_tier: nil,
|
134
134
|
# This fingerprint represents the backend configuration that the model runs with.
|
135
135
|
# Can be used in conjunction with the `seed` request parameter to understand when
|
@@ -783,23 +783,23 @@ module OpenAI
|
|
783
783
|
end
|
784
784
|
end
|
785
785
|
|
786
|
-
# Specifies the
|
787
|
-
# relevant for customers subscribed to the scale tier service:
|
786
|
+
# Specifies the processing type used for serving the request.
|
788
787
|
#
|
789
|
-
# - If set to 'auto',
|
790
|
-
#
|
791
|
-
#
|
792
|
-
#
|
793
|
-
#
|
794
|
-
# - If set to '
|
795
|
-
#
|
796
|
-
# -
|
797
|
-
#
|
798
|
-
# [Learn more](https://platform.openai.com/docs/guides/flex-processing).
|
788
|
+
# - If set to 'auto', then the request will be processed with the service tier
|
789
|
+
# configured in the Project settings. Unless otherwise configured, the Project
|
790
|
+
# will use 'default'.
|
791
|
+
# - If set to 'default', then the requset will be processed with the standard
|
792
|
+
# pricing and performance for the selected model.
|
793
|
+
# - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
|
794
|
+
# 'priority', then the request will be processed with the corresponding service
|
795
|
+
# tier. [Contact sales](https://openai.com/contact-sales) to learn more about
|
796
|
+
# Priority processing.
|
799
797
|
# - When not set, the default behavior is 'auto'.
|
800
798
|
#
|
801
|
-
# When
|
802
|
-
#
|
799
|
+
# When the `service_tier` parameter is set, the response body will include the
|
800
|
+
# `service_tier` value based on the processing mode actually used to serve the
|
801
|
+
# request. This response value may be different from the value set in the
|
802
|
+
# parameter.
|
803
803
|
module ServiceTier
|
804
804
|
extend OpenAI::Internal::Type::Enum
|
805
805
|
|
@@ -829,6 +829,11 @@ module OpenAI
|
|
829
829
|
:scale,
|
830
830
|
OpenAI::Chat::ChatCompletionChunk::ServiceTier::TaggedSymbol
|
831
831
|
)
|
832
|
+
PRIORITY =
|
833
|
+
T.let(
|
834
|
+
:priority,
|
835
|
+
OpenAI::Chat::ChatCompletionChunk::ServiceTier::TaggedSymbol
|
836
|
+
)
|
832
837
|
|
833
838
|
sig do
|
834
839
|
override.returns(
|
@@ -270,23 +270,23 @@ module OpenAI
|
|
270
270
|
sig { returns(T.nilable(Integer)) }
|
271
271
|
attr_accessor :seed
|
272
272
|
|
273
|
-
# Specifies the
|
274
|
-
# relevant for customers subscribed to the scale tier service:
|
273
|
+
# Specifies the processing type used for serving the request.
|
275
274
|
#
|
276
|
-
# - If set to 'auto',
|
277
|
-
#
|
278
|
-
#
|
279
|
-
#
|
280
|
-
#
|
281
|
-
# - If set to '
|
282
|
-
#
|
283
|
-
# -
|
284
|
-
#
|
285
|
-
# [Learn more](https://platform.openai.com/docs/guides/flex-processing).
|
275
|
+
# - If set to 'auto', then the request will be processed with the service tier
|
276
|
+
# configured in the Project settings. Unless otherwise configured, the Project
|
277
|
+
# will use 'default'.
|
278
|
+
# - If set to 'default', then the requset will be processed with the standard
|
279
|
+
# pricing and performance for the selected model.
|
280
|
+
# - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
|
281
|
+
# 'priority', then the request will be processed with the corresponding service
|
282
|
+
# tier. [Contact sales](https://openai.com/contact-sales) to learn more about
|
283
|
+
# Priority processing.
|
286
284
|
# - When not set, the default behavior is 'auto'.
|
287
285
|
#
|
288
|
-
# When
|
289
|
-
#
|
286
|
+
# When the `service_tier` parameter is set, the response body will include the
|
287
|
+
# `service_tier` value based on the processing mode actually used to serve the
|
288
|
+
# request. This response value may be different from the value set in the
|
289
|
+
# parameter.
|
290
290
|
sig do
|
291
291
|
returns(
|
292
292
|
T.nilable(
|
@@ -310,6 +310,8 @@ module OpenAI
|
|
310
310
|
# Whether or not to store the output of this chat completion request for use in
|
311
311
|
# our [model distillation](https://platform.openai.com/docs/guides/distillation)
|
312
312
|
# or [evals](https://platform.openai.com/docs/guides/evals) products.
|
313
|
+
#
|
314
|
+
# Supports text and image inputs. Note: image inputs over 10MB will be dropped.
|
313
315
|
sig { returns(T.nilable(T::Boolean)) }
|
314
316
|
attr_accessor :store
|
315
317
|
|
@@ -625,23 +627,23 @@ module OpenAI
|
|
625
627
|
# should refer to the `system_fingerprint` response parameter to monitor changes
|
626
628
|
# in the backend.
|
627
629
|
seed: nil,
|
628
|
-
# Specifies the
|
629
|
-
# relevant for customers subscribed to the scale tier service:
|
630
|
+
# Specifies the processing type used for serving the request.
|
630
631
|
#
|
631
|
-
# - If set to 'auto',
|
632
|
-
#
|
633
|
-
#
|
634
|
-
#
|
635
|
-
#
|
636
|
-
# - If set to '
|
637
|
-
#
|
638
|
-
# -
|
639
|
-
#
|
640
|
-
# [Learn more](https://platform.openai.com/docs/guides/flex-processing).
|
632
|
+
# - If set to 'auto', then the request will be processed with the service tier
|
633
|
+
# configured in the Project settings. Unless otherwise configured, the Project
|
634
|
+
# will use 'default'.
|
635
|
+
# - If set to 'default', then the requset will be processed with the standard
|
636
|
+
# pricing and performance for the selected model.
|
637
|
+
# - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
|
638
|
+
# 'priority', then the request will be processed with the corresponding service
|
639
|
+
# tier. [Contact sales](https://openai.com/contact-sales) to learn more about
|
640
|
+
# Priority processing.
|
641
641
|
# - When not set, the default behavior is 'auto'.
|
642
642
|
#
|
643
|
-
# When
|
644
|
-
#
|
643
|
+
# When the `service_tier` parameter is set, the response body will include the
|
644
|
+
# `service_tier` value based on the processing mode actually used to serve the
|
645
|
+
# request. This response value may be different from the value set in the
|
646
|
+
# parameter.
|
645
647
|
service_tier: nil,
|
646
648
|
# Not supported with latest reasoning models `o3` and `o4-mini`.
|
647
649
|
#
|
@@ -651,6 +653,8 @@ module OpenAI
|
|
651
653
|
# Whether or not to store the output of this chat completion request for use in
|
652
654
|
# our [model distillation](https://platform.openai.com/docs/guides/distillation)
|
653
655
|
# or [evals](https://platform.openai.com/docs/guides/evals) products.
|
656
|
+
#
|
657
|
+
# Supports text and image inputs. Note: image inputs over 10MB will be dropped.
|
654
658
|
store: nil,
|
655
659
|
# Options for streaming response. Only set this when you set `stream: true`.
|
656
660
|
stream_options: nil,
|
@@ -1008,23 +1012,23 @@ module OpenAI
|
|
1008
1012
|
end
|
1009
1013
|
end
|
1010
1014
|
|
1011
|
-
# Specifies the
|
1012
|
-
# relevant for customers subscribed to the scale tier service:
|
1015
|
+
# Specifies the processing type used for serving the request.
|
1013
1016
|
#
|
1014
|
-
# - If set to 'auto',
|
1015
|
-
#
|
1016
|
-
#
|
1017
|
-
#
|
1018
|
-
#
|
1019
|
-
# - If set to '
|
1020
|
-
#
|
1021
|
-
# -
|
1022
|
-
#
|
1023
|
-
# [Learn more](https://platform.openai.com/docs/guides/flex-processing).
|
1017
|
+
# - If set to 'auto', then the request will be processed with the service tier
|
1018
|
+
# configured in the Project settings. Unless otherwise configured, the Project
|
1019
|
+
# will use 'default'.
|
1020
|
+
# - If set to 'default', then the requset will be processed with the standard
|
1021
|
+
# pricing and performance for the selected model.
|
1022
|
+
# - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
|
1023
|
+
# 'priority', then the request will be processed with the corresponding service
|
1024
|
+
# tier. [Contact sales](https://openai.com/contact-sales) to learn more about
|
1025
|
+
# Priority processing.
|
1024
1026
|
# - When not set, the default behavior is 'auto'.
|
1025
1027
|
#
|
1026
|
-
# When
|
1027
|
-
#
|
1028
|
+
# When the `service_tier` parameter is set, the response body will include the
|
1029
|
+
# `service_tier` value based on the processing mode actually used to serve the
|
1030
|
+
# request. This response value may be different from the value set in the
|
1031
|
+
# parameter.
|
1028
1032
|
module ServiceTier
|
1029
1033
|
extend OpenAI::Internal::Type::Enum
|
1030
1034
|
|
@@ -1054,6 +1058,11 @@ module OpenAI
|
|
1054
1058
|
:scale,
|
1055
1059
|
OpenAI::Chat::CompletionCreateParams::ServiceTier::TaggedSymbol
|
1056
1060
|
)
|
1061
|
+
PRIORITY =
|
1062
|
+
T.let(
|
1063
|
+
:priority,
|
1064
|
+
OpenAI::Chat::CompletionCreateParams::ServiceTier::TaggedSymbol
|
1065
|
+
)
|
1057
1066
|
|
1058
1067
|
sig do
|
1059
1068
|
override.returns(
|