We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6d18bef commit f34c88fCopy full SHA for f34c88f
examples/elevenlabs/text-to-speech-as-stream.php
@@ -12,7 +12,6 @@
12
use Symfony\AI\Platform\Bridge\ElevenLabs\ElevenLabs;
13
use Symfony\AI\Platform\Bridge\ElevenLabs\PlatformFactory;
14
use Symfony\AI\Platform\Message\Content\Text;
15
-use Symfony\Contracts\HttpClient\ChunkInterface;
16
17
require_once dirname(__DIR__).'/bootstrap.php';
18
@@ -27,9 +26,10 @@
27
26
28
$result = $platform->invoke($model, new Text('The first move is what sets everything in motion.'));
29
30
-$content = implode('', array_map(
31
- static fn (ChunkInterface $chunk): string => $chunk->getContent(),
32
- iterator_to_array($result->asStream()),
33
-));
+$content = '';
+
+foreach ($result->asStream() as $chunk) {
+ $content .= $chunk->getContent();
+}
34
35
echo $content.\PHP_EOL;
0 commit comments