Skip to content
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

[FEATURE] OpenAI Batch API Support #538

Open
jphme opened this issue Apr 16, 2024 · 1 comment
Open

[FEATURE] OpenAI Batch API Support #538

jphme opened this issue Apr 16, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request integrations

Comments

@jphme
Copy link
Contributor

jphme commented Apr 16, 2024

See here for the API and here for the (Twitter) announcement.

50% discount would be huge as most large jobs running on distilabel are not time-critical for us.

However there might be some architectural decisions (should a pipeline just loop infinitely and wait for results?) around implementing this.

If you agree that this should be in distilabel and we fletched out how this fits into the API, our team could probably do the implementation.

@gabrielmbmb
Copy link
Member

Hi @jphme!

The current architecture of distilabel assumes that LLM.generate is a blocking method that returns the generations right away.

Having that said, I think that we could have a GeneratorStep that uploads a file with the requests and send the request to create the batch job for that file. If the output file gets updated for every request finished, then this step could be pooling the output file and yield batches with the response for the requests of the batch that have finished.

If the output file doesn't get updated when a request of the batch job have finished, then we could have a LoadOpenAIBatchResults generator step that checks if a batch job have finished and if it has, then it reads the output file and yields batches of the specified size for the rest of the pipeline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request integrations
Projects
None yet
Development

No branches or pull requests

3 participants