Skip to content

Commit 96aa7d2

Browse files
authored
Merge branch 'main' into feature/interceptor
2 parents 3f69457 + 4dd5cf2 commit 96aa7d2

19 files changed

+316
-16
lines changed

.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.59.6"
2+
".": "1.59.8"
33
}

CHANGELOG.md

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

3+
## 1.59.8 (2025-01-17)
4+
5+
Full Changelog: [v1.59.7...v1.59.8](https://github.com/openai/openai-python/compare/v1.59.7...v1.59.8)
6+
7+
### Bug Fixes
8+
9+
* streaming ([c16f58e](https://github.com/openai/openai-python/commit/c16f58ead0bc85055b164182689ba74b7e939dfa))
10+
* **structured outputs:** avoid parsing empty empty content ([#2023](https://github.com/openai/openai-python/issues/2023)) ([6d3513c](https://github.com/openai/openai-python/commit/6d3513c86f6e5800f8f73a45e089b7a205327121))
11+
* **structured outputs:** correct schema coercion for inline ref expansion ([#2025](https://github.com/openai/openai-python/issues/2025)) ([2f4f0b3](https://github.com/openai/openai-python/commit/2f4f0b374207f162060c328b71ec995049dc42e8))
12+
* **types:** correct type for vector store chunking strategy ([#2017](https://github.com/openai/openai-python/issues/2017)) ([e389279](https://github.com/openai/openai-python/commit/e38927950a5cdad99065853fe7b72aad6bb322e9))
13+
14+
15+
### Chores
16+
17+
* **examples:** update realtime model ([f26746c](https://github.com/openai/openai-python/commit/f26746cbcd893d66cf8a3fd68a7c3779dc8c833c)), closes [#2020](https://github.com/openai/openai-python/issues/2020)
18+
* **internal:** bump pyright dependency ([#2021](https://github.com/openai/openai-python/issues/2021)) ([0a9a0f5](https://github.com/openai/openai-python/commit/0a9a0f5d8b9d5457643798287f893305006dd518))
19+
* **internal:** streaming refactors ([#2012](https://github.com/openai/openai-python/issues/2012)) ([d76a748](https://github.com/openai/openai-python/commit/d76a748f606743407f94dfc26758095560e2082a))
20+
* **internal:** update deps ([#2015](https://github.com/openai/openai-python/issues/2015)) ([514e0e4](https://github.com/openai/openai-python/commit/514e0e415f87ab4510262d29ed6125384e017b84))
21+
22+
23+
### Documentation
24+
25+
* **examples/azure:** example script with realtime API ([#1967](https://github.com/openai/openai-python/issues/1967)) ([84f2f9c](https://github.com/openai/openai-python/commit/84f2f9c0439229a7db7136fe78419292d34d1f81))
26+
27+
## 1.59.7 (2025-01-13)
28+
29+
Full Changelog: [v1.59.6...v1.59.7](https://github.com/openai/openai-python/compare/v1.59.6...v1.59.7)
30+
31+
### Chores
32+
33+
* export HttpxBinaryResponseContent class ([7191b71](https://github.com/openai/openai-python/commit/7191b71f3dcbbfcb2f2bec855c3bba93c956384e))
34+
335
## 1.59.6 (2025-01-09)
436

537
Full Changelog: [v1.59.5...v1.59.6](https://github.com/openai/openai-python/compare/v1.59.5...v1.59.6)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ from openai import AsyncOpenAI
275275
async def main():
276276
client = AsyncOpenAI()
277277

278-
async with client.beta.realtime.connect(model="gpt-4o-realtime-preview-2024-10-01") as connection:
278+
async with client.beta.realtime.connect(model="gpt-4o-realtime-preview") as connection:
279279
await connection.session.update(session={'modalities': ['text']})
280280

281281
await connection.conversation.item.create(
@@ -309,7 +309,7 @@ Whenever an error occurs, the Realtime API will send an [`error` event](https://
309309
```py
310310
client = AsyncOpenAI()
311311

312-
async with client.beta.realtime.connect(model="gpt-4o-realtime-preview-2024-10-01") as connection:
312+
async with client.beta.realtime.connect(model="gpt-4o-realtime-preview") as connection:
313313
...
314314
async for event in connection:
315315
if event.type == 'error':

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ from openai.types.beta import (
314314
OtherFileChunkingStrategyObject,
315315
StaticFileChunkingStrategy,
316316
StaticFileChunkingStrategyObject,
317-
StaticFileChunkingStrategyParam,
317+
StaticFileChunkingStrategyObjectParam,
318318
VectorStore,
319319
VectorStoreDeleted,
320320
)

examples/realtime/azure_realtime.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import os
2+
import asyncio
3+
4+
from azure.identity.aio import DefaultAzureCredential, get_bearer_token_provider
5+
6+
from openai import AsyncAzureOpenAI
7+
8+
# Azure OpenAI Realtime Docs
9+
10+
# How-to: https://learn.microsoft.com/azure/ai-services/openai/how-to/realtime-audio
11+
# Supported models and API versions: https://learn.microsoft.com/azure/ai-services/openai/how-to/realtime-audio#supported-models
12+
# Entra ID auth: https://learn.microsoft.com/azure/ai-services/openai/how-to/managed-identity
13+
14+
15+
async def main() -> None:
16+
"""The following example demonstrates how to configure Azure OpenAI to use the Realtime API.
17+
For an audio example, see push_to_talk_app.py and update the client and model parameter accordingly.
18+
19+
When prompted for user input, type a message and hit enter to send it to the model.
20+
Enter "q" to quit the conversation.
21+
"""
22+
23+
credential = DefaultAzureCredential()
24+
client = AsyncAzureOpenAI(
25+
azure_endpoint=os.environ["AZURE_OPENAI_ENDPOINT"],
26+
azure_ad_token_provider=get_bearer_token_provider(credential, "https://cognitiveservices.azure.com/.default"),
27+
api_version="2024-10-01-preview",
28+
)
29+
async with client.beta.realtime.connect(
30+
model="gpt-4o-realtime-preview", # deployment name for your model
31+
) as connection:
32+
await connection.session.update(session={"modalities": ["text"]}) # type: ignore
33+
while True:
34+
user_input = input("Enter a message: ")
35+
if user_input == "q":
36+
break
37+
38+
await connection.conversation.item.create(
39+
item={
40+
"type": "message",
41+
"role": "user",
42+
"content": [{"type": "input_text", "text": user_input}],
43+
}
44+
)
45+
await connection.response.create()
46+
async for event in connection:
47+
if event.type == "response.text.delta":
48+
print(event.delta, flush=True, end="")
49+
elif event.type == "response.text.done":
50+
print()
51+
elif event.type == "response.done":
52+
break
53+
54+
await credential.close()
55+
56+
57+
asyncio.run(main())

examples/realtime/push_to_talk_app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ async def on_mount(self) -> None:
152152
self.run_worker(self.send_mic_audio())
153153

154154
async def handle_realtime_connection(self) -> None:
155-
async with self.client.beta.realtime.connect(model="gpt-4o-realtime-preview-2024-10-01") as conn:
155+
async with self.client.beta.realtime.connect(model="gpt-4o-realtime-preview") as conn:
156156
self.connection = conn
157157
self.connected.set()
158158

mypy.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ cache_fine_grained = True
4444
# ```
4545
# Changing this codegen to make mypy happy would increase complexity
4646
# and would not be worth it.
47-
disable_error_code = func-returns-value
47+
disable_error_code = func-returns-value,overload-cannot-match
4848

4949
# https://github.com/python/mypy/issues/12162
5050
[mypy.overrides]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "openai"
3-
version = "1.59.6"
3+
version = "1.59.8"
44
description = "The official Python library for the openai API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"

requirements-dev.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ msal==1.31.0
8383
# via msal-extensions
8484
msal-extensions==1.2.0
8585
# via azure-identity
86-
mypy==1.13.0
86+
mypy==1.14.1
8787
mypy-extensions==1.0.0
8888
# via black
8989
# via mypy
@@ -124,7 +124,7 @@ pygments==2.18.0
124124
# via rich
125125
pyjwt==2.8.0
126126
# via msal
127-
pyright==1.1.390
127+
pyright==1.1.392.post0
128128
pytest==8.3.3
129129
# via pytest-asyncio
130130
pytest-asyncio==0.24.0

src/openai/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
)
3434
from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient
3535
from ._utils._logs import setup_logging as _setup_logging
36+
from ._legacy_response import HttpxBinaryResponseContent as HttpxBinaryResponseContent
3637

3738
__all__ = [
3839
"types",

0 commit comments

Comments
 (0)