We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<?php use Spatie\Async\Pool; require __DIR__ . '/vendor/autoload.php'; $input = [ "Sentence 1.", "Sentence 2." ]; $pool = Pool::create(); $yourApiKey = 'get your own'; $client = OpenAI::client($yourApiKey); foreach ($input as $index => $text) { $pool->add(function () use ($client, $text, $index) { $audio = $client->audio()->speech([ 'model' => 'tts-1', 'input' => $text, 'voice' => 'alloy', 'response_format' => 'mp3', ]); // audio file content as string file_put_contents("output_$index.mp3", $audio); }); } $pool->wait();
errors
Fatal error: Uncaught TypeError: Cannot assign Laravel\SerializableClosure\Serializers\Native to property OpenAI\Transporters\HttpTransporter::$streamHandler of type Closure in /Users/onin/dev/tests/openai/tts/vendor/laravel/serializable-closure/src/Serializers/Native.php:513 Stack trace: #0 /Users/onin/dev/tests/openai/tts/vendor/laravel/serializable-closure/src/Serializers/Native.php(513): ReflectionProperty->setValue(Object(OpenAI\Transporters\HttpTransporter), Object(Laravel\SerializableClosure\Serializers\Native)) #1 /Users/onin/dev/tests/openai/tts/vendor/laravel/serializable-closure/src/Serializers/Native.php(510): Laravel\SerializableClosure\Serializers\Native->mapByReference(Object(OpenAI\Transporters\HttpTransporter)) #2 /Users/onin/dev/tests/openai/tts/vendor/laravel/serializable-closure/src/Serializers/Native.php(440): Laravel\SerializableClosure\Serializers\Native->mapByReference(Object(OpenAI\Client)) #3 /Users/onin/dev/tests/openai/tts/vendor/laravel/serializable-closure/src/Serializers/Native.php(143): Laravel\SerializableClosure\Serializers\Native->mapByReference(Array) #4 [internal function]: Laravel\SerializableClosure\Serializers\Native->__serialize() #5 /Users/onin/dev/tests/openai/tts/vendor/spatie/async/src/Runtime/ParentRuntime.php(88): serialize(Object(Laravel\SerializableClosure\SerializableClosure)) #6 /Users/onin/dev/tests/openai/tts/vendor/spatie/async/src/Runtime/ParentRuntime.php(70): Spatie\Async\Runtime\ParentRuntime::encodeTask(Object(Laravel\SerializableClosure\SerializableClosure), 100000) #7 /Users/onin/dev/tests/openai/tts/vendor/spatie/async/src/Pool.php(149): Spatie\Async\Runtime\ParentRuntime::createProcess(Object(Closure), NULL, '/opt/homebrew/C...', 100000) #8 /Users/onin/dev/tests/openai/tts/app.php(17): Spatie\Async\Pool->add(Object(Closure)) #9 {main} thrown in /Users/onin/dev/tests/openai/tts/vendor/laravel/serializable-closure/src/Serializers/Native.php on line 513
The text was updated successfully, but these errors were encountered:
Have you found a fix for this? I wasted 2 hours of my life thinking I was screwing something up then found your open issue here.
Sorry, something went wrong.
No. OpenAi's Python lib works fine.
How is that relevant?
It achieves the same solution in a different programming language
No branches or pull requests
errors
The text was updated successfully, but these errors were encountered: