Skip to content

Commit 7b0be85

Browse files
chore: sync repo
1 parent f66d2e6 commit 7b0be85

File tree

101 files changed

+607
-5016
lines changed

Some content is hidden

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

101 files changed

+607
-5016
lines changed

.github/workflows/ci.yml

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
pull_request:
77
branches:
88
- main
9-
- next
109

1110
jobs:
1211
lint:

.github/workflows/create-releases.yml

-39
This file was deleted.

.github/workflows/publish-pypi.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
# workflow for re-running publishing to PyPI in case it fails for some reason
2-
# you can run this workflow by navigating to https://www.github.com/openai/openai-python/actions/workflows/publish-pypi.yml
1+
# This workflow is triggered when a GitHub release is created.
2+
# It can also be run manually to re-publish to PyPI in case it failed for some reason.
3+
# You can run this workflow by navigating to https://www.github.com/openai/openai-python/actions/workflows/publish-pypi.yml
34
name: Publish PyPI
45
on:
56
workflow_dispatch:
67

8+
release:
9+
types: [published]
10+
711
jobs:
812
publish:
913
name: publish

.github/workflows/release-doctor.yml

-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@ jobs:
1919
run: |
2020
bash ./bin/check-release-environment
2121
env:
22-
STAINLESS_API_KEY: ${{ secrets.STAINLESS_API_KEY }}
2322
PYPI_TOKEN: ${{ secrets.OPENAI_PYPI_TOKEN || secrets.PYPI_TOKEN }}

.gitignore

