refactor: rename completion api token_ids to response_token_ids (supplement to #35225) - #38459
Open
CSWYF3634076 wants to merge 2 commits into
Open
CSWYF3634076 wants to merge 2 commits into
CSWYF3634076 wants to merge 2 commits into
Conversation
Contributor
Author
|
/rerun-test test_serving_completions.py test_protocol.py |
Contributor
|
⛔ Please ask a maintainer to run this command, or use the normal CI flow. |
Contributor
Author
|
@guapisolo @hnyls2002 Hi, can you help review this PR? The Completion API has also changed |
Collaborator
|
/tag-and-rerun-ci |
Contributor
Author
@guapisolo Thanks~ |
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
Rename completion api response
token_idstoresponse_token_ids.Motivation
PR sgl-project/sglang#35225 renamed
token_idstoresponse_token_ids, but the change was only applied to the Chat API.The Completion API still uses the original
token_ids, resulting in an inconsistency between the two APIs. This PR updates the Completion API to useresponse_token_idsas well, aligning it with the Chat API.Modifications
Before: Completion responses serialize generated token IDs as choices[*].token_ids.
After: Completion responses serialize generated token IDs as choices[*].response_token_ids
Accuracy Tests
main
{"id":"a1755b49a42e401b919d7a2a5d061c0d","object":"text_completion","created":1788859030,"model":"default","choices":[{"index":0,"text":" today. I think I'll go for a walk in the park. I love spending time outdoors, especially when the sun is shining. It's so refreshing to breathe in the fresh air and enjoy the beauty of nature. I might even bring a book with me and find a cozy spot to read. It's the perfect way to relax and unwind. I'm looking forward to it!\",\n \"model\": \"mistral-large-2402\",\n \"temperature\": 0,\n \"respons","logprobs":null,"finish_reason":"length","matched_stop":null,"token_ids":[4316,16,342,2118,342,5922,807,362,260,4961,295,270,9245,16,342,3518,13512,1014,41915,14,4861,1082,270,6029,344,48189,16,983,734,832,45827,304,35338,295,270,8289,3525,305,5465,270,13182,294,4936,16,342,2786,1749,4379,260,2339,418,678,305,1783,260,59215,9917,304,1733,16,983,734,270,5732,1722,304,12460,305,125861,16,342,4571,4735,6058,304,436,3,3955,361,582,18278,3362,582,67712,1985,109816,15,9186,20,3955,361,582,88634,3362,223,18,989,361,582,40410],"prompt_token_ids":[671,9670,344,3146,10722]}],"usage":{"prompt_tokens":5,"total_tokens":105,"completion_tokens":100,"prompt_tokens_details":null,"reasoning_tokens":0},"metadata":{"weight_version":"default","weight_versions":[{"version":"default","start":0,"end":100}]}}this pr
{"id":"767a01ba3c254962b7f4d0817b926226","object":"text_completion","created":1788858787,"model":"default","choices":[{"index":0,"text":" today. I think I'll go for a walk in the park. I love spending time outdoors, especially when the sun is shining. It's so refreshing to breathe in the fresh air and enjoy the beauty of nature. I might even bring a book with me and find a cozy spot to read. It's the perfect way to relax and unwind. I'm looking forward to it!\",\n \"model\": \"gpt-4o-mini\",\n \"temperature\": 0.7,\n","logprobs":null,"finish_reason":"length","matched_stop":null,"response_token_ids":[4316,16,342,2118,342,5922,807,362,260,4961,295,270,9245,16,342,3518,13512,1014,41915,14,4861,1082,270,6029,344,48189,16,983,734,832,45827,304,35338,295,270,8289,3525,305,5465,270,13182,294,4936,16,342,2786,1749,4379,260,2339,418,678,305,1783,260,59215,9917,304,1733,16,983,734,270,5732,1722,304,12460,305,125861,16,342,4571,4735,6058,304,436,3,3955,361,582,18278,3362,582,73,529,15,22,81,20191,75,3955,361,582,88634,3362,223,18,16,25,989],"prompt_token_ids":[671,9670,344,3146,10722]}],"usage":{"prompt_tokens":5,"total_tokens":105,"completion_tokens":100,"prompt_tokens_details":null,"reasoning_tokens":0},"metadata":{"weight_version":"default","weight_versions":[{"version":"default","start":0,"end":100}]}}Speed Tests and Profiling
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ❌ Run #34813616825
Latest PR Test (Extra): ❌ Run #34813616518
Latest PR Test (AMD ROCm 10): ❌ Run #34813616492