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)
Top comments (1)
isn't this valid jsonl file content?
Because i am getting errors