Skip to content

Commit b3143fd

Browse files
feat(api): new o1 and GPT-4o models + preference fine-tuning (#1956)
learn more here: https://platform.openai.com/docs/changelog
1 parent bce8998 commit b3143fd

25 files changed

+1471
-147
lines changed

.stats.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 68
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-2e0e0678be19d1118fd796af291822075e40538dba326611e177e9f3dc245a53.yml
1+
configured_endpoints: 69
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-779ea2754025daf5e18eb8ceb203ec321692636bc3a999338556a479178efa6c.yml

api.md

+16
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ from openai.types.chat import (
4747
ChatCompletionContentPartInputAudio,
4848
ChatCompletionContentPartRefusal,
4949
ChatCompletionContentPartText,
50+
ChatCompletionDeveloperMessageParam,
5051
ChatCompletionFunctionCallOption,
5152
ChatCompletionFunctionMessageParam,
5253
ChatCompletionMessage,
@@ -55,6 +56,7 @@ from openai.types.chat import (
5556
ChatCompletionModality,
5657
ChatCompletionNamedToolChoice,
5758
ChatCompletionPredictionContent,
59+
ChatCompletionReasoningEffort,
5860
ChatCompletionRole,
5961
ChatCompletionStreamOptions,
6062
ChatCompletionSystemMessageParam,
@@ -234,6 +236,20 @@ Methods:
234236

235237
# Beta
236238

239+
## Realtime
240+
241+
### Sessions
242+
243+
Types:
244+
245+
```python
246+
from openai.types.beta.realtime import Session, SessionCreateResponse
247+
```
248+
249+
Methods:
250+
251+
- <code title="post /realtime/sessions">client.beta.realtime.sessions.<a href="./src/openai/resources/beta/realtime/sessions.py">create</a>(\*\*<a href="src/openai/types/beta/realtime/session_create_params.py">params</a>) -> <a href="./src/openai/types/beta/realtime/session_create_response.py">SessionCreateResponse</a></code>
252+
237253
## VectorStores
238254

239255
Types:

src/openai/resources/beta/beta.py

+32
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
ThreadsWithStreamingResponse,
2121
AsyncThreadsWithStreamingResponse,
2222
)
23+
from .realtime.realtime import (
24+
Realtime,
25+
AsyncRealtime,
26+
RealtimeWithRawResponse,
27+
AsyncRealtimeWithRawResponse,
28+
RealtimeWithStreamingResponse,
29+
AsyncRealtimeWithStreamingResponse,
30+
)
2331
from .vector_stores.vector_stores import (
2432
VectorStores,
2533
AsyncVectorStores,
@@ -33,6 +41,10 @@
3341

3442

3543
class Beta(SyncAPIResource):
44+
@cached_property
45+
def realtime(self) -> Realtime:
46+
return Realtime(self._client)
47+
3648
@cached_property
3749
def vector_stores(self) -> VectorStores:
3850
return VectorStores(self._client)
@@ -66,6 +78,10 @@ def with_streaming_response(self) -> BetaWithStreamingResponse:
6678

6779

6880
class AsyncBeta(AsyncAPIResource):
81+
@cached_property
82+
def realtime(self) -> AsyncRealtime:
83+
return AsyncRealtime(self._client)
84+
6985
@cached_property
7086
def vector_stores(self) -> AsyncVectorStores:
7187
return AsyncVectorStores(self._client)
@@ -102,6 +118,10 @@ class BetaWithRawResponse:
102118
def __init__(self, beta: Beta) -> None:
103119
self._beta = beta
104120

121+
@cached_property
122+
def realtime(self) -> RealtimeWithRawResponse:
123+
return RealtimeWithRawResponse(self._beta.realtime)
124+
105125
@cached_property
106126
def vector_stores(self) -> VectorStoresWithRawResponse:
107127
return VectorStoresWithRawResponse(self._beta.vector_stores)
@@ -119,6 +139,10 @@ class AsyncBetaWithRawResponse:
119139
def __init__(self, beta: AsyncBeta) -> None:
120140
self._beta = beta
121141

142+
@cached_property
143+
def realtime(self) -> AsyncRealtimeWithRawResponse:
144+
return AsyncRealtimeWithRawResponse(self._beta.realtime)
145+
122146
@cached_property
123147
def vector_stores(self) -> AsyncVectorStoresWithRawResponse:
124148
return AsyncVectorStoresWithRawResponse(self._beta.vector_stores)
@@ -136,6 +160,10 @@ class BetaWithStreamingResponse:
136160
def __init__(self, beta: Beta) -> None:
137161
self._beta = beta
138162

163+
@cached_property
164+
def realtime(self) -> RealtimeWithStreamingResponse:
165+
return RealtimeWithStreamingResponse(self._beta.realtime)
166+
139167
@cached_property
140168
def vector_stores(self) -> VectorStoresWithStreamingResponse:
141169
return VectorStoresWithStreamingResponse(self._beta.vector_stores)
@@ -153,6 +181,10 @@ class AsyncBetaWithStreamingResponse:
153181
def __init__(self, beta: AsyncBeta) -> None:
154182
self._beta = beta
155183

184+
@cached_property
185+
def realtime(self) -> AsyncRealtimeWithStreamingResponse:
186+
return AsyncRealtimeWithStreamingResponse(self._beta.realtime)
187+
156188
@cached_property
157189
def vector_stores(self) -> AsyncVectorStoresWithStreamingResponse:
158190
return AsyncVectorStoresWithStreamingResponse(self._beta.vector_stores)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from .realtime import (
4+
Realtime,
5+
AsyncRealtime,
6+
RealtimeWithRawResponse,
7+
AsyncRealtimeWithRawResponse,
8+
RealtimeWithStreamingResponse,
9+
AsyncRealtimeWithStreamingResponse,
10+
)
11+
from .sessions import (
12+
Sessions,
13+
AsyncSessions,
14+
SessionsWithRawResponse,
15+
AsyncSessionsWithRawResponse,
16+
SessionsWithStreamingResponse,
17+
AsyncSessionsWithStreamingResponse,
18+
)
19+
20+
__all__ = [
21+
"Sessions",
22+
"AsyncSessions",
23+
"SessionsWithRawResponse",
24+
"AsyncSessionsWithRawResponse",
25+
"SessionsWithStreamingResponse",
26+
"AsyncSessionsWithStreamingResponse",
27+
"Realtime",
28+
"AsyncRealtime",
29+
"RealtimeWithRawResponse",
30+
"AsyncRealtimeWithRawResponse",
31+
"RealtimeWithStreamingResponse",
32+
"AsyncRealtimeWithStreamingResponse",
33+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from .sessions import (
6+
Sessions,
7+
AsyncSessions,
8+
SessionsWithRawResponse,
9+
AsyncSessionsWithRawResponse,
10+
SessionsWithStreamingResponse,
11+
AsyncSessionsWithStreamingResponse,
12+
)
13+
from ...._compat import cached_property
14+
from ...._resource import SyncAPIResource, AsyncAPIResource
15+
16+
__all__ = ["Realtime", "AsyncRealtime"]
17+
18+
19+
class Realtime(SyncAPIResource):
20+
@cached_property
21+
def sessions(self) -> Sessions:
22+
return Sessions(self._client)
23+
24+
@cached_property
25+
def with_raw_response(self) -> RealtimeWithRawResponse:
26+
"""
27+
This property can be used as a prefix for any HTTP method call to return the
28+
the raw response object instead of the parsed content.
29+
30+
For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
31+
"""
32+
return RealtimeWithRawResponse(self)
33+
34+
@cached_property
35+
def with_streaming_response(self) -> RealtimeWithStreamingResponse:
36+
"""
37+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
38+
39+
For more information, see https://www.github.com/openai/openai-python#with_streaming_response
40+
"""
41+
return RealtimeWithStreamingResponse(self)
42+
43+
44+
class AsyncRealtime(AsyncAPIResource):
45+
@cached_property
46+
def sessions(self) -> AsyncSessions:
47+
return AsyncSessions(self._client)
48+
49+
@cached_property
50+
def with_raw_response(self) -> AsyncRealtimeWithRawResponse:
51+
"""
52+
This property can be used as a prefix for any HTTP method call to return the
53+
the raw response object instead of the parsed content.
54+
55+
For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
56+
"""
57+
return AsyncRealtimeWithRawResponse(self)
58+
59+
@cached_property
60+
def with_streaming_response(self) -> AsyncRealtimeWithStreamingResponse:
61+
"""
62+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
63+
64+
For more information, see https://www.github.com/openai/openai-python#with_streaming_response
65+
"""
66+
return AsyncRealtimeWithStreamingResponse(self)
67+
68+
69+
class RealtimeWithRawResponse:
70+
def __init__(self, realtime: Realtime) -> None:
71+
self._realtime = realtime
72+
73+
@cached_property
74+
def sessions(self) -> SessionsWithRawResponse:
75+
return SessionsWithRawResponse(self._realtime.sessions)
76+
77+
78+
class AsyncRealtimeWithRawResponse:
79+
def __init__(self, realtime: AsyncRealtime) -> None:
80+
self._realtime = realtime
81+
82+
@cached_property
83+
def sessions(self) -> AsyncSessionsWithRawResponse:
84+
return AsyncSessionsWithRawResponse(self._realtime.sessions)
85+
86+
87+
class RealtimeWithStreamingResponse:
88+
def __init__(self, realtime: Realtime) -> None:
89+
self._realtime = realtime
90+
91+
@cached_property
92+
def sessions(self) -> SessionsWithStreamingResponse:
93+
return SessionsWithStreamingResponse(self._realtime.sessions)
94+
95+
96+
class AsyncRealtimeWithStreamingResponse:
97+
def __init__(self, realtime: AsyncRealtime) -> None:
98+
self._realtime = realtime
99+
100+
@cached_property
101+
def sessions(self) -> AsyncSessionsWithStreamingResponse:
102+
return AsyncSessionsWithStreamingResponse(self._realtime.sessions)

0 commit comments

Comments
 (0)