Conversion of entire PDF into JSON Format

I am using Gpt 4o which has around 16k output token limit
I am extracting entire data of pdf and converting it into json format.
PDF is Structured
currently my approach is
1 extraction of text from pdf using pymupdf
2 creating chunks of data (as pdf can be of 8 to 70 pages)
3. converting the extracted data into json
problem is sending request N no. of times increasing time and i am getting final output in too much time
example around for 16 pages of pdf it is taking 6minutes

I’m guessing that you are sequentially sending the results. Use parallelization.

Ok thankyou. by the way i am using asynchronous request now
can you tell me if sending these request asynchronously affects the output of request or
interchanging the result of request

No. The result will be the same and you won’t be able to use it until it’s ready.

Also, make sure that you are using async correctly to ensure that the API is being called in parallel, and not sequentially.