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

Handling large file content to comply with OpenAI API specifications #27

Open
florianbgt opened this issue Nov 1, 2024 · 0 comments
Open
Labels
annotation enhancement New feature or request

Comments

@florianbgt
Copy link
Member

florianbgt commented Nov 1, 2024

Description:

In the current implementation, the annotateOpenAICommandHandler function processes each file in the dependency tree by reading its entire content and sending it to the OpenAI API in a single request. This approach encounters issues when dealing with large files, as it may exceed the OpenAI API's maximum request size limitations.

export default async function annotateOpenAICommandHandler(

Problem:

Transmitting large file contents in a single request can lead to errors or failures due to the OpenAI API's constraints on request sizes.

Objective:

Implement a mechanism to divide large file contents into smaller chunks, ensuring each chunk adheres to the OpenAI API's size specifications. This approach will facilitate successful processing of large files without exceeding API limitations.

Proposed Solution:

  1. Determine Maximum Chunk Size: Identify the maximum allowable size for each chunk based on OpenAI's API specifications.
  2. Implement Chunking Mechanism: Develop functionality to split large file contents into appropriately sized chunks.
  3. Sequential Processing: Ensure that each chunk is processed in sequence, maintaining the integrity and order of the original content.
@florianbgt florianbgt converted this from a draft issue Nov 1, 2024
@florianbgt florianbgt added enhancement New feature or request annotation labels Nov 1, 2024
@florianbgt florianbgt changed the title Send file by chunk to open AI API when doing the annotations Handling large file content to comply with OpenAI API specifications Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
annotation enhancement New feature or request
Projects
Status: TODO
Development

No branches or pull requests

1 participant