Skip to content

Commit 656e3ca

Browse files
release: 2.24.0 (#2890)
* chore(internal): refactor sse event parsing * codegen metadata * chore(internal): make `test_proxy_environment_variables` more resilient to env * feat(api): add phase * fix(api): phase docs * fix(api): fix phase enum * release: 2.24.0 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 921c330 commit 656e3ca

21 files changed

+139
-19
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-
".": "2.23.0"
2+
".": "2.24.0"
33
}

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 148
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-a0aa54a302fbd7fff4ed7ad8a8547587d37b63324fc4af652bfa685ee9f8da44.yml
3-
openapi_spec_hash: e45c5af19307cfc8b9baa4b8f8e865a0
4-
config_hash: 2cbce279be85ff86a2fabbc85d62b011
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-6bfe886b5ded0fe3bf37ca672698814e16e0836a093ceef65dac37ae44d1ad6b.yml
3+
openapi_spec_hash: 6b1344a59044318e824c8d1af96033c7
4+
config_hash: 7f49c38fa3abe9b7038ffe62262c4912

CHANGELOG.md

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

3+
## 2.24.0 (2026-02-24)
4+
5+
Full Changelog: [v2.23.0...v2.24.0](https://github.com/openai/openai-python/compare/v2.23.0...v2.24.0)
6+
7+
### Features
8+
9+
* **api:** add phase ([391deb9](https://github.com/openai/openai-python/commit/391deb99f6a92e51bffb25efd8dfe367d144bb9d))
10+
11+
12+
### Bug Fixes
13+
14+
* **api:** fix phase enum ([42ebf7c](https://github.com/openai/openai-python/commit/42ebf7c30b7e27a175c0d75fcf42c8dc858e56d6))
15+
* **api:** phase docs ([7ddc61c](https://github.com/openai/openai-python/commit/7ddc61cd0f7825d5e7f3a10daf809135511d8d20))
16+
17+
18+
### Chores
19+
20+
* **internal:** make `test_proxy_environment_variables` more resilient to env ([65af8fd](https://github.com/openai/openai-python/commit/65af8fd8550e99236e3f4dcb035312441788157a))
21+
* **internal:** refactor sse event parsing ([2344600](https://github.com/openai/openai-python/commit/23446008f06fb474d8c75d14a1bce26f4c5b95d8))
22+
323
## 2.23.0 (2026-02-24)
424

525
Full Changelog: [v2.22.0...v2.23.0](https://github.com/openai/openai-python/compare/v2.22.0...v2.23.0)

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 = "2.23.0"
3+
version = "2.24.0"
44
description = "The official Python library for the openai API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"

src/openai/_base_client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1984,6 +1984,7 @@ def make_request_options(
19841984
idempotency_key: str | None = None,
19851985
timeout: float | httpx.Timeout | None | NotGiven = not_given,
19861986
post_parser: PostParser | NotGiven = not_given,
1987+
synthesize_event_and_data: bool | None = None,
19871988
) -> RequestOptions:
19881989
"""Create a dict of type RequestOptions without keys of NotGiven values."""
19891990
options: RequestOptions = {}
@@ -2009,6 +2010,9 @@ def make_request_options(
20092010
# internal
20102011
options["post_parser"] = post_parser # type: ignore
20112012

2013+
if synthesize_event_and_data is not None:
2014+
options["synthesize_event_and_data"] = synthesize_event_and_data
2015+
20122016
return options
20132017

20142018

src/openai/_models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,7 @@ class FinalRequestOptionsInput(TypedDict, total=False):
845845
json_data: Body
846846
extra_json: AnyMapping
847847
follow_redirects: bool
848+
synthesize_event_and_data: bool
848849

849850

850851
@final
@@ -859,6 +860,7 @@ class FinalRequestOptions(pydantic.BaseModel):
859860
idempotency_key: Union[str, None] = None
860861
post_parser: Union[Callable[[Any], Any], NotGiven] = NotGiven()
861862
follow_redirects: Union[bool, None] = None
863+
synthesize_event_and_data: Optional[bool] = None
862864

863865
content: Union[bytes, bytearray, IO[bytes], Iterable[bytes], AsyncIterable[bytes], None] = None
864866
# It should be noted that we cannot use `json` here as that would override

src/openai/_streaming.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,13 @@ def __stream__(self) -> Iterator[_T]:
9898
body=data["error"],
9999
)
100100

101-
yield process_data(data=data, cast_to=cast_to, response=response)
102-
101+
yield process_data(
102+
data={"data": data, "event": sse.event}
103+
if self._options is not None and self._options.synthesize_event_and_data
104+
else data,
105+
cast_to=cast_to,
106+
response=response,
107+
)
103108
finally:
104109
# Ensure the response is closed even if the consumer doesn't read all data
105110
response.close()
@@ -203,8 +208,13 @@ async def __stream__(self) -> AsyncIterator[_T]:
203208
body=data["error"],
204209
)
205210

206-
yield process_data(data=data, cast_to=cast_to, response=response)
207-
211+
yield process_data(
212+
data={"data": data, "event": sse.event}
213+
if self._options is not None and self._options.synthesize_event_and_data
214+
else data,
215+
cast_to=cast_to,
216+
response=response,
217+
)
208218
finally:
209219
# Ensure the response is closed even if the consumer doesn't read all data
210220
await response.aclose()

src/openai/_types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ class RequestOptions(TypedDict, total=False):
122122
extra_json: AnyMapping
123123
idempotency_key: str
124124
follow_redirects: bool
125+
synthesize_event_and_data: bool
125126

126127

127128
# Sentinel class used until PEP 0661 is accepted

src/openai/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "openai"
4-
__version__ = "2.23.0" # x-release-please-version
4+
__version__ = "2.24.0" # x-release-please-version

src/openai/resources/beta/threads/runs/runs.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,7 @@ def create(
620620
extra_body=extra_body,
621621
timeout=timeout,
622622
query=maybe_transform({"include": include}, run_create_params.RunCreateParams),
623+
synthesize_event_and_data=True,
623624
),
624625
cast_to=Run,
625626
stream=stream or False,
@@ -1368,7 +1369,11 @@ def submit_tool_outputs(
13681369
else run_submit_tool_outputs_params.RunSubmitToolOutputsParamsNonStreaming,
13691370
),
13701371
options=make_request_options(
1371-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1372+
extra_headers=extra_headers,
1373+
extra_query=extra_query,
1374+
extra_body=extra_body,
1375+
timeout=timeout,
1376+
synthesize_event_and_data=True,
13721377
),
13731378
cast_to=Run,
13741379
stream=stream or False,
@@ -2075,6 +2080,7 @@ async def create(
20752080
extra_body=extra_body,
20762081
timeout=timeout,
20772082
query=await async_maybe_transform({"include": include}, run_create_params.RunCreateParams),
2083+
synthesize_event_and_data=True,
20782084
),
20792085
cast_to=Run,
20802086
stream=stream or False,
@@ -2822,7 +2828,11 @@ async def submit_tool_outputs(
28222828
else run_submit_tool_outputs_params.RunSubmitToolOutputsParamsNonStreaming,
28232829
),
28242830
options=make_request_options(
2825-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
2831+
extra_headers=extra_headers,
2832+
extra_query=extra_query,
2833+
extra_body=extra_body,
2834+
timeout=timeout,
2835+
synthesize_event_and_data=True,
28262836
),
28272837
cast_to=Run,
28282838
stream=stream or False,

0 commit comments

Comments
 (0)