Skip to content

Commit c1f007b

Browse files
authored
Merge pull request #3 from nito-web/main
fix(stream): stop dropping TextDelta chunks from Symfony AI
2 parents 8be5fc8 + 45f1f24 commit c1f007b

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Classes/Response/StreamChunkIterator.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ public function getIterator(): \Generator
4747
yield $chunk;
4848
continue;
4949
}
50+
// Symfony AI yields Stringable TextDelta objects, not raw strings
51+
if ($chunk instanceof \Stringable) {
52+
$text = (string)$chunk;
53+
$this->accumulated .= $text;
54+
yield $text;
55+
continue;
56+
}
5057
// Capture TokenUsage objects from the stream
5158
if (is_object($chunk) && method_exists($chunk, 'getPromptTokens')) {
5259
$this->usage = new AiUsageStatistics(

0 commit comments

Comments
 (0)