Kirill
Posted on December 15, 2023
During uploading a file to OpenAI API you can receive an error:
Fatal error: Uncaught Exception: operation aborted by callback in /var/www/html/vendor/orhanerday/open-ai/src/OpenAi.php on line 962
Here is my code which produces this error:
require 'vendor/autoload.php';
use Orhanerday\OpenAi\OpenAi;
$openAi = new OpenAi($_SERVER['OPEN_AI_KEY']);
$pricesFile = curl_file_create(__DIR__ . '/../data/file.json');
$file = $openAi->uploadFile([
'file' => $pricesFile,
'purpose' => 'assistants',
]);
Solution
The problem is that I didn't have the file on the provided path: __DIR__ . '/../data/file.json
. You need to check and fix the path and then run your script again.
Follow me on X (prev Twitter)
💖 💪 🙅 🚩
Kirill
Posted on December 15, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
laravel From Concept to Image: Exploring OpenAI Image Generation API with Laravel 10 and VueJS
June 21, 2023