-
Notifications
You must be signed in to change notification settings - Fork 52.7k
fix(api-server): unblock /v1/chat/completions with narrow kwargs-collision fix #31139
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
Closed
Koraji95-coder
wants to merge
2
commits into
NousResearch:main
from
Koraji95-coder:fix/api-server-unblock-chat-completions
+70
−0
Closed
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
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
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.
Considered both of your suggestions (a) 4xx-on-mismatch and (b) drop-only-when-matching, and explicitly picked the unconditional pop for this PR. Two reasons:
Precedence semantics is the design conversation at feat(api-server): honor request-level model field for per-request model selection #10773. The competing PRs (fix(api-server): honor chat completions request model #25552, feat(api-server): honor X-Router-Model for per-request model override #16403, feat(api_server): honor inbound 'model' and 'provider' fields for per-request routing #18549, feat(gateway): add per-request model routing to API server #5862) are wrestling with exactly what the request-level
modelfield should mean — error, override, fallback, mismatch-warn. This PR is the band-aid that unblocks/v1/chat/completionsfor everyone while that design lands. Implementing either suggestion (a) or (b) here would mean picking a winner in the design debate, which is exactly what I don't want this PR to do.Failing-loud on caller-provided
modelwould surprise existing API consumers. Before the kwargs collision was ever triggered, callers could already sendmodelin their request — the server-sideconfig.yamlvalue won by virtue of the explicitmodel=modelkwarg in the constructor, and the caller's value was silently ignored. That's the current implicit behavior of every working deployment that happens to not hit the collision. The narrow pop preserves that behavior exactly.Added a regression test in
tests/gateway/test_api_server.py::TestCreateAgent::test_create_agent_pops_colliding_model_from_runtime_kwargs(commit 86d349a) that locks in the no-TypeError behavior, mirroring the existingtest_create_agent_forwards_config_reasoning_effortpattern in the same class.When #10773's full design lands, the
popgets replaced by whatever precedence semantics it specifies, and the test gets updated alongside. If the maintainer's strong preference is option (b) precedence-aware behavior here rather than at #10773, happy to rework.