GPT-4o does not result 30% to 40% of the time

I am using the following two engines:

Define the model

$engine = “gpt-3.5-turbo-0125”;
$enginex = “gpt-4o”;

$result = search($prompt, $engine);

When I use $engine (gpt-3.5-turbo-0125), it always returns a result. However, if I use $enginex (gpt-4o), it sometimes returns a result, but in a few cases, it does not return any result.

Please note that $result is used in the next prompt. Despite our best efforts, this issue keeps occurring and is annoying our customers. Please suggest a solution. The entire program is in PHP.