Skip to content

Commit 0c62beb

Browse files
feat(api): add gpt-4.5-preview (#2149)
1 parent 5bde572 commit 0c62beb

12 files changed

+77
-20
lines changed

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 74
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-4aa6ee65ba9efc789e05e6a5ef0883b2cadf06def8efd863dbf75e9e233067e1.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-5d30684c3118d049682ea30cdb4dbef39b97d51667da484689193dc40162af32.yml

src/openai/resources/beta/assistants.py

+4
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ def update(
232232
"gpt-4o-2024-05-13",
233233
"gpt-4o-mini",
234234
"gpt-4o-mini-2024-07-18",
235+
"gpt-4.5-preview",
236+
"gpt-4.5-preview-2025-02-27",
235237
"gpt-4-turbo",
236238
"gpt-4-turbo-2024-04-09",
237239
"gpt-4-0125-preview",
@@ -673,6 +675,8 @@ async def update(
673675
"gpt-4o-2024-05-13",
674676
"gpt-4o-mini",
675677
"gpt-4o-mini-2024-07-18",
678+
"gpt-4.5-preview",
679+
"gpt-4.5-preview-2025-02-27",
676680
"gpt-4-turbo",
677681
"gpt-4-turbo-2024-04-09",
678682
"gpt-4-0125-preview",

src/openai/resources/beta/realtime/realtime.py

+21-15
Original file line numberDiff line numberDiff line change
@@ -561,14 +561,17 @@ def __init__(self, connection: RealtimeConnection) -> None:
561561

562562
class RealtimeSessionResource(BaseRealtimeConnectionResource):
563563
def update(self, *, session: session_update_event_param.Session, event_id: str | NotGiven = NOT_GIVEN) -> None:
564-
"""Send this event to update the session’s default configuration.
564+
"""
565+
Send this event to update the session’s default configuration.
566+
The client may send this event at any time to update any field,
567+
except for `voice`. However, note that once a session has been
568+
initialized with a particular `model`, it can’t be changed to
569+
another model using `session.update`.
565570
566-
The client may
567-
send this event at any time to update the session configuration, and any
568-
field may be updated at any time, except for "voice". The server will respond
569-
with a `session.updated` event that shows the full effective configuration.
570-
Only fields that are present are updated, thus the correct way to clear a
571-
field like "instructions" is to pass an empty string.
571+
When the server receives a `session.update`, it will respond
572+
with a `session.updated` event showing the full, effective configuration.
573+
Only the fields that are present are updated. To clear a field like
574+
`instructions`, pass an empty string.
572575
"""
573576
self._connection.send(
574577
cast(
@@ -768,14 +771,17 @@ class AsyncRealtimeSessionResource(BaseAsyncRealtimeConnectionResource):
768771
async def update(
769772
self, *, session: session_update_event_param.Session, event_id: str | NotGiven = NOT_GIVEN
770773
) -> None:
771-
"""Send this event to update the session’s default configuration.
772-
773-
The client may
774-
send this event at any time to update the session configuration, and any
775-
field may be updated at any time, except for "voice". The server will respond
776-
with a `session.updated` event that shows the full effective configuration.
777-
Only fields that are present are updated, thus the correct way to clear a
778-
field like "instructions" is to pass an empty string.
774+
"""
775+
Send this event to update the session’s default configuration.
776+
The client may send this event at any time to update any field,
777+
except for `voice`. However, note that once a session has been
778+
initialized with a particular `model`, it can’t be changed to
779+
another model using `session.update`.
780+
781+
When the server receives a `session.update`, it will respond
782+
with a `session.updated` event showing the full, effective configuration.
783+
Only the fields that are present are updated. To clear a field like
784+
`instructions`, pass an empty string.
779785
"""
780786
await self._connection.send(
781787
cast(

src/openai/types/beta/assistant_update_params.py

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ class AssistantUpdateParams(TypedDict, total=False):
4545
"gpt-4o-2024-05-13",
4646
"gpt-4o-mini",
4747
"gpt-4o-mini-2024-07-18",
48+
"gpt-4.5-preview",
49+
"gpt-4.5-preview-2025-02-27",
4850
"gpt-4-turbo",
4951
"gpt-4-turbo-2024-04-09",
5052
"gpt-4-0125-preview",

src/openai/types/beta/realtime/session.py

+14
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,20 @@ class Tool(BaseModel):
3434

3535

3636
class TurnDetection(BaseModel):
37+
create_response: Optional[bool] = None
38+
"""Whether or not to automatically generate a response when a VAD stop event
39+
occurs.
40+
41+
`true` by default.
42+
"""
43+
44+
interrupt_response: Optional[bool] = None
45+
"""
46+
Whether or not to automatically interrupt any ongoing response with output to
47+
the default conversation (i.e. `conversation` of `auto`) when a VAD start event
48+
occurs. `true` by default.
49+
"""
50+
3751
prefix_padding_ms: Optional[int] = None
3852
"""Amount of audio to include before the VAD detected speech (in milliseconds).
3953

src/openai/types/beta/realtime/session_create_params.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,19 @@ class Tool(TypedDict, total=False):
146146

147147
class TurnDetection(TypedDict, total=False):
148148
create_response: bool
149-
"""Whether or not to automatically generate a response when VAD is enabled.
149+
"""Whether or not to automatically generate a response when a VAD stop event
150+
occurs.
150151
151152
`true` by default.
152153
"""
153154

155+
interrupt_response: bool
156+
"""
157+
Whether or not to automatically interrupt any ongoing response with output to
158+
the default conversation (i.e. `conversation` of `auto`) when a VAD start event
159+
occurs. `true` by default.
160+
"""
161+
154162
prefix_padding_ms: int
155163
"""Amount of audio to include before the VAD detected speech (in milliseconds).
156164

src/openai/types/beta/realtime/session_update_event.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,19 @@ class SessionTool(BaseModel):
5151

5252
class SessionTurnDetection(BaseModel):
5353
create_response: Optional[bool] = None
54-
"""Whether or not to automatically generate a response when VAD is enabled.
54+
"""Whether or not to automatically generate a response when a VAD stop event
55+
occurs.
5556
5657
`true` by default.
5758
"""
5859

60+
interrupt_response: Optional[bool] = None
61+
"""
62+
Whether or not to automatically interrupt any ongoing response with output to
63+
the default conversation (i.e. `conversation` of `auto`) when a VAD start event
64+
occurs. `true` by default.
65+
"""
66+
5967
prefix_padding_ms: Optional[int] = None
6068
"""Amount of audio to include before the VAD detected speech (in milliseconds).
6169

src/openai/types/beta/realtime/session_update_event_param.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,19 @@ class SessionTool(TypedDict, total=False):
5757

5858
class SessionTurnDetection(TypedDict, total=False):
5959
create_response: bool
60-
"""Whether or not to automatically generate a response when VAD is enabled.
60+
"""Whether or not to automatically generate a response when a VAD stop event
61+
occurs.
6162
6263
`true` by default.
6364
"""
6465

66+
interrupt_response: bool
67+
"""
68+
Whether or not to automatically interrupt any ongoing response with output to
69+
the default conversation (i.e. `conversation` of `auto`) when a VAD start event
70+
occurs. `true` by default.
71+
"""
72+
6573
prefix_padding_ms: int
6674
"""Amount of audio to include before the VAD detected speech (in milliseconds).
6775

src/openai/types/chat_model.py

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
"o1-preview-2024-09-12",
1414
"o1-mini",
1515
"o1-mini-2024-09-12",
16+
"gpt-4.5-preview",
17+
"gpt-4.5-preview-2025-02-27",
1618
"gpt-4o",
1719
"gpt-4o-2024-11-20",
1820
"gpt-4o-2024-08-06",

src/openai/types/file_object.py

+3
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ class FileObject(BaseModel):
4040
`error`.
4141
"""
4242

43+
expires_at: Optional[int] = None
44+
"""The Unix timestamp (in seconds) for when the file will expire."""
45+
4346
status_details: Optional[str] = None
4447
"""Deprecated.
4548

src/openai/types/upload.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Upload(BaseModel):
2020
"""The Unix timestamp (in seconds) for when the Upload was created."""
2121

2222
expires_at: int
23-
"""The Unix timestamp (in seconds) for when the Upload was created."""
23+
"""The Unix timestamp (in seconds) for when the Upload will expire."""
2424

2525
filename: str
2626
"""The name of the file to be uploaded."""

tests/api_resources/beta/realtime/test_sessions.py

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def test_method_create_with_all_params(self, client: OpenAI) -> None:
4848
],
4949
turn_detection={
5050
"create_response": True,
51+
"interrupt_response": True,
5152
"prefix_padding_ms": 0,
5253
"silence_duration_ms": 0,
5354
"threshold": 0,
@@ -112,6 +113,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncOpenAI) ->
112113
],
113114
turn_detection={
114115
"create_response": True,
116+
"interrupt_response": True,
115117
"prefix_padding_ms": 0,
116118
"silence_duration_ms": 0,
117119
"threshold": 0,

0 commit comments

Comments
 (0)