GPT API request crash the workflow

Hello, I am facing a quite troubling issue.

I am sending ´heavy’ requests to the gpt4 api approx 1000 tokens cost, with a backend workflow with a loop (16 times).

Out of 16, on average only 12 would goes through, the 4 other would make crash and stop the next steps of the workflow.

In my request, for parameters, I only specify the model and the prompt, I don’t know much about api.

Could someone please help me find a solution to make this workflow works every time please ?

Precision-*: I can’t make a condition check to relaunch the workflow because it actually crash it

Hey @thivend.pierreemmanu :wave:

You need to make sure you have this box checked. It will break the current workflow though. You will also have to re-initialize it. Then the workflow will continue even if it comes back with an error. Hope that helps :blush:

Oh thanks you sm i will try !:!

surprisly it doesn’t change anything :confused:

Did you re-initialize it? It should have broken your workflow steps and you would have to redo them.

Yes, but it doesn’t change anything

Maybe sharing a screenshot of your API and your workflows might help. It’s hard to help without seeing more information. :blush:

Yes sorry,
Here’s the workflow, basically i am asking gpt to create a meal for me, first i create a data meal, then i send the request then i edit the meal with the data from gpt ( mesage_content and error reponse ), 20% of the time the request fail and i don’t even have the error response.

Here’s the request, token cost is approx 900

Ps: i am launching this workflow in a loop ( 16 times ), but it shouldn’t exceed any limit, rpm or tkm

1 Like

How are you triggering your ‘simple’ workflow? Are you scheduling an API workflow on a list?

If so, this won’t really work well because at some point you will have too many calls happening at once.

It is better to loop the workflow once it is actually done, using a recursive loop with an iteration number. ChatGPT takes a while to get back to you. So if you are doing this 16 times all within 5 seconds or less of each other it will eventually overlap causing your workflows to fail.

Do you think that might be your issue?

So you would suggest me to wait for the request to go through to continue the loop ?

Yes, otherwise you will have too much running at one time and Bubble will probably cancel your loop thinking that you made an infinite loop.

Last time i tried with a loop that schedule the workflow with a current date time + 20s ( each loop ) to get 20s btw each request but i was still crashing for some loops

Yeah, ChatGPT takes a while to run. It is better to make sure to finish the workflow before going to the next one. Especially with a large request. :blush:

As we need to have the 16 loops with gpt response completed quickly i choose to use the “n” parameter and i will split the data.

which mean i will be able to send a fewer amount of request, i am trying and it looks great for now.

Thanks you sm for your time !

1 Like