Commit 0c62bebe

stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
2025-02-28 04:05:36
feat(api): add gpt-4.5-preview (#2149)
1 parent 5bde572
src/openai/resources/beta/realtime/realtime.py
@@ -561,14 +561,17 @@ class BaseRealtimeConnectionResource:
 
 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(
@@ -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(
src/openai/resources/beta/assistants.py
@@ -232,6 +232,8 @@ class Assistants(SyncAPIResource):
                 "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",
@@ -673,6 +675,8 @@ class AsyncAssistants(AsyncAPIResource):
                 "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",
src/openai/types/beta/realtime/session.py
@@ -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).
 
src/openai/types/beta/realtime/session_create_params.py
@@ -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).
 
src/openai/types/beta/realtime/session_update_event.py
@@ -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).
 
src/openai/types/beta/realtime/session_update_event_param.py
@@ -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).
 
src/openai/types/beta/assistant_update_params.py
@@ -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",
src/openai/types/chat_model.py
@@ -13,6 +13,8 @@ ChatModel: TypeAlias = Literal[
     "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",
src/openai/types/file_object.py
@@ -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.
 
src/openai/types/upload.py
@@ -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."""
tests/api_resources/beta/realtime/test_sessions.py
@@ -48,6 +48,7 @@ class TestSessions:
             ],
             turn_detection={
                 "create_response": True,
+                "interrupt_response": True,
                 "prefix_padding_ms": 0,
                 "silence_duration_ms": 0,
                 "threshold": 0,
@@ -112,6 +113,7 @@ class TestAsyncSessions:
             ],
             turn_detection={
                 "create_response": True,
+                "interrupt_response": True,
                 "prefix_padding_ms": 0,
                 "silence_duration_ms": 0,
                 "threshold": 0,
.stats.yml
@@ -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