[pull] main from openai:main - #139
Merged
Merged
Conversation
## Summary - Keep Azure provider validation errors value-free, using the existing non-empty-string validation convention. - Preserve `ValueError` and valid provider behavior. - Add offline sync/async HTTP and Realtime regression coverage. ## Validation - Focused Azure tests: 218 passed, 1 skipped. - Scoped Ruff, formatting, Pyright, and mypy checks passed.
## Summary Compute custom-code summaries from trusted workflow code in a separate read-only job. Publish its freshly generated report and patch through the existing comment job, retaining current-PR and run freshness checks. ## Validation - Focused Castiron unittest suite: 19 tests passed (one optional compiler test skipped). - Focused Ruff, Pyright, mypy, and Python compilation checks passed. - Workflow YAML, shell syntax, action-pin, and offline local-Git regression checks passed. The workflow change becomes active after it reaches the default branch. SDK CODEOWNER review is requested.
## Summary Apply consistent origin checks to WebSocket redirects across async Realtime and Responses, including reconnections. Reuse the existing Azure guard while preserving same-origin redirects, Azure behavior, and synchronous behavior. ## Validation - 148 focused tests passed, including socket-free redirect and reconnect regressions. - Compatibility checks passed with websockets 13.0, 13.1, 14.0, 14.2, and locked 15.0.1. - Repository lint, Pyright, mypy, and import checks passed. - No dependency changes.
## Summary - Preserve the configured TLS hostname and retain explicit transport settings. - Add offline sync/async request and TLS regression tests for HTTPX2, legacy HTTPX, aiohttp, and X.509 forwarding. ## Validation - Focused and nearby tests: 320 passed, 2 skipped. - Ruff, formatting, focused Pyright, and focused mypy passed. - Tests use fake credentials and a loopback-only server with an ephemeral certificate.
- [x] I understand that this repository is auto-generated and my pull request may not be merged ## Changes being requested Remove redundant import wrapping in five generated resources and one extra blank line in `MessageContent`. All six files become byte-identical to the verified Castiron output, with unchanged Python ASTs. The verified local custom-code report drops from 52 to 46 mixed files. No runtime behavior, public signatures, imports, exports, dependencies, API schema, or compiler behavior changes. ## Additional context & links The cleanup survives a fresh Castiron generation using the existing API and configuration inputs. The old and new pure-generated content hashes match. No Stainless fixture or generated-file ownership rule changes. Validation: - Pinned Ruff formatting and lint checks passed for all six files. - `./scripts/format` preserved the cleanup; unrelated formatter-only changes to the existing report scripts were not included. - `./scripts/lint` passed, including Pyright, mypy, and import checks. - The affected Threads Messages, Completions, Fine-tuning Jobs/Checkpoints, and Models resource suites passed: 380 tests under Pydantic v2 and 380 under Pydantic v1, using the local mock server. - The custom-code reporter verified the generated baseline and removed exactly these six customizations. No compiler companion is needed. This is a behavior-preserving SDK cleanup. Co-authored-by: apcha-oai <228803254+apcha-oai@users.noreply.github.com>
- [x] I understand that this repository is auto-generated and my pull request may not be merged ## Changes being requested Restore the generated sample values in the Speech, Batches, and Files resource tests, including the matching fake file-content URLs. Move the Responses `parse` signature check unchanged from the generated test file into the handwritten Responses tests. Coverage is preserved in these exact tests: - [tests/lib/responses/test_responses.py::test_parse_method_in_sync](https://github.com/openai/openai-python/blob/f1349ad105372d314f7e60ca407210073c1cb73d/tests/lib/responses/test_responses.py#L87) is the original test, moved verbatim. It compares `responses.create` with `responses.parse`, excludes `stream` and `tools`, and runs for both sync and async clients. - [tests/lib/responses/test_responses.py::test_parse_method_definition_in_sync](https://github.com/openai/openai-python/blob/f1349ad105372d314f7e60ca407210073c1cb73d/tests/lib/responses/test_responses.py#L98) remains unchanged. It checks the same two methods while excluding only `tools`, so it also checks the `stream` parameter. No SDK implementation, public API, or test coverage is removed. All four generated resource-test files become byte-identical to the verified generated output. This continues [openai-python#3696](#3696); no schema, configuration, compiler, dependency, fixture, or ownership-rule changes are needed. ## Additional context & links Validation: - The custom-code report verifies 46 -> 42 mixed files: four removed customizations, with no new custom-code files or changes to the others. - An AST comparison verifies exactly 60 expected fake-value substitutions, the verbatim move of the original signature test, and the unchanged stricter handwritten test. - `./scripts/format` and `./scripts/lint` passed, including Ruff, Pyright, mypy, and import checks. Unrelated formatter-only changes to the existing report scripts are not included. - The following suites passed under both Pydantic v2 and v1: 367 passed and 7 skipped in each environment. ```sh python -m pytest -q \ tests/api_resources/audio/test_speech.py \ tests/api_resources/test_batches.py \ tests/api_resources/test_files.py \ tests/api_resources/test_responses.py \ tests/lib/responses/test_responses.py::test_parse_method_in_sync \ tests/lib/responses/test_responses.py::test_parse_method_definition_in_sync ``` The cleanup survives a fresh Castiron generation using the existing API and configuration inputs. The old and new pure-generated content hashes match. From a checkout of the public PR, reproduce the report with: ```sh python3 scripts/castiron/custom_code_report.py report \ --base 5ac1e03 \ --head "$(git rev-parse HEAD)" --fetch --require-head-hash --public \ --out /tmp/castiron-generated-test-cleanup ``` Co-authored-by: apcha-oai <228803254+apcha-oai@users.noreply.github.com>
- [x] I understand that this repository is auto-generated and my pull request may not be merged ## Changes being requested Move the handwritten `chat.completions.create()` validation tests out of the generated resource-test file. The test methods and their client parameterization are copied verbatim; the generated file returns to the verified Castiron output. Coverage now lives in these exact tests: - [`tests/lib/chat/test_create_validation.py::TestCompletions::test_method_create_disallows_pydantic`](https://github.com/openai/openai-python/blob/f883c09550b4a123094b57659fb6a5b008b54581/tests/lib/chat/test_create_validation.py#L15) covers loose and strict synchronous clients. - [`tests/lib/chat/test_create_validation.py::TestAsyncCompletions::test_method_create_disallows_pydantic`](https://github.com/openai/openai-python/blob/f883c09550b4a123094b57659fb6a5b008b54581/tests/lib/chat/test_create_validation.py#L38) covers loose, strict, and aiohttp asynchronous clients. All five cases still assert the existing `TypeError` and message when a Pydantic `BaseModel` class is passed as `response_format` to `create()`. No test coverage, SDK implementation, public API, exception behavior, or client mode is removed. ## Additional context & links Validation: - The custom-code report verifies 42 -> 41 mixed files, one removed customization, and no changes to the other customizations. - AST and source-text comparisons prove both methods and their parameterization moved verbatim. Pytest collection confirms the same five cases. - `./scripts/format` and `./scripts/lint` passed, including Ruff, Pyright, mypy, and import checks. Unrelated formatter-only changes to the existing report scripts are not included. - Command: `python -m pytest -q tests/api_resources/chat/test_completions.py tests/lib/chat/test_create_validation.py` passed 125 tests under Pydantic v2 and 125 under Pydantic v1. - After rebasing onto the merged test cleanup in #3697, the exact-source check and full lint passed again. Command: `python -m pytest -q tests/lib/chat/test_create_validation.py` passed all five cases again in both Pydantic modes. No schema, configuration, compiler, dependency, fixture, or generated-file ownership changes are needed. The pure-generated content hash is unchanged. The existing `.castiron.stats.yml` is preserved byte-for-byte so this test-only PR does not overlap the separate release's generation metadata. --------- Co-authored-by: apcha-oai <228803254+apcha-oai@users.noreply.github.com>
## Summary Refresh the generated API reference and document the supported image-generation model names in the stable and beta Responses tool types. The SDK already accepts these model names; this changes documentation, not public type signatures or runtime behavior. ## Changes - Document `gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, `gpt-image-2-2026-04-21`, and `chatgpt-image-latest`; the documented default remains `gpt-image-1`. - Refresh the transformed OpenAPI snapshot, including the GPT Image 2 names for JSON image editing. ## (manual) Resolved `.castiron.stats.yml` conflicts while incorporating [the earlier public baseline](5ac1e03) and, subsequently, [the current public baseline](9d3ba20). Each intermediate merge retained the complete baseline record; CastIron regenerated and published the final metadata. The latest rebase preserves the test cleanups in [#3697](#3697) and [#3698](#3698): the full `tests/` tree matches current `main` byte-for-byte. Full SDK formatting and `git diff --check` passed. No handwritten runtime code changed. Co-authored-by: apcha-oai <228803254+apcha-oai@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )