-
Notifications
You must be signed in to change notification settings - Fork 5.2k
fix(types): restrict response.steer request inputs #3793
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
sylvesterkaczmarek
wants to merge
8
commits into
openai:main
Choose a base branch
from
sylvesterkaczmarek:fix/steer-input-wire-contract
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.
+28
−162
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8b0a2c2
fix: align stable steer input with wire contract
sylvesterkaczmarek 214fa56
fix: restrict stable steer params to user messages
sylvesterkaczmarek 4cd64c0
fix: align beta steer input with wire contract
sylvesterkaczmarek d628f34
fix: restrict beta steer params to user messages
sylvesterkaczmarek ae202e8
test: cover response steer input wire contract
sylvesterkaczmarek a698af4
refactor: preserve broad steer response model
sylvesterkaczmarek 728aaaa
refactor: preserve broad beta steer response model
sylvesterkaczmarek 7abcb79
test: cover steer request parameter contract
sylvesterkaczmarek 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
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,20 @@ | ||
| from openai.types.beta import beta_response_steer_input_param as beta_steer_param | ||
| from openai.types.responses import response_steer_input_param as steer_param | ||
|
|
||
|
|
||
| def test_stable_steer_params_match_wire_contract() -> None: | ||
| message = steer_param.ResponseSteerInputItemListMessage | ||
|
|
||
| assert set(message.__annotations__) == {"content", "role", "type"} | ||
| assert set(message.__required_keys__) == {"content", "role"} | ||
| assert steer_param.ResponseSteerInputItemList is message | ||
| assert "ResponseSteerInputItemListFunctionCallOutput" not in steer_param.__all__ | ||
|
|
||
|
|
||
| def test_beta_steer_params_match_wire_contract() -> None: | ||
| message = beta_steer_param.ResponseSteerInputItemListMessage | ||
|
|
||
| assert set(message.__annotations__) == {"content", "role", "type"} | ||
| assert set(message.__required_keys__) == {"content", "role"} | ||
| assert beta_steer_param.ResponseSteerInputItemList is message | ||
| assert "ResponseSteerInputItemListFunctionCallOutput" not in beta_steer_param.__all__ | ||
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.
Because both parameter modules enable
from __future__ import annotations,Required[...]is stored as a forward reference when theTypedDictclass is created, somessage.__required_keys__is empty rather than{"content", "role"}. This assertion—and the equivalent beta assertion—therefore fails on every supported Python version; verify requiredness through resolved type hints instead.Useful? React with 👍 / 👎.