#How to send multiple/parallel requests to the ChatGPT API
8 messages · Page 1 of 1 (latest)
no, 1 prompt = 1 conversation
it cant remember 2 split API calls
Hi, I do not want ChatGPT to remember the two calls. I just want to send two or more separate and independent conversations at the same time in parallel. It seems this can be done with asynchronous calls but for me, it is a hassle to understand and work with.
You can send all the prompts at once to the API in a prompts array
You can also use async batching to batch and start a whole bunch of requests at once and then wait for them to all finish by having them all be some kind of Future or equivalent
Hi, thanks maybe I should have explicitly asked for an array.
Do you have an example of how you get it to make an array of answers from a sequence of questions?
I would like it to answer multiple categories per request.
I had tried asking it to send JSON format but that failed as it was inconsistent in the format. I also tried to get it to make a CSV table but it did not do as I wanted.
Maybe if I told it to pretend to be a Python function that takes as input a vector of questions and that outputs a vector of answers it would have followed. I could have maybe given it an explicit example of the format like (I did not try):
You are a Python function that takes as input a list of prompts and that outputs a list of answers. Do not provide any further text than the contents of the answer list. You will answer in the following format :
summarize and ask follow-up questions for each element of the array below :
[ (text 1), ( text 2) ]
Your answer array ( only provide the list ):
[ [Summary: (summary of text 1), Questions: (follow up questions of text 1)], [Summary: (summary of text 2), Questions: (follow up questions of text 2)] ]
For the asynchronous calls I use Python and it was a struggle to learn how to make asynchronous calls. The API often got stuck and I had to reboot my vs code notebook. If you also use python would you happen to have a snippet to share on how send to send asynchronous calls? I know that there is a snippet on the openai-python github page here: https://github.com/openai/openai-python. But I did not understand what should go in the "..." that they wrote.