Skip to content

Commit c36992f

Browse files
committed
Use getContent() directly for agent streaming instead of print_stream helper
1 parent 925d30e commit c36992f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

examples/openai/agent-stream-sources.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@
3737

3838
$result = $agent->call(new MessageBag(Message::ofUser($prompt)), ['stream' => true]);
3939

40-
print_stream($result);
41-
40+
foreach ($result->getContent() as $word) {
41+
echo $word;
42+
}
4243
echo \PHP_EOL;
4344

4445
echo 'Used sources:'.\PHP_EOL;

0 commit comments

Comments
 (0)