Skip to content

Commit 808f52e

Browse files
feat(api): add gpt-4.5-preview (#2149)
1 parent 98477ad commit 808f52e

File tree

12 files changed

+77
-20
lines changed

12 files changed

+77
-20
lines changed

Diff for: .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

Diff for: 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",

Diff for: src/openai/resources/beta/realtime/realtime.py

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

550550
class RealtimeSessionResource(BaseRealtimeConnectionResource):
551551
def update(self, *, session: session_update_event_param.Session, event_id: str | NotGiven = NOT_GIVEN) -> None:
552-
"""Send this event to update the session’s default configuration.
552+
"""
553+
Send this event to update the session’s default configuration.
554+
The client may send this event at any time to update any field,
555+
except for `voice`. However, note that once a session has been
556+
initialized with a particular `model`, it can’t be changed to
557+
another model using `session.update`.
553558
554-
The client may
555-
send this event at any time to update the session configuration, and any
556-
field may be updated at any time, except for "voice". The server will respond
557-
with a `session.updated` event that shows the full effective configuration.
558-
Only fields that are present are updated, thus the correct way to clear a
559-
field like "instructions" is to pass an empty string.
559+
When the server receives a `session.update`, it will respond
560+
with a `session.updated` event showing the full, effective configuration.
561+
Only the fields that are present are updated. To clear a field like
562+
`instructions`, pass an empty string.
560563
"""
561564
self._connection.send(
562565
cast(
@@ -756,14 +759,17 @@ class AsyncRealtimeSessionResource(BaseAsyncRealtimeConnectionResource):
756759
async def update(
757760
self, *, session: session_update_event_param.Session, event_id: str | NotGiven = NOT_GIVEN
758761
) -> None:
759-
"""Send this event to update the session’s default configuration.
760-
761-
The client may
762-
send this event at any time to update the session configuration, and any
763-
field may be updated at any time, except for "voice". The server will respond
764-
with a `session.updated` event that shows the full effective configuration.
765-
Only fields that are present are updated, thus the correct way to clear a
766-
field like "instructions" is to pass an empty string.
762+
"""
763+
Send this event to update the session’s default configuration.
764+
The client may send this event at any time to update any field,
765+
except for `voice`. However, note that once a session has been
766+
initialized with a particular `model`, it can’t be changed to
767+
another model using `session.update`.
768+
769+
When the server receives a `session.update`, it will respond
770+
with a `session.updated` event showing the full, effective configuration.
771+
Only the fields that are present are updated. To clear a field like
772+
`instructions`, pass an empty string.
767773
"""
768774
await self._connection.send(
769775
cast(

Diff for: 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",

Diff for: 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

Diff for: 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

Diff for: 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

Diff for: 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

Diff for: 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",

Diff for: 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

Diff for: 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."""

Diff for: 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)