[sgl-route] Optimize the use of constant slices and retain to simplif…#12159
[sgl-route] Optimize the use of constant slices and retain to simplif…#12159slin1237 merged 3 commits intosgl-project:mainfrom
Conversation
Summary of ChangesHello @lengrongfu, 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 optimizes and simplifies the handling of SGLang-specific fields within the router. It consolidates the list of fields that need to be removed from request payloads into a single, lazily initialized constant. This change streamlines the code responsible for filtering these fields before requests are forwarded to OpenAI-compatible endpoints, enhancing code clarity and maintainability across similar operations. Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request refactors the removal of SGLang-specific fields from request payloads by introducing a static HashSet of field names. This is a good improvement, as it centralizes the list of fields, eliminates duplicated code, and uses a more performant retain method instead of repeated remove calls. The code is cleaner and more efficient. I have one minor suggestion to make the HashSet initialization even more concise.
…y SGLang field removal Signed-off-by: rongfu.leng <lenronfu@gmail.com>
65e158d to
fe87877
Compare
|
thanks for the contribution for better fmt |
thanks ~, I noticed that we have a pre-commit function. Can we add these basic operations to pre-commit? |
we should, and we tried |
Signed-off-by: rongfu.leng <lenronfu@gmail.com>
…y SGLang field removal
Motivation
There are similar operations in the chart and response APIs, so this field is extracted.
Modifications
Accuracy Tests
Benchmarking and Profiling
Checklist