Skip to content

Commit 5f65640

Browse files
fix(api): readd phase
1 parent c48ea23 commit 5f65640

14 files changed

Lines changed: 223 additions & 11 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 147
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-a0aa54a302fbd7fff4ed7ad8a8547587d37b63324fc4af652bfa685ee9f8da44.yml
3-
openapi_spec_hash: e45c5af19307cfc8b9baa4b8f8e865a0
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-ca4985bc94b25eac84a5d7538d1bdf134c9b99dae9e95f1eae0aae90130c4bf8.yml
3+
openapi_spec_hash: 855db4b2dbaf3f8f83afe0df66397c02
44
config_hash: 7f49c38fa3abe9b7038ffe62262c4912

lib/openai/models/responses/easy_input_message.rb

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,22 @@ class EasyInputMessage < OpenAI::Internal::Type::BaseModel
1818
# @return [Symbol, OpenAI::Models::Responses::EasyInputMessage::Role]
1919
required :role, enum: -> { OpenAI::Responses::EasyInputMessage::Role }
2020

21+
# @!attribute phase
22+
# Labels an `assistant` message as intermediate commentary (`commentary`) or the
23+
# final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when
24+
# sending follow-up requests, preserve and resend phase on all assistant messages
25+
# — dropping it can degrade performance. Not used for user messages.
26+
#
27+
# @return [Symbol, OpenAI::Models::Responses::EasyInputMessage::Phase, nil]
28+
optional :phase, enum: -> { OpenAI::Responses::EasyInputMessage::Phase }, nil?: true
29+
2130
# @!attribute type
2231
# The type of the message input. Always `message`.
2332
#
2433
# @return [Symbol, OpenAI::Models::Responses::EasyInputMessage::Type, nil]
2534
optional :type, enum: -> { OpenAI::Responses::EasyInputMessage::Type }
2635

27-
# @!method initialize(content:, role:, type: nil)
36+
# @!method initialize(content:, role:, phase: nil, type: nil)
2837
# Some parameter documentations has been truncated, see
2938
# {OpenAI::Models::Responses::EasyInputMessage} for more details.
3039
#
@@ -38,6 +47,8 @@ class EasyInputMessage < OpenAI::Internal::Type::BaseModel
3847
#
3948
# @param role [Symbol, OpenAI::Models::Responses::EasyInputMessage::Role] The role of the message input. One of `user`, `assistant`, `system`, or
4049
#
50+
# @param phase [Symbol, OpenAI::Models::Responses::EasyInputMessage::Phase, nil] Labels an `assistant` message as intermediate commentary (`commentary`) or the f
51+
#
4152
# @param type [Symbol, OpenAI::Models::Responses::EasyInputMessage::Type] The type of the message input. Always `message`.
4253

4354
# Text, image, or audio input to the model, used to generate a response. Can also
@@ -74,6 +85,21 @@ module Role
7485
# @return [Array<Symbol>]
7586
end
7687

88+
# Labels an `assistant` message as intermediate commentary (`commentary`) or the
89+
# final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when
90+
# sending follow-up requests, preserve and resend phase on all assistant messages
91+
# — dropping it can degrade performance. Not used for user messages.
92+
#
93+
# @see OpenAI::Models::Responses::EasyInputMessage#phase
94+
module Phase
95+
extend OpenAI::Internal::Type::Enum
96+
97+
COMMENTARY = :commentary
98+
99+
# @!method self.values
100+
# @return [Array<Symbol>]
101+
end
102+
77103
# The type of the message input. Always `message`.
78104
#
79105
# @see OpenAI::Models::Responses::EasyInputMessage#type

lib/openai/models/responses/response_compact_params.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@ class ResponseCompactParams < OpenAI::Internal::Type::BaseModel
4242
# @return [String, nil]
4343
optional :previous_response_id, String, nil?: true
4444

45-
# @!method initialize(model:, input: nil, instructions: nil, previous_response_id: nil, request_options: {})
45+
# @!attribute prompt_cache_key
46+
# A key to use when reading from or writing to the prompt cache.
47+
#
48+
# @return [String, nil]
49+
optional :prompt_cache_key, String, nil?: true
50+
51+
# @!method initialize(model:, input: nil, instructions: nil, previous_response_id: nil, prompt_cache_key: nil, request_options: {})
4652
# Some parameter documentations has been truncated, see
4753
# {OpenAI::Models::Responses::ResponseCompactParams} for more details.
4854
#
@@ -54,6 +60,8 @@ class ResponseCompactParams < OpenAI::Internal::Type::BaseModel
5460
#
5561
# @param previous_response_id [String, nil] The unique ID of the previous response to the model. Use this to create multi-tu
5662
#
63+
# @param prompt_cache_key [String, nil] A key to use when reading from or writing to the prompt cache.
64+
#
5765
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
5866

