[Bugfix][Router] Preserve full backend model metadata in /v1/models#927
Open
yzhan1 wants to merge 2 commits intovllm-project:mainfrom
Open
[Bugfix][Router] Preserve full backend model metadata in /v1/models#927yzhan1 wants to merge 2 commits intovllm-project:mainfrom
yzhan1 wants to merge 2 commits intovllm-project:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request enables the preservation of extra metadata fields in ModelInfo and ensures they are returned by the models endpoint. While the implementation includes new tests, feedback highlights that instantiating ModelCard with these extra fields may cause excessive warning logs due to existing model validators. Additionally, it is recommended to move the known_fields set to a class-level constant to improve performance.
6d3e092 to
8d88a03
Compare
Signed-off-by: Yaoming Zhan <yzhan@Mac.attlocal.net>
8d88a03 to
576f488
Compare
Signed-off-by: Yaoming Zhan <yzhan@Mac.attlocal.net>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This fixes #892 by preserving extra fields returned by backend
/v1/modelsresponses instead of rebuilding a minimal router-only model card.The change stores unknown backend model fields in
ModelInfo.extra_fieldsand serializes them back out from the router's/v1/modelsendpoint. That keeps metadata such asmax_model_lenandpermissionavailable to clients.Validation
uv run --group test python -m pytest -q src/tests/test_main_router_models.pyuv run --group test python -m pytest -q src/testsvllm/vllm-openai-cpu:latest-arm64):/v1/modelsincludedmax_model_lenandpermissionfork/mainrouter output dropped those fieldsbase_missing=['max_model_len', 'permission'],fix_missing=[])