From 1cfa80ab6b4bd48e3566f05992027b2ff460f2c5 Mon Sep 17 00:00:00 2001 From: "openai-sdks[bot]" <284451331+openai-sdks[bot]@users.noreply.github.com> Date: Fri, 28 Aug 2026 22:20:03 +0000 Subject: [PATCH 1/2] release: 3.6.0 (#3752) Automated Release PR --- ## [3.6.0](https://github.com/openai/openai-python/compare/v3.5.0...v3.6.0) (2026-08-27) ### Features * **api:** add compute_units to Responses and Chat Completions usage ([#3749](https://github.com/openai/openai-python/issues/3749)) ([52421d1](https://github.com/openai/openai-python/commit/52421d197e96b4480fcc16e78345578996452c79)) ### Bug Fixes * **auth:** harden X.509 workload identity integration ([#3740](https://github.com/openai/openai-python/issues/3740)) ([fc3ad6c](https://github.com/openai/openai-python/commit/fc3ad6c55a1a250e16707396e86d7373f690a0fc)) ### Chores * **deps-dev:** bump @stdy/cli from 0.22.1 to 0.22.2 ([#3719](https://github.com/openai/openai-python/issues/3719)) ([4f5598c](https://github.com/openai/openai-python/commit/4f5598c8d822fcc281bb8862e424fa6ead310ca8)) * **deps-dev:** bump mypy from 1.17 to 2.3.1 ([#3747](https://github.com/openai/openai-python/issues/3747)) ([0b52c9e](https://github.com/openai/openai-python/commit/0b52c9ecbc2bfe7059a1273674dff7647d414141)) * **deps-dev:** bump pandas-stubs from 2.2.2.240807 to 2.3.3.260113 ([#3659](https://github.com/openai/openai-python/issues/3659)) ([95f0b43](https://github.com/openai/openai-python/commit/95f0b43d31599fe501f045dcc24964d1df5e196f)) * **deps-dev:** bump pyright from 1.1.399 to 1.1.413 ([#3744](https://github.com/openai/openai-python/issues/3744)) ([9917c6e](https://github.com/openai/openai-python/commit/9917c6e28e66e90e1227b3d223c06a8c5441515a)) * **deps-dev:** bump rich from 14.2.0 to 15.0.0 ([#3717](https://github.com/openai/openai-python/issues/3717)) ([7a5484d](https://github.com/openai/openai-python/commit/7a5484d8118e82ec004e964ab2ca484c7dd7c555)) * **deps:** bump actions/checkout from 6.0.2 to 7.0.1 ([#3665](https://github.com/openai/openai-python/issues/3665)) ([d0a2550](https://github.com/openai/openai-python/commit/d0a25503498b51495aa4a1dbb97e616a24cd840e)) * **deps:** bump actions/download-artifact from 6.0.0 to 8.0.1 ([#3669](https://github.com/openai/openai-python/issues/3669)) ([f627619](https://github.com/openai/openai-python/commit/f6276194cda9b95499d3ebc3d6d013e730bf0490)) * **deps:** bump github/codeql-action/init from 4.37.1 to 4.37.7 ([#3745](https://github.com/openai/openai-python/issues/3745)) ([a36010d](https://github.com/openai/openai-python/commit/a36010dbb5d9c15a1fdf780772bc0204d0acf138)) ### Build System * **deps:** bump actions/setup-python from 5.6.0 to 7.0.0 ([#3672](https://github.com/openai/openai-python/issues/3672)) ([d765db7](https://github.com/openai/openai-python/commit/d765db7e929e76fc9e7edcc3a058d723ec69ac51)) * **deps:** bump pypa/gh-action-pypi-publish from 1.14.0 to 1.14.2 ([#3666](https://github.com/openai/openai-python/issues/3666)) ([dacbb66](https://github.com/openai/openai-python/commit/dacbb6646d1b18257545dbb29badf8a9311ed0ae)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: openai-sdks[bot] <284451331+openai-sdks[bot]@users.noreply.github.com> --- .release-please-manifest.json | 2 +- CHANGELOG.md | 30 ++++++++++++++++++++++++++++++ pyproject.toml | 2 +- src/openai/_version.py | 2 +- uv.lock | 2 +- 5 files changed, 34 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index bf0d036177..f391d41627 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.5.0" + ".": "3.6.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index c5ff44a138..76b74cd447 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,35 @@ # Changelog +## [3.6.0](https://github.com/openai/openai-python/compare/v3.5.0...v3.6.0) (2026-08-27) + + +### Features + +* **api:** add compute_units to Responses and Chat Completions usage ([#3749](https://github.com/openai/openai-python/issues/3749)) ([52421d1](https://github.com/openai/openai-python/commit/52421d197e96b4480fcc16e78345578996452c79)) + + +### Bug Fixes + +* **auth:** harden X.509 workload identity integration ([#3740](https://github.com/openai/openai-python/issues/3740)) ([fc3ad6c](https://github.com/openai/openai-python/commit/fc3ad6c55a1a250e16707396e86d7373f690a0fc)) + + +### Chores + +* **deps-dev:** bump @stdy/cli from 0.22.1 to 0.22.2 ([#3719](https://github.com/openai/openai-python/issues/3719)) ([4f5598c](https://github.com/openai/openai-python/commit/4f5598c8d822fcc281bb8862e424fa6ead310ca8)) +* **deps-dev:** bump mypy from 1.17 to 2.3.1 ([#3747](https://github.com/openai/openai-python/issues/3747)) ([0b52c9e](https://github.com/openai/openai-python/commit/0b52c9ecbc2bfe7059a1273674dff7647d414141)) +* **deps-dev:** bump pandas-stubs from 2.2.2.240807 to 2.3.3.260113 ([#3659](https://github.com/openai/openai-python/issues/3659)) ([95f0b43](https://github.com/openai/openai-python/commit/95f0b43d31599fe501f045dcc24964d1df5e196f)) +* **deps-dev:** bump pyright from 1.1.399 to 1.1.413 ([#3744](https://github.com/openai/openai-python/issues/3744)) ([9917c6e](https://github.com/openai/openai-python/commit/9917c6e28e66e90e1227b3d223c06a8c5441515a)) +* **deps-dev:** bump rich from 14.2.0 to 15.0.0 ([#3717](https://github.com/openai/openai-python/issues/3717)) ([7a5484d](https://github.com/openai/openai-python/commit/7a5484d8118e82ec004e964ab2ca484c7dd7c555)) +* **deps:** bump actions/checkout from 6.0.2 to 7.0.1 ([#3665](https://github.com/openai/openai-python/issues/3665)) ([d0a2550](https://github.com/openai/openai-python/commit/d0a25503498b51495aa4a1dbb97e616a24cd840e)) +* **deps:** bump actions/download-artifact from 6.0.0 to 8.0.1 ([#3669](https://github.com/openai/openai-python/issues/3669)) ([f627619](https://github.com/openai/openai-python/commit/f6276194cda9b95499d3ebc3d6d013e730bf0490)) +* **deps:** bump github/codeql-action/init from 4.37.1 to 4.37.7 ([#3745](https://github.com/openai/openai-python/issues/3745)) ([a36010d](https://github.com/openai/openai-python/commit/a36010dbb5d9c15a1fdf780772bc0204d0acf138)) + + +### Build System + +* **deps:** bump actions/setup-python from 5.6.0 to 7.0.0 ([#3672](https://github.com/openai/openai-python/issues/3672)) ([d765db7](https://github.com/openai/openai-python/commit/d765db7e929e76fc9e7edcc3a058d723ec69ac51)) +* **deps:** bump pypa/gh-action-pypi-publish from 1.14.0 to 1.14.2 ([#3666](https://github.com/openai/openai-python/issues/3666)) ([dacbb66](https://github.com/openai/openai-python/commit/dacbb6646d1b18257545dbb29badf8a9311ed0ae)) + ## [3.5.0](https://github.com/openai/openai-python/compare/v3.4.0...v3.5.0) (2026-08-27) diff --git a/pyproject.toml b/pyproject.toml index da36c382a5..b56bcc9de7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openai" -version = "3.5.0" +version = "3.6.0" description = "The official Python library for the openai API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/openai/_version.py b/src/openai/_version.py index 5f5fbb0639..31bb06f4b6 100644 --- a/src/openai/_version.py +++ b/src/openai/_version.py @@ -1,2 +1,2 @@ __title__ = "openai" -__version__ = "3.5.0" # x-release-please-version +__version__ = "3.6.0" # x-release-please-version diff --git a/uv.lock b/uv.lock index 1ad34ec3e8..76345ce8b1 100644 --- a/uv.lock +++ b/uv.lock @@ -1524,7 +1524,7 @@ wheels = [ [[package]] name = "openai" -version = "3.5.0" # x-release-please-version +version = "3.6.0" # x-release-please-version source = { editable = "." } dependencies = [ { name = "anyio" }, From b19c2161b1eac80fbf1f6f67a64a50af99c53356 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Fri, 28 Aug 2026 22:31:01 +0000 Subject: [PATCH 2/2] fix: avoid repeated numpy checks for embeddings (#3757) - [x] I understand that this repository is auto-generated and my pull request may not be merged ## Changes being requested Avoid calling has_numpy() once per returned embedding when the default embeddings decoder handles a bulk base64 response. The parser now checks whether any encoded vectors need decoding, resolves NumPy availability once per response, and reuses that result for every encoded vector. Add focused regressions that verify multiple encoded vectors trigger one availability check and responses containing only already-decoded vectors do not inspect NumPy. ## Additional context & links Closes #3753 Parser-only benchmark for 1,500 vectors x 1,536 dimensions with NumPy unavailable: 86.0 ms -> 20.5 ms median across 30 alternating runs, a 76.1% reduction and 4.18x speedup. With NumPy installed, performance was effectively unchanged/slightly improved: 24.0 ms -> 23.5 ms. Validation: - 79 focused embeddings tests passed under Pydantic v2 - 79 focused embeddings tests passed under Pydantic v1 - 11,232 full-suite tests passed; 144 skipped - Ruff format/check passed - Pyright passed - mypy passed - Three adversarial review rounds completed; the final two consecutive rounds were clean --- src/openai/lib/_parsing/_embeddings.py | 6 +++++- tests/lib/test_embeddings.py | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/openai/lib/_parsing/_embeddings.py b/src/openai/lib/_parsing/_embeddings.py index acb890fa52..5b03068bcd 100644 --- a/src/openai/lib/_parsing/_embeddings.py +++ b/src/openai/lib/_parsing/_embeddings.py @@ -20,11 +20,15 @@ def parse_embedding_response( if not obj.data: raise ValueError("No embedding data received") + if not any(isinstance(embedding.embedding, str) for embedding in obj.data): + return obj + + use_numpy = has_numpy() for embedding in obj.data: data = cast(object, embedding.embedding) if not isinstance(data, str): continue - if not has_numpy(): + if not use_numpy: # use array for base64 optimisation embedding.embedding = array.array("f", base64.b64decode(data)).tolist() else: diff --git a/tests/lib/test_embeddings.py b/tests/lib/test_embeddings.py index 787d580716..7c1eba53b0 100644 --- a/tests/lib/test_embeddings.py +++ b/tests/lib/test_embeddings.py @@ -63,6 +63,32 @@ def test_decode_preserves_response_and_non_string_vectors(encoding_format: Omit assert parsed.model == "text-embedding-3-small" +def test_decode_checks_numpy_once_per_response(monkeypatch: pytest.MonkeyPatch) -> None: + checks = 0 + + def has_numpy() -> bool: + nonlocal checks + checks += 1 + return False + + monkeypatch.setattr(embeddings_parser, "has_numpy", has_numpy) + response = make_response(ENCODED, ENCODED, ENCODED) + + embeddings_parser.parse_embedding_response(response, encoding_format=omit) + + assert checks == 1 + + +def test_decode_does_not_check_numpy_without_encoded_vectors(monkeypatch: pytest.MonkeyPatch) -> None: + def unexpected_decoder() -> bool: + raise AssertionError("a response without encoded vectors must not inspect the decoder") + + monkeypatch.setattr(embeddings_parser, "has_numpy", unexpected_decoder) + response = make_response([1.0, 2.0], [3.0, 4.0]) + + assert embeddings_parser.parse_embedding_response(response, encoding_format=omit) is response + + @pytest.mark.parametrize("encoding_format", ["float", "base64", None]) @pytest.mark.parametrize("vectors", [(ENCODED,), ("abc",), ()], ids=["encoded", "invalid", "empty"]) def test_explicit_format_is_untouched(