-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Add support for OpenAI API : offline batch(file) processing #699
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
Merged
Conversation
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
merrymercy
requested changes
Jul 27, 2024
29 tasks
Ying1123
approved these changes
Jul 29, 2024
Finish accuracy and throughput test, it is ready to merge. |
timethink
pushed a commit
to timethink/sglang
that referenced
this pull request
Mar 9, 2025
…ect#699) Co-authored-by: hnyls2002 <hnyls2002@gmail.com>
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.
Thank you for your contribution, we really appreciate it. The following instructions will help improve your pull request and make it easier to receive feedback. If there are any items you don't understand, don't worry. Just submit the pull request and ask the maintainers for help.
Motivation
I want to support this OpenAI batch API functionally OpenAI Batch API Doc .
Running example
In this PR, we can support SGlang backend running behind the example code provided by OpenAI in the provided link seamlessly.
The frontend code is
and the return result is
Notes
Here we can also support text completion; this feature(Batch API) can work together with parallel sampling.
Beyond adding Batch API, we can further reorder/reschedule the request in the file to do further
The basic design now is that the output line order may not match the input line order. we can use the custom_id field which will be present in each line of the output file, and allow map requests in input to results in output.
Modification
cc @merrymercy @Ying1123 @hnyls2002 for CR
Checklist
pre-commit run --all-files
or other linting tools are used to fix potential lint issues.