-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Nightly OSS: Realtime API Pydantic Models incomplete for RealtimeResponseStatus type #3176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
xodn348
wants to merge
1
commit into
openai:main
Choose a base branch
from
xodn348:nightly/2502-realtime-api-pydantic-models-incomplete-for-real
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+92
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| Implemented the focused fix for openai/openai-python#2502. | ||
|
|
||
| Changed: | ||
| - [src/openai/types/realtime/realtime_response_status.py](/home/runner/work/oss-nightly-control/oss-nightly-control/target/src/openai/types/realtime/realtime_response_status.py): added optional `Error.message`. | ||
| - [src/openai/types/beta/realtime/realtime_response_status.py](/home/runner/work/oss-nightly-control/oss-nightly-control/target/src/openai/types/beta/realtime/realtime_response_status.py): added the same field for beta realtime. | ||
| - [tests/test_realtime_response_status.py](/home/runner/work/oss-nightly-control/oss-nightly-control/target/tests/test_realtime_response_status.py): added regression coverage for declared model fields and failed `response.done` payload parsing. | ||
| - [NIGHTLY_REPORT.md](/home/runner/work/oss-nightly-control/oss-nightly-control/target/NIGHTLY_REPORT.md): written with summary, tests, and risks. | ||
|
|
||
| Verified: | ||
| - `uv run python -m pytest tests/test_realtime_response_status.py -q` passed: `4 passed` | ||
| - `uv run ruff check ...` passed | ||
| - `uv run ruff format --check ...` passed | ||
| - `uv run python -m compileall -q ...` passed | ||
|
|
||
| I did not commit, push, or open a PR. The issue context used was https://github.com/openai/openai-python/issues/2502. | ||
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| from openai._compat import parse_obj, get_model_fields | ||
| from openai.types.realtime.response_done_event import ResponseDoneEvent | ||
| from openai.types.beta.realtime.response_done_event import ResponseDoneEvent as BetaResponseDoneEvent | ||
| from openai.types.realtime.realtime_response_status import Error as RealtimeResponseStatusError | ||
| from openai.types.beta.realtime.realtime_response_status import Error as BetaRealtimeResponseStatusError | ||
|
|
||
| ERROR_MESSAGE = "We're currently processing too many requests - please try again later." | ||
|
|
||
|
|
||
| def test_realtime_response_status_error_declares_message() -> None: | ||
| assert "message" in get_model_fields(RealtimeResponseStatusError) | ||
|
|
||
|
|
||
| def test_beta_realtime_response_status_error_declares_message() -> None: | ||
| assert "message" in get_model_fields(BetaRealtimeResponseStatusError) | ||
|
|
||
|
|
||
| def test_realtime_response_done_failed_error_message() -> None: | ||
| event = parse_obj( | ||
| ResponseDoneEvent, | ||
| { | ||
| "type": "response.done", | ||
| "event_id": "event_123", | ||
| "response": { | ||
| "object": "realtime.response", | ||
| "id": "resp_123", | ||
| "status": "failed", | ||
| "status_details": { | ||
| "type": "failed", | ||
| "error": { | ||
| "type": "invalid_request_error", | ||
| "code": "inference_rate_limit_exceeded", | ||
| "message": ERROR_MESSAGE, | ||
| }, | ||
| }, | ||
| "output": [], | ||
| }, | ||
| }, | ||
| ) | ||
|
|
||
| assert event.response.status_details is not None | ||
| assert event.response.status_details.error is not None | ||
| assert event.response.status_details.error.message == ERROR_MESSAGE | ||
|
|
||
|
|
||
| def test_beta_realtime_response_done_failed_error_message() -> None: | ||
| event = parse_obj( | ||
| BetaResponseDoneEvent, | ||
| { | ||
| "type": "response.done", | ||
| "event_id": "event_123", | ||
| "response": { | ||
| "object": "realtime.response", | ||
| "id": "resp_123", | ||
| "status": "failed", | ||
| "status_details": { | ||
| "type": "failed", | ||
| "error": { | ||
| "type": "invalid_request_error", | ||
| "code": "inference_rate_limit_exceeded", | ||
| "message": ERROR_MESSAGE, | ||
| }, | ||
| }, | ||
| "output": [], | ||
| }, | ||
| }, | ||
| ) | ||
|
|
||
| assert event.response.status_details is not None | ||
| assert event.response.status_details.error is not None | ||
| assert event.response.status_details.error.message == ERROR_MESSAGE |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop this generated
NIGHTLY_CODEX_FINAL_ATTEMPT_1.mdartifact from the commit: it contains CI-local absolute paths and run-specific narrative (including "I did not commit..."), which will go stale immediately and adds maintenance noise unrelated to the library’s source, tests, or user-facing docs.Useful? React with 👍 / 👎.