-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,3 @@ dist
1414
.envrc
1515
codegen.log
1616
Brewfile.lock.json
17-
18-
.DS_Store
19-
20-
examples/*.mp3

.release-please-manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.68.2"
2+
".": "1.66.3"
33
}

.stats.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 82
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-5ad6884898c07591750dde560118baf7074a59aecd1f367f930c5e42b04e848a.yml
1+
configured_endpoints: 81
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-c8579861bc21d4d2155a5b9e8e7d54faee8083730673c4d32cbbe573d7fb4116.yml

CHANGELOG.md

-72
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,5 @@
11
# Changelog
22

3-
## 1.68.2 (2025-03-21)
4-
5-
Full Changelog: [v1.68.1...v1.68.2](https://github.com/openai/openai-python/compare/v1.68.1...v1.68.2)
6-
7-
### Refactors
8-
9-
* **package:** rename audio extra to voice_helpers ([2dd6cb8](https://github.com/openai/openai-python/commit/2dd6cb87489fe12c5e45128f44d985c3f49aba1d))
10-
11-
## 1.68.1 (2025-03-21)
12-
13-
Full Changelog: [v1.68.0...v1.68.1](https://github.com/openai/openai-python/compare/v1.68.0...v1.68.1)
14-
15-
### Bug Fixes
16-
17-
* **client:** remove duplicate types ([#2235](https://github.com/openai/openai-python/issues/2235)) ([063f7d0](https://github.com/openai/openai-python/commit/063f7d0684c350ca9d766e2cb150233a22a623c8))
18-
* **helpers/audio:** remove duplicative module ([f253d04](https://github.com/openai/openai-python/commit/f253d0415145f2c4904ea2e7b389d31d94e45a54))
19-
* **package:** make sounddevice and numpy optional dependencies ([8b04453](https://github.com/openai/openai-python/commit/8b04453f0483736c13f0209a9f8f3618bc0e86c9))
20-
21-
22-
### Chores
23-
24-
* **ci:** run workflows on next too ([67f89d4](https://github.com/openai/openai-python/commit/67f89d478aab780d1481c9bf6682c6633e431137))
25-
26-
## 1.68.0 (2025-03-20)
27-
28-
Full Changelog: [v1.67.0...v1.68.0](https://github.com/openai/openai-python/compare/v1.67.0...v1.68.0)
29-
30-
### Features
31-
32-
* add audio helpers ([423655c](https://github.com/openai/openai-python/commit/423655ca9077cfd258f1e52f6eb386fc8307fa5f))
33-
* **api:** new models for TTS, STT, + new audio features for Realtime ([#2232](https://github.com/openai/openai-python/issues/2232)) ([ab5192d](https://github.com/openai/openai-python/commit/ab5192d0a7b417ade622ec94dd48f86beb90692c))
34-
35-
## 1.67.0 (2025-03-19)
36-
37-
Full Changelog: [v1.66.5...v1.67.0](https://github.com/openai/openai-python/compare/v1.66.5...v1.67.0)
38-
39-
### Features
40-
41-
* **api:** o1-pro now available through the API ([#2228](https://github.com/openai/openai-python/issues/2228)) ([40a19d8](https://github.com/openai/openai-python/commit/40a19d8592c1767d6318230fc93e37c360d1bcd1))
42-
43-
## 1.66.5 (2025-03-18)
44-
45-
Full Changelog: [v1.66.4...v1.66.5](https://github.com/openai/openai-python/compare/v1.66.4...v1.66.5)
46-
47-
### Bug Fixes
48-
49-
* **types:** improve responses type names ([#2224](https://github.com/openai/openai-python/issues/2224)) ([5f7beb8](https://github.com/openai/openai-python/commit/5f7beb873af5ccef2551f34ab3ef098e099ce9c6))
50-
51-
52-
### Chores
53-
54-
* **internal:** add back releases workflow ([c71d4c9](https://github.com/openai/openai-python/commit/c71d4c918eab3532b36ea944b0c4069db6ac2d38))
55-
* **internal:** codegen related update ([#2222](https://github.com/openai/openai-python/issues/2222)) ([f570d91](https://github.com/openai/openai-python/commit/f570d914a16cb5092533e32dfd863027d378c0b5))
56-
57-
## 1.66.4 (2025-03-17)
58-
59-
Full Changelog: [v1.66.3...v1.66.4](https://github.com/openai/openai-python/compare/v1.66.3...v1.66.4)
60-
61-
### Bug Fixes
62-
63-
* **ci:** ensure pip is always available ([#2207](https://github.com/openai/openai-python/issues/2207)) ([3f08e56](https://github.com/openai/openai-python/commit/3f08e56a48a04c2b7f03a4ad63f38228e25810e6))
64-
* **ci:** remove publishing patch ([#2208](https://github.com/openai/openai-python/issues/2208)) ([dd2dab7](https://github.com/openai/openai-python/commit/dd2dab7faf2a003da3e6af66780bd250be6e7f3f))
65-
* **types:** handle more discriminated union shapes ([#2206](https://github.com/openai/openai-python/issues/2206)) ([f85a9c6](https://github.com/openai/openai-python/commit/f85a9c633dcb9b64c0eb47d20151894742bbef22))
66-
67-
68-
### Chores
69-
70-
* **internal:** bump rye to 0.44.0 ([#2200](https://github.com/openai/openai-python/issues/2200)) ([2dd3139](https://github.com/openai/openai-python/commit/2dd3139df6e7fe6307f9847e6527073e355e5047))
71-
* **internal:** remove CI condition ([#2203](https://github.com/openai/openai-python/issues/2203)) ([9620fdc](https://github.com/openai/openai-python/commit/9620fdcf4f2d01b6753ecc0abc16e5239c2b41e1))
72-
* **internal:** remove extra empty newlines ([#2195](https://github.com/openai/openai-python/issues/2195)) ([a1016a7](https://github.com/openai/openai-python/commit/a1016a78fe551e0f0e2562a0e81d1cb724d195da))
73-
* **internal:** update release workflows ([e2def44](https://github.com/openai/openai-python/commit/e2def4453323aa1cf8077df447fd55eb4c626393))
74-
753
## 1.66.3 (2025-03-12)
764

775
Full Changelog: [v1.66.2...v1.66.3](https://github.com/openai/openai-python/compare/v1.66.2...v1.66.3)

api.md

+1-29
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
```python
44
from openai.types import (
5-
AllModels,
65
ChatModel,
76
ComparisonFilter,
87
CompoundFilter,
@@ -15,7 +14,6 @@ from openai.types import (
1514
ResponseFormatJSONObject,
1615
ResponseFormatJSONSchema,
1716
ResponseFormatText,
18-
ResponsesModel,
1917
)
2018
```
2119

@@ -151,11 +149,7 @@ Types:
151149
```python
152150
from openai.types.audio import (
153151
Transcription,
154-
TranscriptionInclude,
155152
TranscriptionSegment,
156-
TranscriptionStreamEvent,
157-
TranscriptionTextDeltaEvent,
158-
TranscriptionTextDoneEvent,
159153
TranscriptionVerbose,
160154
TranscriptionWord,
161155
TranscriptionCreateResponse,
@@ -342,9 +336,7 @@ from openai.types.beta.realtime import (
342336
ConversationItemDeleteEvent,
343337
ConversationItemDeletedEvent,
344338
ConversationItemInputAudioTranscriptionCompletedEvent,
345-
ConversationItemInputAudioTranscriptionDeltaEvent,
346339
ConversationItemInputAudioTranscriptionFailedEvent,
347-
ConversationItemRetrieveEvent,
348340
ConversationItemTruncateEvent,
349341
ConversationItemTruncatedEvent,
350342
ConversationItemWithReference,
@@ -381,8 +373,6 @@ from openai.types.beta.realtime import (
381373
SessionCreatedEvent,
382374
SessionUpdateEvent,
383375
SessionUpdatedEvent,
384-
TranscriptionSessionUpdate,
385-
TranscriptionSessionUpdatedEvent,
386376
)
387377
```
388378

@@ -398,18 +388,6 @@ Methods:
398388

399389
- <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>
400390

401-
### TranscriptionSessions
402-
403-
Types:
404-
405-
```python
406-
from openai.types.beta.realtime import TranscriptionSession
407-
```
408-
409-
Methods:
410-
411-
- <code title="post /realtime/transcription_sessions">client.beta.realtime.transcription_sessions.<a href="./src/openai/resources/beta/realtime/transcription_sessions.py">create</a>(\*\*<a href="src/openai/types/beta/realtime/transcription_session_create_params.py">params</a>) -> <a href="./src/openai/types/beta/realtime/transcription_session.py">TranscriptionSession</a></code>
412-
413391
## Assistants
414392

415393
Types:
@@ -627,8 +605,6 @@ from openai.types.responses import (
627605
ResponseCodeInterpreterToolCall,
628606
ResponseCompletedEvent,
629607
ResponseComputerToolCall,
630-
ResponseComputerToolCallOutputItem,
631-
ResponseComputerToolCallOutputScreenshot,
632608
ResponseContent,
633609
ResponseContentPartAddedEvent,
634610
ResponseContentPartDoneEvent,
@@ -645,8 +621,6 @@ from openai.types.responses import (
645621
ResponseFunctionCallArgumentsDeltaEvent,
646622
ResponseFunctionCallArgumentsDoneEvent,
647623
ResponseFunctionToolCall,
648-
ResponseFunctionToolCallItem,
649-
ResponseFunctionToolCallOutputItem,
650624
ResponseFunctionWebSearch,
651625
ResponseInProgressEvent,
652626
ResponseIncludable,
@@ -658,9 +632,7 @@ from openai.types.responses import (
658632
ResponseInputImage,
659633
ResponseInputItem,
660634
ResponseInputMessageContentList,
661-
ResponseInputMessageItem,
662635
ResponseInputText,
663-
ResponseItem,
664636
ResponseOutputAudio,
665637
ResponseOutputItem,
666638
ResponseOutputItemAddedEvent,
@@ -705,4 +677,4 @@ from openai.types.responses import ResponseItemList
705677

706678
Methods:
707679

708-
- <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>
680+
- <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>) -> SyncCursorPage[Data]</code>

bin/publish-pypi

+3
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@
33
set -eux
44
mkdir -p dist
55
rye build --clean
6+
# Patching importlib-metadata version until upstream library version is updated
7+
# https://github.com/pypa/twine/issues/977#issuecomment-2189800841
8+
"$HOME/.rye/self/bin/python3" -m pip install 'importlib-metadata==7.2.1'
69
rye publish --yes --token=$PYPI_TOKEN

examples/audio.py

+26
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env rye run python
22

3+
import time
34
from pathlib import Path
45

56
from openai import OpenAI
@@ -11,6 +12,8 @@
1112

1213

1314
def main() -> None:
15+
stream_to_speakers()
16+
1417
# Create text-to-speech audio file
1518
with openai.audio.speech.with_streaming_response.create(
1619
model="tts-1",
@@ -34,5 +37,28 @@ def main() -> None:
3437
print(translation.text)
3538

3639

40+
def stream_to_speakers() -> None:
41+
import pyaudio
42+
43+
player_stream = pyaudio.PyAudio().open(format=pyaudio.paInt16, channels=1, rate=24000, output=True)
44+
45+
start_time = time.time()
46+
47+
with openai.audio.speech.with_streaming_response.create(
48+
model="tts-1",
49+
voice="alloy",
50+
response_format="pcm", # similar to WAV, but without a header chunk at the start.
51+
input="""I see skies of blue and clouds of white
52+
The bright blessed days, the dark sacred nights
53+
And I think to myself
54+
What a wonderful world""",
55+
) as response:
56+
print(f"Time to first byte: {int((time.time() - start_time) * 1000)}ms")
57+
for chunk in response.iter_bytes(chunk_size=1024):
58+
player_stream.write(chunk)
59+
60+
print(f"Done in {int((time.time() - start_time) * 1000)}ms.")
61+
62+
3763
if __name__ == "__main__":
3864
main()

examples/speech_to_text.py

-25
This file was deleted.

examples/text_to_speech.py

-31
This file was deleted.

0 commit comments

Comments
 (0)