Skip to content

Commit f34c88f

Browse files
committed
ref
1 parent 6d18bef commit f34c88f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

examples/elevenlabs/text-to-speech-as-stream.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use Symfony\AI\Platform\Bridge\ElevenLabs\ElevenLabs;
1313
use Symfony\AI\Platform\Bridge\ElevenLabs\PlatformFactory;
1414
use Symfony\AI\Platform\Message\Content\Text;
15-
use Symfony\Contracts\HttpClient\ChunkInterface;
1615

1716
require_once dirname(__DIR__).'/bootstrap.php';
1817

@@ -27,9 +26,10 @@
2726

2827
$result = $platform->invoke($model, new Text('The first move is what sets everything in motion.'));
2928

30-
$content = implode('', array_map(
31-
static fn (ChunkInterface $chunk): string => $chunk->getContent(),
32-
iterator_to_array($result->asStream()),
33-
));
29+
$content = '';
30+
31+
foreach ($result->asStream() as $chunk) {
32+
$content .= $chunk->getContent();
33+
}
3434

3535
echo $content.\PHP_EOL;

0 commit comments

Comments
 (0)