Skip to content

Commit 72366d8

Browse files
feat(api): add phase
1 parent bed1503 commit 72366d8

5 files changed

Lines changed: 79 additions & 6 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: 135
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-427cc4911647924492f14cecdb46eba053c132b1d216dc191d2e34f0be3ed3cf.yml
3+
openapi_spec_hash: 958b9c5c6a54682b5ffde920610cae9a
44
config_hash: 7f49c38fa3abe9b7038ffe62262c4912

conversations/conversation_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ func TestConversationNewWithOptionalParams(t *testing.T) {
3434
Content: responses.EasyInputMessageContentUnionParam{
3535
OfString: openai.String("string"),
3636
},
37-
Role: responses.EasyInputMessageRoleUser,
38-
Type: responses.EasyInputMessageTypeMessage,
37+
Role: responses.EasyInputMessageRoleUser,
38+
Phase: responses.EasyInputMessagePhaseCommentary,
39+
Type: responses.EasyInputMessageTypeMessage,
3940
},
4041
}},
4142
Metadata: shared.Metadata{

conversations/item_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ func TestItemNewWithOptionalParams(t *testing.T) {
3636
Content: responses.EasyInputMessageContentUnionParam{
3737
OfString: openai.String("string"),
3838
},
39-
Role: responses.EasyInputMessageRoleUser,
40-
Type: responses.EasyInputMessageTypeMessage,
39+
Role: responses.EasyInputMessageRoleUser,
40+
Phase: responses.EasyInputMessagePhaseCommentary,
41+
Type: responses.EasyInputMessageTypeMessage,
4142
},
4243
}},
4344
Include: []responses.ResponseIncludable{responses.ResponseIncludableFileSearchCallResults},