5967
# Model ID used to generate the response, like `gpt-5` or `o3`. OpenAI offers a

lib/openai/models/responses/response_output_message.rb

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,16 @@ class ResponseOutputMessage < OpenAI::Internal::Type::BaseModel
3636
# @return [Symbol, :message]
3737
required :type, const: :message
3838

39-
# @!method initialize(id:, content:, status:, role: :assistant, type: :message)
39+
# @!attribute phase
40+
# Labels an `assistant` message as intermediate commentary (`commentary`) or the
41+
# final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when
42+
# sending follow-up requests, preserve and resend phase on all assistant messages
43+
# — dropping it can degrade performance. Not used for user messages.
44+
#
45+
# @return [Symbol, OpenAI::Models::Responses::ResponseOutputMessage::Phase, nil]
46+
optional :phase, enum: -> { OpenAI::Responses::ResponseOutputMessage::Phase }, nil?: true
47+
48+
# @!method initialize(id:, content:, status:, phase: nil, role: :assistant, type: :message)
4049
# Some parameter documentations has been truncated, see
4150
# {OpenAI::Models::Responses::ResponseOutputMessage} for more details.
4251
#
@@ -48,6 +57,8 @@ class ResponseOutputMessage < OpenAI::Internal::Type::BaseModel
4857
#
4958
# @param status [Symbol, OpenAI::Models::Responses::ResponseOutputMessage::Status] The status of the message input. One of `in_progress`, `completed`, or
5059
#
60+
# @param phase [Symbol, OpenAI::Models::Responses::ResponseOutputMessage::Phase, nil] Labels an `assistant` message as intermediate commentary (`commentary`) or the f
61+
#
5162
# @param role [Symbol, :assistant] The role of the output message. Always `assistant`.
5263
#
5364
# @param type [Symbol, :message] The type of the output message. Always `message`.
@@ -82,6 +93,21 @@ module Status
8293
# @!method self.values
8394
# @return [Array<Symbol>]
8495
end
96+
97+
# Labels an `assistant` message as intermediate commentary (`commentary`) or the
98+
# final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when
99+
# sending follow-up requests, preserve and resend phase on all assistant messages
100+
# — dropping it can degrade performance. Not used for user messages.
101+
#
102+
# @see OpenAI::Models::Responses::ResponseOutputMessage#phase
103+
module Phase
104+
extend OpenAI::Internal::Type::Enum
105+
106+
COMMENTARY = :commentary
107+
108+
# @!method self.values
109+
# @return [Array<Symbol>]
110+
end
85111
end
86112
end
87113
end

lib/openai/resources/responses.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ def cancel(response_id, params = {})
473473
# For ZDR-compatible compaction details, see
474474
# [Compaction (advanced)](https://platform.openai.com/docs/guides/conversation-state#compaction-advanced).
475475
#
476-
# @overload compact(model:, input: nil, instructions: nil, previous_response_id: nil, request_options: {})
476+
# @overload compact(model:, input: nil, instructions: nil, previous_response_id: nil, prompt_cache_key: nil, request_options: {})
477477
#
478478
# @param model [Symbol, String, OpenAI::Models::Responses::ResponseCompactParams::Model, nil] Model ID used to generate the response, like `gpt-5` or `o3`. OpenAI offers a wi
479479
#
@@ -483,6 +483,8 @@ def cancel(response_id, params = {})
483483
#
484484
# @param previous_response_id [String, nil] The unique ID of the previous response to the model. Use this to create multi-tu
485485
#
486+
# @param prompt_cache_key [String, nil] A key to use when reading from or writing to the prompt cache.
487+
#
486488
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
487489
#
488490
# @return [OpenAI::Models::Responses::CompactedResponse]

rbi/openai/models/responses/easy_input_message.rbi

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ module OpenAI
2222
sig { returns(OpenAI::Responses::EasyInputMessage::Role::OrSymbol) }
2323
attr_accessor :role
2424

