Skip to content

Commit

Permalink
feat(api): add gpt-4.5-preview (#2149)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Feb 27, 2025
1 parent 5bde572 commit 0c62beb
Show file tree
Hide file tree
Showing 12 changed files with 77 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 74
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-4aa6ee65ba9efc789e05e6a5ef0883b2cadf06def8efd863dbf75e9e233067e1.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-5d30684c3118d049682ea30cdb4dbef39b97d51667da484689193dc40162af32.yml
4 changes: 4 additions & 0 deletions src/openai/resources/beta/assistants.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ def update(
"gpt-4o-2024-05-13",
"gpt-4o-mini",
"gpt-4o-mini-2024-07-18",
"gpt-4.5-preview",
"gpt-4.5-preview-2025-02-27",
"gpt-4-turbo",
"gpt-4-turbo-2024-04-09",
"gpt-4-0125-preview",
Expand Down Expand Up @@ -673,6 +675,8 @@ async def update(
"gpt-4o-2024-05-13",
"gpt-4o-mini",
"gpt-4o-mini-2024-07-18",
"gpt-4.5-preview",
"gpt-4.5-preview-2025-02-27",
"gpt-4-turbo",
"gpt-4-turbo-2024-04-09",
"gpt-4-0125-preview",
Expand Down
36 changes: 21 additions & 15 deletions src/openai/resources/beta/realtime/realtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,14 +561,17 @@ def __init__(self, connection: RealtimeConnection) -> None:

class RealtimeSessionResource(BaseRealtimeConnectionResource):
def update(self, *, session: session_update_event_param.Session, event_id: str | NotGiven = NOT_GIVEN) -> None:
"""Send this event to update the session’s default configuration.
"""
Send this event to update the session’s default configuration.
The client may send this event at any time to update any field,
except for `voice`. However, note that once a session has been
initialized with a particular `model`, it can’t be changed to
another model using `session.update`.
The client may
send this event at any time to update the session configuration, and any
field may be updated at any time, except for "voice". The server will respond
with a `session.updated` event that shows the full effective configuration.
Only fields that are present are updated, thus the correct way to clear a
field like "instructions" is to pass an empty string.
When the server receives a `session.update`, it will respond
with a `session.updated` event showing the full, effective configuration.
Only the fields that are present are updated. To clear a field like
`instructions`, pass an empty string.
"""
self._connection.send(
cast(
Expand Down Expand Up @@ -768,14 +771,17 @@ class AsyncRealtimeSessionResource(BaseAsyncRealtimeConnectionResource):
async def update(
self, *, session: session_update_event_param.Session, event_id: str | NotGiven = NOT_GIVEN
) -> None:
"""Send this event to update the session’s default configuration.
The client may
send this event at any time to update the session configuration, and any
field may be updated at any time, except for "voice". The server will respond
with a `session.updated` event that shows the full effective configuration.
Only fields that are present are updated, thus the correct way to clear a
field like "instructions" is to pass an empty string.
"""
Send this event to update the session’s default configuration.
The client may send this event at any time to update any field,
except for `voice`. However, note that once a session has been
initialized with a particular `model`, it can’t be changed to
another model using `session.update`.
When the server receives a `session.update`, it will respond
with a `session.updated` event showing the full, effective configuration.
Only the fields that are present are updated. To clear a field like
`instructions`, pass an empty string.
"""
await self._connection.send(
cast(
Expand Down
2 changes: 2 additions & 0 deletions src/openai/types/beta/assistant_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class AssistantUpdateParams(TypedDict, total=False):
"gpt-4o-2024-05-13",
"gpt-4o-mini",
"gpt-4o-mini-2024-07-18",
"gpt-4.5-preview",
"gpt-4.5-preview-2025-02-27",
"gpt-4-turbo",
"gpt-4-turbo-2024-04-09",
"gpt-4-0125-preview",
Expand Down
14 changes: 14 additions & 0 deletions src/openai/types/beta/realtime/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@ class Tool(BaseModel):


class TurnDetection(BaseModel):
create_response: Optional[bool] = None
"""Whether or not to automatically generate a response when a VAD stop event
occurs.
`true` by default.
"""

interrupt_response: Optional[bool] = None
"""
Whether or not to automatically interrupt any ongoing response with output to
the default conversation (i.e. `conversation` of `auto`) when a VAD start event
occurs. `true` by default.
"""

prefix_padding_ms: Optional[int] = None
"""Amount of audio to include before the VAD detected speech (in milliseconds).
Expand Down
10 changes: 9 additions & 1 deletion src/openai/types/beta/realtime/session_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,19 @@ class Tool(TypedDict, total=False):

class TurnDetection(TypedDict, total=False):
create_response: bool
"""Whether or not to automatically generate a response when VAD is enabled.
"""Whether or not to automatically generate a response when a VAD stop event
occurs.
`true` by default.
"""

interrupt_response: bool
"""
Whether or not to automatically interrupt any ongoing response with output to
the default conversation (i.e. `conversation` of `auto`) when a VAD start event
occurs. `true` by default.
"""

prefix_padding_ms: int
"""Amount of audio to include before the VAD detected speech (in milliseconds).
Expand Down
10 changes: 9 additions & 1 deletion src/openai/types/beta/realtime/session_update_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,19 @@ class SessionTool(BaseModel):

class SessionTurnDetection(BaseModel):
create_response: Optional[bool] = None
"""Whether or not to automatically generate a response when VAD is enabled.
"""Whether or not to automatically generate a response when a VAD stop event
occurs.
`true` by default.
"""

interrupt_response: Optional[bool] = None
"""
Whether or not to automatically interrupt any ongoing response with output to
the default conversation (i.e. `conversation` of `auto`) when a VAD start event
occurs. `true` by default.
"""

prefix_padding_ms: Optional[int] = None
"""Amount of audio to include before the VAD detected speech (in milliseconds).
Expand Down
10 changes: 9 additions & 1 deletion src/openai/types/beta/realtime/session_update_event_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,19 @@ class SessionTool(TypedDict, total=False):

class SessionTurnDetection(TypedDict, total=False):
create_response: bool
"""Whether or not to automatically generate a response when VAD is enabled.
"""Whether or not to automatically generate a response when a VAD stop event
occurs.
`true` by default.
"""

interrupt_response: bool
"""
Whether or not to automatically interrupt any ongoing response with output to
the default conversation (i.e. `conversation` of `auto`) when a VAD start event
occurs. `true` by default.
"""

prefix_padding_ms: int
"""Amount of audio to include before the VAD detected speech (in milliseconds).
Expand Down
2 changes: 2 additions & 0 deletions src/openai/types/chat_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"o1-preview-2024-09-12",
"o1-mini",
"o1-mini-2024-09-12",
"gpt-4.5-preview",
"gpt-4.5-preview-2025-02-27",
"gpt-4o",
"gpt-4o-2024-11-20",
"gpt-4o-2024-08-06",
Expand Down
3 changes: 3 additions & 0 deletions src/openai/types/file_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ class FileObject(BaseModel):
`error`.
"""

expires_at: Optional[int] = None
"""The Unix timestamp (in seconds) for when the file will expire."""

status_details: Optional[str] = None
"""Deprecated.
Expand Down
2 changes: 1 addition & 1 deletion src/openai/types/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Upload(BaseModel):
"""The Unix timestamp (in seconds) for when the Upload was created."""

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

filename: str
"""The name of the file to be uploaded."""
Expand Down
2 changes: 2 additions & 0 deletions tests/api_resources/beta/realtime/test_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def test_method_create_with_all_params(self, client: OpenAI) -> None:
],
turn_detection={
"create_response": True,
"interrupt_response": True,
"prefix_padding_ms": 0,
"silence_duration_ms": 0,
"threshold": 0,
Expand Down Expand Up @@ -112,6 +113,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncOpenAI) ->
],
turn_detection={
"create_response": True,
"interrupt_response": True,
"prefix_padding_ms": 0,
"silence_duration_ms": 0,
"threshold": 0,
Expand Down

0 comments on commit 0c62beb

Please sign in to comment.