Skip to content

Commit 8a7acca

Browse files
committed
Process Metadata objects in StreamResult generator
1 parent a2fa527 commit 8a7acca

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/platform/src/Result/StreamResult.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\AI\Platform\Result;
1313

14+
use Symfony\AI\Platform\Metadata\Metadata;
15+
1416
/**
1517
* @author Christopher Hertel <mail@christopher-hertel.de>
1618
*/
@@ -23,6 +25,15 @@ public function __construct(
2325

2426
public function getContent(): \Generator
2527
{
26-
yield from $this->generator;
28+
foreach ($this->generator as $content) {
29+
if ($content instanceof Metadata) {
30+
foreach ($content as $key => $value) {
31+
$this->getMetadata()->add($key, $value);
32+
}
33+
continue;
34+
}
35+
36+
yield $content;
37+
}
2738
}
2839
}

0 commit comments

Comments
 (0)