Skip to content

Comments

fix: display served_model_name in /v1/models #13155

Merged
slin1237 merged 5 commits intosgl-project:mainfrom
Sunhaihua1:router_fix_with_lint
Nov 13, 2025
Merged

fix: display served_model_name in /v1/models #13155
slin1237 merged 5 commits intosgl-project:mainfrom
Sunhaihua1:router_fix_with_lint

Conversation

@Sunhaihua1
Copy link
Contributor

Motivation

fix the bug described in #12977

Modifications

add served_model_name in worker registration, so that it can be derived by model_id.

Accuracy Tests

run server by

python -m sglang.launch_server  --served-model-name  opt-125m --model-path ~/models/opt-125m  --host 0.0.0.0 --port 31000
RUST_LOG=info cargo run -- --worker-urls http://127.0.0.1:31000 --host 0.0.0.0 --port 30002

curl before modification

{"models":["/home/devuser/models/opt-125m"]}

after

{"models":["opt-125m"]}

Benchmarking and Profiling

Checklist

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Sunhaihua1, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves an issue where the router's API response for model_id would show the full file system path instead of a concise model name. It achieves this by adding a served_model_name field to the worker registration, which is then used to correctly identify and display the model, improving the clarity and usability of the router's output.

Highlights

  • Model ID Display Fix: Addresses a bug where the router was incorrectly displaying the full model path as the model_id instead of a more user-friendly name, as reported in issue [Bug] [Router] /v1/models not display "served_model_name" but "model_path" #12977.
  • Worker Registration Enhancement: Introduced a new served_model_name field in the worker registration process. This field is now prioritized when determining the model_id, ensuring a clearer and more accurate model identification in API responses.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly introduces the served_model_name field to provide a cleaner model identifier during worker registration, addressing the issue described. The changes to ServerInfo, get_dp_info, and DiscoverMetadataStep are logical and well-implemented. I have one minor suggestion to improve code conciseness and idiomatic usage of Rust's Option type.

@CatherineSue CatherineSue changed the title Router fix with lint fix: display served_model_name in /v1/models Nov 12, 2025
@Sunhaihua1
Copy link
Contributor Author

Sorry I dont know why CI failed. Should I solve it ? @slin1237 @CatherineSue

@slin1237
Copy link
Collaborator

the unit test failed
run make fmt
this will format the code for you
and I will merge if after unit test is passing
u can ignore other failures

@slin1237 slin1237 merged commit c2d69e8 into sgl-project:main Nov 13, 2025
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants