Skip to content

Commit 1b27b5a

Browse files
fix(api): readd phase
1 parent 44fb382 commit 1b27b5a

10 files changed

Lines changed: 54 additions & 5 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: 148
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

src/openai/resources/responses/responses.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,6 +1660,7 @@ def compact(
16601660
input: Union[str, Iterable[ResponseInputItemParam], None] | Omit = omit,
16611661
instructions: Optional[str] | Omit = omit,
16621662
previous_response_id: Optional[str] | Omit = omit,
1663+
prompt_cache_key: Optional[str] | Omit = omit,
16631664
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
16641665
# The extra values given here take precedence over values defined on the client or passed to this method.
16651666
extra_headers: Headers | None = None,
@@ -1695,6 +1696,8 @@ def compact(
16951696
[conversation state](https://platform.openai.com/docs/guides/conversation-state).
16961697
Cannot be used in conjunction with `conversation`.
16971698
1699+
prompt_cache_key: A key to use when reading from or writing to the prompt cache.
1700+
16981701
extra_headers: Send extra headers
16991702
17001703
extra_query: Add additional query parameters to the request
@@ -1711,6 +1714,7 @@ def compact(
17111714
"input": input,
17121715
"instructions": instructions,
17131716
"previous_response_id": previous_response_id,
1717+
"prompt_cache_key": prompt_cache_key,
17141718
},
17151719
response_compact_params.ResponseCompactParams,
17161720
),
@@ -3321,6 +3325,7 @@ async def compact(
33213325
input: Union[str, Iterable[ResponseInputItemParam], None] | Omit = omit,
33223326
instructions: Optional[str] | Omit = omit,
33233327
previous_response_id: Optional[str] | Omit = omit,
3328+
prompt_cache_key: Optional[str] | Omit = omit,
33243329
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
33253330
# The extra values given here take precedence over values defined on the client or passed to this method.
33263331
extra_headers: Headers | None = None,
@@ -3356,6 +3361,8 @@ async def compact(
33563361
[conversation state](https://platform.openai.com/docs/guides/conversation-state).
33573362
Cannot be used in conjunction with `conversation`.
33583363
3364+
prompt_cache_key: A key to use when reading from or writing to the prompt cache.
3365+
33593366
extra_headers: Send extra headers
33603367
33613368
extra_query: Add additional query parameters to the request
@@ -3372,6 +3379,7 @@ async def compact(
33723379
"input": input,
33733380
"instructions": instructions,
33743381
"previous_response_id": previous_response_id,
3382+
"prompt_cache_key": prompt_cache_key,
33753383
},
33763384
response_compact_params.ResponseCompactParams,
33773385
),

src/openai/types/responses/easy_input_message.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,13 @@ class EasyInputMessage(BaseModel):
3030
One of `user`, `assistant`, `system`, or `developer`.
3131
"""
3232

33+
phase: Optional[Literal["commentary"]] = None
34+
"""
35+
Labels an `assistant` message as intermediate commentary (`commentary`) or the
36+
final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when
37+
sending follow-up requests, preserve and resend phase on all assistant messages
38+
— dropping it can degrade performance. Not used for user messages.
39+
"""
40+
3341
type: Optional[Literal["message"]] = None
3442
"""The type of the message input. Always `message`."""

src/openai/types/responses/easy_input_message_param.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Union
5+
from typing import Union, Optional
66
from typing_extensions import Literal, Required, TypedDict
77

88
from .response_input_message_content_list_param import ResponseInputMessageContentListParam
@@ -31,5 +31,13 @@ class EasyInputMessageParam(TypedDict, total=False):
3131
One of `user`, `assistant`, `system`, or `developer`.
3232
"""
3333

34+
phase: Optional[Literal["commentary"]]
35+
"""
36+
Labels an `assistant` message as intermediate commentary (`commentary`) or the
37+
final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when
38+
sending follow-up requests, preserve and resend phase on all assistant messages
39+
— dropping it can degrade performance. Not used for user messages.
40+
"""
41+
3442
type: Literal["message"]
3543
"""The type of the message input. Always `message`."""

src/openai/types/responses/response_compact_params.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,6 @@ class ResponseCompactParams(TypedDict, total=False):
131131
[conversation state](https://platform.openai.com/docs/guides/conversation-state).
132132
Cannot be used in conjunction with `conversation`.
133133
"""
134+
135+
prompt_cache_key: Optional[str]
136+
"""A key to use when reading from or writing to the prompt cache."""

src/openai/types/responses/response_output_message.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import List, Union
3+
from typing import List, Union, Optional
44
from typing_extensions import Literal, Annotated, TypeAlias
55

66
from ..._utils import PropertyInfo
@@ -34,3 +34,11 @@ class ResponseOutputMessage(BaseModel):
3434

3535
type: Literal["message"]
3636
"""The type of the output message. Always `message`."""
37+
38+
phase: Optional[Literal["commentary"]] = None
39+
"""
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+
"""

src/openai/types/responses/response_output_message_param.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Union, Iterable
5+
from typing import Union, Iterable, Optional
66
from typing_extensions import Literal, Required, TypeAlias, TypedDict
77

88
from .response_output_text_param import ResponseOutputTextParam
@@ -34,3 +34,11 @@ class ResponseOutputMessageParam(TypedDict, total=False):
3434

3535
type: Required[Literal["message"]]
3636
"""The type of the output message. Always `message`."""
37+
38+
phase: Optional[Literal["commentary"]]
39+
"""
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+
"""

tests/api_resources/conversations/test_items.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def test_method_create_with_all_params(self, client: OpenAI) -> None:
4444
{
4545
"content": "string",
4646
"role": "user",
47+
"phase": "commentary",
4748
"type": "message",
4849
}
4950
],
@@ -285,6 +286,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncOpenAI) ->
285286
{
286287
"content": "string",
287288
"role": "user",
289+
"phase": "commentary",
288290
"type": "message",
289291
}
290292
],

tests/api_resources/test_conversations.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def test_method_create_with_all_params(self, client: OpenAI) -> None:
3232
{
3333
"content": "string",
3434
"role": "user",
35+
"phase": "commentary",
3536
"type": "message",
3637
}
3738
],
@@ -195,6 +196,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncOpenAI) ->
195196
{
196197
"content": "string",
197198
"role": "user",
199+
"phase": "commentary",
198200
"type": "message",
199201
}
200202
],

tests/api_resources/test_responses.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ def test_method_compact_with_all_params(self, client: OpenAI) -> None:
385385
input="string",
386386
instructions="instructions",
387387
previous_response_id="resp_123",
388+
prompt_cache_key="prompt_cache_key",
388389
)
389390
assert_matches_type(CompactedResponse, response, path=["response"])
390391

@@ -793,6 +794,7 @@ async def test_method_compact_with_all_params(self, async_client: AsyncOpenAI) -
793794
input="string",
794795
instructions="instructions",
795796
previous_response_id="resp_123",
797+
prompt_cache_key="prompt_cache_key",
796798
)
797799
assert_matches_type(CompactedResponse, response, path=["response"])
798800

0 commit comments

Comments
 (0)