'hireblitz260823', ])->withOptions(['verify' => (app()->environment() == 'local') ? false : false])->timeout(800) ->get('https://aictio.applikuapp.com/api/embeddings', [ 'input' => $embedding_query, ] ); $embedding_response = json_decode($response->body(), true); if (is_null($embedding_response)) { throw new Exception('Embedding response failed, null response'); } if (isset($embedding_response['error'])) { throw new Exception($embedding_response['error']); } return new Vector(array_values($embedding_response)[0]); } catch (Exception $e) { $currentAttempt++; if ($currentAttempt >= $maxRetries) { throw $e; } // Optional: Add sleep for a few seconds if you want to delay the next attempt // sleep(1); } } } }