responses/response.go

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,13 @@ type EasyInputMessage struct {
958958
//
959959
// Any of "user", "assistant", "system", "developer".
960960
Role EasyInputMessageRole `json:"role" api:"required"`
961+
// Labels an assistant message as intermediate commentary ("commentary") or the
962+
// final answer ("final_answer"). For models like gpt-5.3-codex and beyond, when
963+
// sending follow-up requests, preserve and resend phase on all assistant messages
964+
// — dropping it can degrade performance. Not used for user messages.
965+
//
966+
// Any of "commentary".
967+
Phase EasyInputMessagePhase `json:"phase" api:"nullable"`
961968
// The type of the message input. Always `message`.
962969
//
963970
// Any of "message".
@@ -966,6 +973,7 @@ type EasyInputMessage struct {
966973
JSON struct {
967974
Content respjson.Field
968975
Role respjson.Field
976+
Phase respjson.Field
969977
Type respjson.Field
970978
ExtraFields map[string]respjson.Field
971979
raw string
@@ -1035,6 +1043,16 @@ const (
10351043
EasyInputMessageRoleDeveloper EasyInputMessageRole = "developer"
10361044
)
10371045

1046+
// Labels an assistant message as intermediate commentary ("commentary") or the
1047+
// final answer ("final_answer"). For models like gpt-5.3-codex and beyond, when
1048+
// sending follow-up requests, preserve and resend phase on all assistant messages
1049+
// — dropping it can degrade performance. Not used for user messages.
1050+
type EasyInputMessagePhase string
1051+
1052+
const (
1053+
EasyInputMessagePhaseCommentary EasyInputMessagePhase = "commentary"
1054+
)
1055+
10381056
// The type of the message input. Always `message`.
10391057
type EasyInputMessageType string
10401058

@@ -1058,6 +1076,13 @@ type EasyInputMessageParam struct {
10581076
//
10591077
// Any of "user", "assistant", "system", "developer".
10601078
Role EasyInputMessageRole `json:"role,omitzero" api:"required"`
1079+
// Labels an assistant message as intermediate commentary ("commentary") or the
1080+
// final answer ("final_answer"). For models like gpt-5.3-codex and beyond, when
1081+
// sending follow-up requests, preserve and resend phase on all assistant messages
1082+
// — dropping it can degrade performance. Not used for user messages.
1083+
//
1084+
// Any of "commentary".
1085+
Phase EasyInputMessagePhase `json:"phase,omitzero"`
10611086
// The type of the message input. Always `message`.
10621087
//
10631088
// Any of "message".
@@ -8270,6 +8295,7 @@ type ResponseInputItemUnion struct {
82708295
// [[]ResponseReasoningItemContent]
82718296
Content ResponseInputItemUnionContent `json:"content"`
82728297
Role string `json:"role"`
8298+
Phase string `json:"phase"`
82738299
// Any of "message", "message", "message", "file_search_call", "computer_call",
82748300
// "computer_call_output", "web_search_call", "function_call",
82758301
// "function_call_output", "reasoning", "compaction", "image_generation_call",
@@ -8332,6 +8358,7 @@ type ResponseInputItemUnion struct {
83328358
JSON struct {
83338359
Content respjson.Field
83348360
Role respjson.Field
8361+
Phase respjson.Field
83358362
Type respjson.Field
83368363
Status respjson.Field
83378364
ID respjson.Field
@@ -10098,6 +10125,16 @@ func (u ResponseInputItemUnionParam) GetRole() *string {
1009810125
return nil
1009910126
}
1010010127

10128+
// Returns a pointer to the underlying variant's property, if present.
10129+
func (u ResponseInputItemUnionParam) GetPhase() *string {
10130+
if vt := u.OfMessage; vt != nil {
10131+
return (*string)(&vt.Phase)
10132+
} else if vt := u.OfOutputMessage; vt != nil {
10133+
return (*string)(&vt.Phase)
10134+
}
10135+
return nil
10136+
}
10137+
1010110138
// Returns a pointer to the underlying variant's property, if present.
1010210139
func (u ResponseInputItemUnionParam) GetType() *string {
1010310140
if vt := u.OfMessage; vt != nil {
@@ -11759,6 +11796,8 @@ type ResponseItemUnion struct {
1175911796
// "shell_call_output", "apply_patch_call", "apply_patch_call_output",
1176011797
// "mcp_list_tools", "mcp_approval_request", "mcp_approval_response", "mcp_call".
1176111798
Type string `json:"type"`
11799+
// This field is from variant [ResponseOutputMessage].
11800+
Phase ResponseOutputMessagePhase `json:"phase"`
1176211801
// This field is from variant [ResponseFileSearchToolCall].
1176311802
Queries []string `json:"queries"`
1176411803
// This field is from variant [ResponseFileSearchToolCall].
@@ -11808,6 +11847,7 @@ type ResponseItemUnion struct {
1180811847
Role respjson.Field
1180911848
Status respjson.Field
1181011849
Type respjson.Field
11850+
Phase respjson.Field
1181111851
Queries respjson.Field
1181211852
Results respjson.Field
1181311853
Action respjson.Field
@@ -12737,6 +12777,8 @@ type ResponseOutputItemUnion struct {
1273712777
// "apply_patch_call", "apply_patch_call_output", "mcp_call", "mcp_list_tools",
1273812778
// "mcp_approval_request", "custom_tool_call".
1273912779
Type string `json:"type"`
12780+
// This field is from variant [ResponseOutputMessage].
12781+
Phase ResponseOutputMessagePhase `json:"phase"`
1274012782
// This field is from variant [ResponseFileSearchToolCall].
1274112783
Queries []string `json:"queries"`
1274212784
// This field is from variant [ResponseFileSearchToolCall].
@@ -12785,6 +12827,7 @@ type ResponseOutputItemUnion struct {
1278512827
Role respjson.Field
1278612828
Status respjson.Field
1278712829
Type respjson.Field
12830+
Phase respjson.Field
1278812831
Queries respjson.Field
1278912832
Results respjson.Field
1279012833
Arguments respjson.Field
@@ -13398,13 +13441,21 @@ type ResponseOutputMessage struct {
1339813441
Status ResponseOutputMessageStatus `json:"status" api:"required"`
1339913442
// The type of the output message. Always `message`.
1340013443
Type constant.Message `json:"type" api:"required"`
13444+
// Labels an assistant message as intermediate commentary ("commentary") or the
13445+
// final answer ("final_answer"). For models like gpt-5.3-codex and beyond, when
13446+
// sending follow-up requests, preserve and resend phase on all assistant messages
13447+
// — dropping it can degrade performance. Not used for user messages.
13448+
//
13449+
// Any of "commentary".
13450+
Phase ResponseOutputMessagePhase `json:"phase" api:"nullable"`
1340113451
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
1340213452
JSON struct {
1340313453
ID respjson.Field
1340413454
Content respjson.Field
1340513455
Role respjson.Field
1340613456
Status respjson.Field
1340713457
Type respjson.Field
13458+
Phase respjson.Field
1340813459
ExtraFields map[string]respjson.Field
1340913460
raw string
1341013461
} `json:"-"`
@@ -13508,6 +13559,16 @@ const (
1350813559
ResponseOutputMessageStatusIncomplete ResponseOutputMessageStatus = "incomplete"
1350913560
)
1351013561

13562+
// Labels an assistant message as intermediate commentary ("commentary") or the
13563+
// final answer ("final_answer"). For models like gpt-5.3-codex and beyond, when
13564+
// sending follow-up requests, preserve and resend phase on all assistant messages
13565+
// — dropping it can degrade performance. Not used for user messages.
13566+
type ResponseOutputMessagePhase string
13567+
13568+
const (
13569+
ResponseOutputMessagePhaseCommentary ResponseOutputMessagePhase = "commentary"
13570+
)
13571+
1351113572
// An output message from the model.
1351213573
//
1351313574
// The properties ID, Content, Role, Status, Type are required.
@@ -13521,6 +13582,13 @@ type ResponseOutputMessageParam struct {
1352113582
//
1352213583
// Any of "in_progress", "completed", "incomplete".
1352313584
Status ResponseOutputMessageStatus `json:"status,omitzero" api:"required"`
13585+
// Labels an assistant message as intermediate commentary ("commentary") or the
13586+
// final answer ("final_answer"). For models like gpt-5.3-codex and beyond, when
13587+
// sending follow-up requests, preserve and resend phase on all assistant messages
13588+
// — dropping it can degrade performance. Not used for user messages.
13589+
//
13590+
// Any of "commentary".
13591+
Phase ResponseOutputMessagePhase `json:"phase,omitzero"`
1352413592
// The role of the output message. Always `assistant`.
1352513593
//
1352613594
// This field can be elided, and will marshal its zero value as "assistant".
@@ -19509,6 +19577,8 @@ type ResponseCompactParams struct {
1950919577
// [conversation state](https://platform.openai.com/docs/guides/conversation-state).
1951019578
// Cannot be used in conjunction with `conversation`.
1951119579
PreviousResponseID param.Opt[string] `json:"previous_response_id,omitzero"`
19580+
// A key to use when reading from or writing to the prompt cache.
19581+
PromptCacheKey param.Opt[string] `json:"prompt_cache_key,omitzero"`
1951219582
// Text, image, or file inputs to the model, used to generate a response
1951319583
Input ResponseCompactParamsInputUnion `json:"input,omitzero"`
1951419584
paramObj

responses/response_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ func TestResponseCompactWithOptionalParams(t *testing.T) {
198198
},
199199
Instructions: openai.String("instructions"),
200200
PreviousResponseID: openai.String("resp_123"),
201+
PromptCacheKey: openai.String("prompt_cache_key"),
201202
})
202203
if err != nil {
203204
var apierr *openai.Error

0 commit comments

Comments
 (0)