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

Concurrently send OpenAI requests in batches #8

Closed
wants to merge 1 commit into from

Conversation

npalaska
Copy link
Collaborator

Overview

The current implementation of LLMBlock sends the entire dataset as a single large batch of requests to the OpenAI server. This may lead to some requests waiting too long for the response, resulting in timeout errors and potentially overloading the backend server with extremely large batches.

Changes Introduced

This PR refactors LLMBlock to use concurrent processing using Python’s concurrent.futures package. The key changes are:

  • Utilizes concurrent.futures for managing parallel tasks with threading for launching parallel tasks.
  • Allows users to specify the number of requests to send in each batch.
  • Allows users to specify the number of concurrent worker threads to handle batches.

Example Usage

  • If the user sets the concurrency to 8 and the batch size to 32, the system will run 8 concurrent threads, each sending a batch of 32 prompts, resulting in a total of 256 requests processed simultaneously by the backend server.

@shivchander
Copy link
Collaborator

closing in favor of #6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants