Skip to content

Commit 814b233

Browse files
committed
Improve metadata extraction by adding check for 'id' in data stream
1 parent 8ad3114 commit 814b233

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

examples/openai/toolcall-stream-with-usage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
*/
1111

1212
use Symfony\AI\Agent\Agent;
13-
use Symfony\AI\Agent\Toolbox\AgentProcessor;
1413
use Symfony\AI\Agent\Bridge\Clock\Clock;
1514
use Symfony\AI\Agent\Bridge\OpenMeteo\OpenMeteo;
15+
use Symfony\AI\Agent\Toolbox\AgentProcessor;
1616
use Symfony\AI\Agent\Toolbox\Toolbox;
1717
use Symfony\AI\Platform\Bridge\OpenAi\PlatformFactory;
1818
use Symfony\AI\Platform\Bridge\OpenAi\TokenOutputProcessor;

src/platform/src/Bridge/OpenAi/Gpt/ResultConverter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ private function convertStream(RawResultInterface|RawHttpResult $result): \Gener
9292
$toolCalls = [];
9393
$metadata = [];
9494
foreach ($result->getDataStream() as $data) {
95-
if (!$metadata) {
95+
if (!$metadata && isset($data['id'])) {
9696
$metadata['id'] = $data['id'];
9797
}
9898

0 commit comments

Comments
 (0)