Skip to content

Commit 5852fbb

Browse files
authored
Merge branch 'openai:main' into main
2 parents d1b23f5 + 0296375 commit 5852fbb

File tree

286 files changed

+9749
-877
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

286 files changed

+9749
-877
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
permissions:
4343
contents: read
4444
id-token: write
45-
runs-on: depot-ubuntu-24.04
45+
runs-on: ${{ github.repository == 'stainless-sdks/openai-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
4646
steps:
4747
- uses: actions/checkout@v4
4848

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.101.0"
2+
".": "1.107.0"
33
}

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 119
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-ddbdf9343316047e8a773c54fb24e4a8d225955e202a1888fde6f9c8898ebf98.yml
3-
openapi_spec_hash: 9802f6dd381558466c897f6e387e06ca
4-
config_hash: fe0ea26680ac2075a6cd66416aefe7db
1+
configured_endpoints: 118
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-7807ec6037efcee1af7decbfd3974a42b761fb6c6a71b4050fe43484d7fcbac4.yml
3+
openapi_spec_hash: da6851e3891ad2659a50ed6a736fd32a
4+
config_hash: 74d955cdc2377213f5268ea309090f6c

CHANGELOG.md

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,120 @@
11
# Changelog
22

3+
## 1.107.0 (2025-09-08)
4+
5+
Full Changelog: [v1.106.1...v1.107.0](https://github.com/openai/openai-python/compare/v1.106.1...v1.107.0)
6+
7+
### Features
8+
9+
* **api:** ship the RealtimeGA API shape ([dc319d8](https://github.com/openai/openai-python/commit/dc319d8bbb3a20108399c1d15f98e63bdd84eb5c))
10+
11+
12+
### Chores
13+
14+
* **internal:** codegen related update ([b79b7ca](https://github.com/openai/openai-python/commit/b79b7ca3a72009a036db0a344b500f616ca0443f))
15+
16+
## 1.106.1 (2025-09-04)
17+
18+
Full Changelog: [v1.106.0...v1.106.1](https://github.com/openai/openai-python/compare/v1.106.0...v1.106.1)
19+
20+
### Chores
21+
22+
* **internal:** move mypy configurations to `pyproject.toml` file ([ca413a2](https://github.com/openai/openai-python/commit/ca413a277496c3b883b103ad1138a886e89ae15e))
23+
24+
## 1.106.0 (2025-09-04)
25+
26+
Full Changelog: [v1.105.0...v1.106.0](https://github.com/openai/openai-python/compare/v1.105.0...v1.106.0)
27+
28+
### Features
29+
30+
* **client:** support callable api_key ([#2588](https://github.com/openai/openai-python/issues/2588)) ([e1bad01](https://github.com/openai/openai-python/commit/e1bad015b8a2b98bfee955a24bc931347a58efc1))
31+
* improve future compat with pydantic v3 ([6645d93](https://github.com/openai/openai-python/commit/6645d9317a240982928b92c2f4af0381db6edc09))
32+
33+
## 1.105.0 (2025-09-03)
34+
35+
Full Changelog: [v1.104.2...v1.105.0](https://github.com/openai/openai-python/compare/v1.104.2...v1.105.0)
36+
37+
### Features
38+
39+
* **api:** Add gpt-realtime models ([8502041](https://github.com/openai/openai-python/commit/85020414808314df9cb42e020b11baff12f18f16))
40+
41+
## 1.104.2 (2025-09-02)
42+
43+
Full Changelog: [v1.104.1...v1.104.2](https://github.com/openai/openai-python/compare/v1.104.1...v1.104.2)
44+
45+
### Bug Fixes
46+
47+
* **types:** add aliases back for web search tool types ([2521cd8](https://github.com/openai/openai-python/commit/2521cd8445906e418dbae783b0d7c375ad91d49d))
48+
49+
## 1.104.1 (2025-09-02)
50+
51+
Full Changelog: [v1.104.0...v1.104.1](https://github.com/openai/openai-python/compare/v1.104.0...v1.104.1)
52+
53+
### Chores
54+
55+
* **api:** manual updates for ResponseInputAudio ([0db5061](https://github.com/openai/openai-python/commit/0db50619663656ba97bba30ab640bbb33683d196))
56+
57+
## 1.104.0 (2025-09-02)
58+
59+
Full Changelog: [v1.103.0...v1.104.0](https://github.com/openai/openai-python/compare/v1.103.0...v1.104.0)
60+
61+
### Features
62+
63+
* **types:** replace List[str] with SequenceNotStr in params ([bc00bda](https://github.com/openai/openai-python/commit/bc00bda880a80089be8a1758c016266ca72dab2c))
64+
65+
66+
### Bug Fixes
67+
68+
* **types:** update more types to use SequenceNotStr ([cff135c](https://github.com/openai/openai-python/commit/cff135cb7059ef1bf8f9b101a83529fc0cee37c4))
69+
* **types:** update some types to SequenceNotStr ([03f8b88](https://github.com/openai/openai-python/commit/03f8b88a0d428b74a7822e678a60d0ef106ea961))
70+
71+
72+
### Chores
73+
74+
* remove unused import ([ac7795b](https://github.com/openai/openai-python/commit/ac7795b50d956ec5dc468302e8e3579a0467edcb))
75+
76+
## 1.103.0 (2025-09-02)
77+
78+
Full Changelog: [v1.102.0...v1.103.0](https://github.com/openai/openai-python/compare/v1.102.0...v1.103.0)
79+
80+
### Features
81+
82+
* **api:** realtime API updates ([b7c2ddc](https://github.com/openai/openai-python/commit/b7c2ddc5e5dedda01015b3d0e14ea6eb68c282d3))
83+
84+
85+
### Bug Fixes
86+
87+
* **responses:** add missing params to stream() method ([bfc0673](https://github.com/openai/openai-python/commit/bfc06732ffe3764cb95cef9f23b4b5c0d312826a))
88+
89+
90+
### Chores
91+
92+
* bump `inline-snapshot` version to 0.28.0 ([#2590](https://github.com/openai/openai-python/issues/2590)) ([a6b0872](https://github.com/openai/openai-python/commit/a6b087226587d4cc4f59f1f09a595921b2823ef2))
93+
* **client:** format imports ([7ae3020](https://github.com/openai/openai-python/commit/7ae3020b3ca7de21e6e9a0a1c40908e655f6cad5))
94+
* **internal:** add Sequence related utils ([d3d72b9](https://github.com/openai/openai-python/commit/d3d72b9ce3c0885bf2b6934ac57d9e84f8653208))
95+
* **internal:** fix formatting ([3ab273f](https://github.com/openai/openai-python/commit/3ab273f21e601f088be7502b7bb5d249fc386d6a))
96+
* **internal:** minor formatting change ([478a348](https://github.com/openai/openai-python/commit/478a34881c968e9cab9d93ac2cf8da2fcb37c46c))
97+
* **internal:** update pyright exclude list ([66e440f](https://github.com/openai/openai-python/commit/66e440fac3ca388400392c64211450dedc491c11))
98+
99+
## 1.102.0 (2025-08-26)
100+
101+
Full Changelog: [v1.101.0...v1.102.0](https://github.com/openai/openai-python/compare/v1.101.0...v1.102.0)
102+
103+
### Features
104+
105+
* **api:** add web search filters ([1c199a8](https://github.com/openai/openai-python/commit/1c199a8dc85f773ae656fe850fdfb80b91f8f6b1))
106+
107+
108+
### Bug Fixes
109+
110+
* avoid newer type syntax ([bd0c668](https://github.com/openai/openai-python/commit/bd0c668d754b89c78c2c9ad2e081258c04aaece6))
111+
112+
113+
### Chores
114+
115+
* **internal:** change ci workflow machines ([3e129d5](https://github.com/openai/openai-python/commit/3e129d5e49f6391dea7497132cb3cfed8e5dd8ee))
116+
* **internal:** codegen related update ([b6dc170](https://github.com/openai/openai-python/commit/b6dc170832d719fc5028cfe234748c22e6e168aa))
117+
3118
## 1.101.0 (2025-08-21)
4119

5120
Full Changelog: [v1.100.3...v1.101.0](https://github.com/openai/openai-python/compare/v1.100.3...v1.101.0)

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ async def main():
226226
asyncio.run(main())
227227
```
228228

229-
## Realtime API beta
229+
## Realtime API
230230

231231
The Realtime API enables you to build low-latency, multi-modal conversational experiences. It currently supports text and audio as both input and output, as well as [function calling](https://platform.openai.com/docs/guides/function-calling) through a WebSocket connection.
232232

@@ -243,7 +243,7 @@ from openai import AsyncOpenAI
243243
async def main():
244244
client = AsyncOpenAI()
245245

246-
async with client.beta.realtime.connect(model="gpt-4o-realtime-preview") as connection:
246+
async with client.realtime.connect(model="gpt-realtime") as connection:
247247
await connection.session.update(session={'modalities': ['text']})
248248

249249
await connection.conversation.item.create(
@@ -277,7 +277,7 @@ Whenever an error occurs, the Realtime API will send an [`error` event](https://
277277
```py
278278
client = AsyncOpenAI()
279279

280-
async with client.beta.realtime.connect(model="gpt-4o-realtime-preview") as connection:
280+
async with client.realtime.connect(model="gpt-realtime") as connection:
281281
...
282282
async for event in connection:
283283
if event.type == 'error':

api.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ from openai.types.webhooks import (
431431
FineTuningJobCancelledWebhookEvent,
432432
FineTuningJobFailedWebhookEvent,
433433
FineTuningJobSucceededWebhookEvent,
434+
RealtimeCallIncomingWebhookEvent,
434435
ResponseCancelledWebhookEvent,
435436
ResponseCompletedWebhookEvent,
436437
ResponseFailedWebhookEvent,
@@ -832,6 +833,7 @@ from openai.types.responses import (
832833
ToolChoiceMcp,
833834
ToolChoiceOptions,
834835
ToolChoiceTypes,
836+
WebSearchPreviewTool,
835837
WebSearchTool,
836838
)
837839
```
@@ -855,6 +857,136 @@ Methods:
855857

856858
- <code title="get /responses/{response_id}/input_items">client.responses.input_items.<a href="./src/openai/resources/responses/input_items.py">list</a>(response_id, \*\*<a href="src/openai/types/responses/input_item_list_params.py">params</a>) -> <a href="./src/openai/types/responses/response_item.py">SyncCursorPage[ResponseItem]</a></code>
857859

860+
# Realtime
861+
862+
Types:
863+
864+
```python
865+
from openai.types.realtime import (
866+
AudioTranscription,
867+
ConversationCreatedEvent,
868+
ConversationItem,
869+
ConversationItemAdded,
870+
ConversationItemCreateEvent,
871+
ConversationItemCreatedEvent,
872+
ConversationItemDeleteEvent,
873+
ConversationItemDeletedEvent,
874+
ConversationItemDone,
875+
ConversationItemInputAudioTranscriptionCompletedEvent,
876+
ConversationItemInputAudioTranscriptionDeltaEvent,
877+
ConversationItemInputAudioTranscriptionFailedEvent,
878+
ConversationItemInputAudioTranscriptionSegment,
879+
ConversationItemRetrieveEvent,
880+
ConversationItemTruncateEvent,
881+
ConversationItemTruncatedEvent,
882+
ConversationItemWithReference,
883+
InputAudioBufferAppendEvent,
884+
InputAudioBufferClearEvent,
885+
InputAudioBufferClearedEvent,
886+
InputAudioBufferCommitEvent,
887+
InputAudioBufferCommittedEvent,
888+
InputAudioBufferSpeechStartedEvent,
889+
InputAudioBufferSpeechStoppedEvent,
890+
InputAudioBufferTimeoutTriggered,
891+
LogProbProperties,
892+
McpListToolsCompleted,
893+
McpListToolsFailed,
894+
McpListToolsInProgress,
895+
Models,
896+
NoiseReductionType,
897+
OutputAudioBufferClearEvent,
898+
RateLimitsUpdatedEvent,
899+
RealtimeAudioConfig,
900+
RealtimeAudioConfigInput,
901+
RealtimeAudioConfigOutput,
902+
RealtimeAudioFormats,
903+
RealtimeAudioInputTurnDetection,
904+
RealtimeClientEvent,
905+
RealtimeConversationItemAssistantMessage,
906+
RealtimeConversationItemFunctionCall,
907+
RealtimeConversationItemFunctionCallOutput,
908+
RealtimeConversationItemSystemMessage,
909+
RealtimeConversationItemUserMessage,
910+
RealtimeError,
911+
RealtimeErrorEvent,
912+
RealtimeMcpApprovalRequest,
913+
RealtimeMcpApprovalResponse,
914+
RealtimeMcpListTools,
915+
RealtimeMcpProtocolError,
916+
RealtimeMcpToolCall,
917+
RealtimeMcpToolExecutionError,
918+
RealtimeMcphttpError,
919+
RealtimeResponse,
920+
RealtimeResponseCreateAudioOutput,
921+
RealtimeResponseCreateMcpTool,
922+
RealtimeResponseCreateParams,
923+
RealtimeResponseStatus,
924+
RealtimeResponseUsage,
925+
RealtimeResponseUsageInputTokenDetails,
926+
RealtimeResponseUsageOutputTokenDetails,
927+
RealtimeServerEvent,
928+
RealtimeSession,
929+
RealtimeSessionCreateRequest,
930+
RealtimeToolChoiceConfig,
931+
RealtimeToolsConfig,
932+
RealtimeToolsConfigUnion,
933+
RealtimeTracingConfig,
934+
RealtimeTranscriptionSessionAudio,
935+
RealtimeTranscriptionSessionAudioInput,
936+
RealtimeTranscriptionSessionAudioInputTurnDetection,
937+
RealtimeTranscriptionSessionCreateRequest,
938+
RealtimeTruncation,
939+
RealtimeTruncationRetentionRatio,
940+
ResponseAudioDeltaEvent,
941+
ResponseAudioDoneEvent,
942+
ResponseAudioTranscriptDeltaEvent,
943+
ResponseAudioTranscriptDoneEvent,
944+
ResponseCancelEvent,
945+
ResponseContentPartAddedEvent,
946+
ResponseContentPartDoneEvent,
947+
ResponseCreateEvent,
948+
ResponseCreatedEvent,
949+
ResponseDoneEvent,
950+
ResponseFunctionCallArgumentsDeltaEvent,
951+
ResponseFunctionCallArgumentsDoneEvent,
952+
ResponseMcpCallArgumentsDelta,
953+
ResponseMcpCallArgumentsDone,
954+
ResponseMcpCallCompleted,
955+
ResponseMcpCallFailed,
956+
ResponseMcpCallInProgress,
957+
ResponseOutputItemAddedEvent,
958+
ResponseOutputItemDoneEvent,
959+
ResponseTextDeltaEvent,
960+
ResponseTextDoneEvent,
961+
SessionCreatedEvent,
962+
SessionUpdateEvent,
963+
SessionUpdatedEvent,
964+
TranscriptionSessionCreated,
965+
TranscriptionSessionUpdate,
966+
TranscriptionSessionUpdatedEvent,
967+
)
968+
```
969+
970+
## ClientSecrets
971+
972+
Types:
973+
974+
```python
975+
from openai.types.realtime import (
976+
RealtimeSessionClientSecret,
977+
RealtimeSessionCreateResponse,
978+
RealtimeTranscriptionSessionClientSecret,
979+
RealtimeTranscriptionSessionCreateResponse,
980+
RealtimeTranscriptionSessionInputAudioTranscription,
981+
RealtimeTranscriptionSessionTurnDetection,
982+
ClientSecretCreateResponse,
983+
)
984+
```
985+
986+
Methods:
987+
988+
- <code title="post /realtime/client_secrets">client.realtime.client_secrets.<a href="./src/openai/resources/realtime/client_secrets.py">create</a>(\*\*<a href="src/openai/types/realtime/client_secret_create_params.py">params</a>) -> <a href="./src/openai/types/realtime/client_secret_create_response.py">ClientSecretCreateResponse</a></code>
989+
858990
# Conversations
859991

860992
Types:

examples/realtime/audio_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import sounddevice as sd
1212
from pydub import AudioSegment
1313

14-
from openai.resources.beta.realtime.realtime import AsyncRealtimeConnection
14+
from openai.resources.realtime.realtime import AsyncRealtimeConnection
1515

1616
CHUNK_LENGTH_S = 0.05 # 100ms
1717
SAMPLE_RATE = 24000

examples/realtime/azure_realtime.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,16 @@ async def main() -> None:
2626
azure_ad_token_provider=get_bearer_token_provider(credential, "https://cognitiveservices.azure.com/.default"),
2727
api_version="2024-10-01-preview",
2828
)
29-
async with client.beta.realtime.connect(
30-
model="gpt-4o-realtime-preview", # deployment name for your model
29+
async with client.realtime.connect(
30+
model="gpt-realtime", # deployment name for your model
3131
) as connection:
32-
await connection.session.update(session={"modalities": ["text"]}) # type: ignore
32+
await connection.session.update(
33+
session={
34+
"output_modalities": ["text"],
35+
"model": "gpt-realtime",
36+
"type": "realtime",
37+
}
38+
)
3339
while True:
3440
user_input = input("Enter a message: ")
3541
if user_input == "q":
@@ -44,9 +50,9 @@ async def main() -> None:
4450
)
4551
await connection.response.create()
4652
async for event in connection:
47-
if event.type == "response.text.delta":
53+
if event.type == "response.output_text.delta":
4854
print(event.delta, flush=True, end="")
49-
elif event.type == "response.text.done":
55+
elif event.type == "response.output_text.done":
5056
print()
5157
elif event.type == "response.done":
5258
break

0 commit comments

Comments
 (0)