Repository navigation
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 897ce0a518
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
|
|
||
| def _response_with_output_text_items(items: list[dict[str, Any]]) -> Response: | ||
| return Response.model_validate( |
There was a problem hiding this comment.
Use v1-compatible validation in test helper
In the test-pydantic-v1 nox session, noxfile.py installs pydantic<2 and runs the whole pytest suite, but this helper now calls Response.model_validate(...) unconditionally. The SDK's BaseModel does not shim model_validate for pydantic v1, so that CI path will fail with AttributeError before these regressions run. Use the repo's compatibility helper or Response.parse_obj(...) here instead.
Useful? React with 👍 / 👎.
…se-output-text # Conflicts: # tests/lib/responses/test_responses.py
|
Rebased onto latest |
|
A note on why this keeps showing conflicts: the edits under |
|
Re-verified against current main: |
|
Thanks for working on this! We’re closing this for now because we haven’t established a case where Responses structured-output parsing should accept null or empty text. If you’re hitting this in practice, please open an issue with a minimal reproduction and the API/provider you’re using—we’re happy to revisit. |
Changes being requested
ResponseOutputText.textto beNonewhen the API returns a nullableoutput_text.textitem.Response.output_textskip null text items instead of failing or appending a non-string value.responses.parse(...)leave nulloutput_textitems unparsed while still parsing later non-null output text items.Response.output_textand the structured parse path.Additional context & links
Fixes #3063.
I know the repository is generated; this PR is intended to pin down the runtime behavior and regression tests for the nullable API payload shape.
Verification:
PYTHONPATH=src python -m pytest tests\lib\responses\test_responses.py -qpython -m ruff check src\openai\types\responses\response_output_text.py src\openai\types\responses\response.py src\openai\lib\_parsing\_responses.py tests\lib\responses\test_responses.pypython -m pyright src\openai\types\responses\response_output_text.py src\openai\types\responses\response.py src\openai\lib\_parsing\_responses.py tests\lib\responses\test_responses.pypython -m ruff format --check src\openai\types\responses\response_output_text.py src\openai\types\responses\response.py src\openai\lib\_parsing\_responses.py tests\lib\responses\test_responses.pygit diff --check