25+
# Labels an `assistant` message as intermediate commentary (`commentary`) or the
26+
# final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when
27+
# sending follow-up requests, preserve and resend phase on all assistant messages
28+
# — dropping it can degrade performance. Not used for user messages.
29+
sig do
30+
returns(
31+
T.nilable(OpenAI::Responses::EasyInputMessage::Phase::OrSymbol)
32+
)
33+
end
34+
attr_accessor :phase
35+
2536
# The type of the message input. Always `message`.
2637
sig do
2738
returns(
@@ -44,6 +55,8 @@ module OpenAI
4455
params(
4556
content: OpenAI::Responses::EasyInputMessage::Content::Variants,
4657
role: OpenAI::Responses::EasyInputMessage::Role::OrSymbol,
58+
phase:
59+
T.nilable(OpenAI::Responses::EasyInputMessage::Phase::OrSymbol),
4760
type: OpenAI::Responses::EasyInputMessage::Type::OrSymbol
4861
).returns(T.attached_class)
4962
end
@@ -54,6 +67,11 @@ module OpenAI
5467
# The role of the message input. One of `user`, `assistant`, `system`, or
5568
# `developer`.
5669
role:,
70+
# Labels an `assistant` message as intermediate commentary (`commentary`) or the
71+
# final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when
72+
# sending follow-up requests, preserve and resend phase on all assistant messages
73+
# — dropping it can degrade performance. Not used for user messages.
74+
phase: nil,
5775
# The type of the message input. Always `message`.
5876
type: nil
5977
)
@@ -64,6 +82,8 @@ module OpenAI
6482
{
6583
content: OpenAI::Responses::EasyInputMessage::Content::Variants,
6684
role: OpenAI::Responses::EasyInputMessage::Role::OrSymbol,
85+
phase:
86+
T.nilable(OpenAI::Responses::EasyInputMessage::Phase::OrSymbol),
6787
type: OpenAI::Responses::EasyInputMessage::Type::OrSymbol
6888
}
6989
)
@@ -134,6 +154,34 @@ module OpenAI
134154
end
135155
end
136156

157+
# Labels an `assistant` message as intermediate commentary (`commentary`) or the
158+
# final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when
159+
# sending follow-up requests, preserve and resend phase on all assistant messages
160+
# — dropping it can degrade performance. Not used for user messages.
161+
module Phase
162+
extend OpenAI::Internal::Type::Enum
163+
164+
TaggedSymbol =
165+
T.type_alias do
166+
T.all(Symbol, OpenAI::Responses::EasyInputMessage::Phase)
167+
end
168+
OrSymbol = T.type_alias { T.any(Symbol, String) }
169+
170+
COMMENTARY =
171+
T.let(
172+
:commentary,
173+
OpenAI::Responses::EasyInputMessage::Phase::TaggedSymbol
174+
)
175+
176+
sig do
177+
override.returns(
178+
T::Array[OpenAI::Responses::EasyInputMessage::Phase::TaggedSymbol]
179+
)
180+
end
181+
def self.values
182+
end
183+
end
184+
137185
# The type of the message input. Always `message`.
138186
module Type
139187
extend OpenAI::Internal::Type::Enum

rbi/openai/models/responses/response_compact_params.rbi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ module OpenAI
5454
sig { returns(T.nilable(String)) }
5555
attr_accessor :previous_response_id
5656

57+
# A key to use when reading from or writing to the prompt cache.
58+
sig { returns(T.nilable(String)) }
59+
attr_accessor :prompt_cache_key
60+
5761
sig do
5862
params(
5963
model:
@@ -69,6 +73,7 @@ module OpenAI
6973
),
7074
instructions: T.nilable(String),
7175
previous_response_id: T.nilable(String),
76+
prompt_cache_key: T.nilable(String),
7277
request_options: OpenAI::RequestOptions::OrHash
7378
).returns(T.attached_class)
7479
end
@@ -91,6 +96,8 @@ module OpenAI
9196
# [conversation state](https://platform.openai.com/docs/guides/conversation-state).
9297
# Cannot be used in conjunction with `conversation`.
9398
previous_response_id: nil,
99+
# A key to use when reading from or writing to the prompt cache.
100+
prompt_cache_key: nil,
94101
request_options: {}
95102
)
96103
end
@@ -111,6 +118,7 @@ module OpenAI
111118
),
112119
instructions: T.nilable(String),
113120
previous_response_id: T.nilable(String),
121+
prompt_cache_key: T.nilable(String),
114122
request_options: OpenAI::RequestOptions
115123
}
116124
)

rbi/openai/models/responses/response_output_message.rbi

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ module OpenAI
4444
sig { returns(Symbol) }
4545
attr_accessor :type
4646

47+
# Labels an `assistant` message as intermediate commentary (`commentary`) or the
48+
# final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when
49+
# sending follow-up requests, preserve and resend phase on all assistant messages
50+
# — dropping it can degrade performance. Not used for user messages.
51+
sig do
52+
returns(
53+
T.nilable(OpenAI::Responses::ResponseOutputMessage::Phase::OrSymbol)
54+
)
55+
end
56+
attr_accessor :phase
57+
4758
# An output message from the model.
4859
sig do
4960
params(
@@ -56,6 +67,10 @@ module OpenAI
5667
)
5768
],
5869
status: OpenAI::Responses::ResponseOutputMessage::Status::OrSymbol,
70+
phase:
71+
T.nilable(
72+
OpenAI::Responses::ResponseOutputMessage::Phase::OrSymbol
73+
),
5974
role: Symbol,
6075
type: Symbol
6176
).returns(T.attached_class)
@@ -68,6 +83,11 @@ module OpenAI
6883
# The status of the message input. One of `in_progress`, `completed`, or
6984
# `incomplete`. Populated when input items are returned via API.
7085
status:,
86+
# Labels an `assistant` message as intermediate commentary (`commentary`) or the
87+
# final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when
88+
# sending follow-up requests, preserve and resend phase on all assistant messages
89+
# — dropping it can degrade performance. Not used for user messages.
90+
phase: nil,
7191
# The role of the output message. Always `assistant`.
7292
role: :assistant,
7393
# The type of the output message. Always `message`.
@@ -89,7 +109,11 @@ module OpenAI
89109
role: Symbol,
90110
status:
91111
OpenAI::Responses::ResponseOutputMessage::Status::OrSymbol,
92-
type: Symbol
112+
type: Symbol,
113+
phase:
114+
T.nilable(
115+
OpenAI::Responses::ResponseOutputMessage::Phase::OrSymbol
116+
)
93117
}
94118
)
95119
end
@@ -156,6 +180,36 @@ module OpenAI
156180
def self.values
157181
end
158182
end
183+
184+
# Labels an `assistant` message as intermediate commentary (`commentary`) or the
185+
# final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when
186+
# sending follow-up requests, preserve and resend phase on all assistant messages
187+
# — dropping it can degrade performance. Not used for user messages.
188+
module Phase
189+
extend OpenAI::Internal::Type::Enum
190+
191+
TaggedSymbol =
192+
T.type_alias do
193+
T.all(Symbol, OpenAI::Responses::ResponseOutputMessage::Phase)
194+
end
195+
OrSymbol = T.type_alias { T.any(Symbol, String) }
196+
197+
COMMENTARY =
198+
T.let(
199+
:commentary,
200+
OpenAI::Responses::ResponseOutputMessage::Phase::TaggedSymbol
201+
)
202+
203+
sig do
204+
override.returns(
205+
T::Array[
206+
OpenAI::Responses::ResponseOutputMessage::Phase::TaggedSymbol
207+
]
208+
)
209+
end
210+
def self.values
211+
end
212+
end
159213
end
160214
end
161215
end

rbi/openai/resources/responses.rbi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,7 @@ module OpenAI
981981
),
982982
instructions: T.nilable(String),
983983
previous_response_id: T.nilable(String),
984+
prompt_cache_key: T.nilable(String),
984985
request_options: OpenAI::RequestOptions::OrHash
985986
).returns(OpenAI::Responses::CompactedResponse)
986987
end
@@ -1003,6 +1004,8 @@ module OpenAI
10031004
# [conversation state](https://platform.openai.com/docs/guides/conversation-state).
10041005
# Cannot be used in conjunction with `conversation`.
10051006
previous_response_id: nil,
1007+
# A key to use when reading from or writing to the prompt cache.
1008+
prompt_cache_key: nil,
10061009
request_options: {}
10071010
)
10081011
end

0 commit comments

Comments
 (0)