Merge pull request #4618 from LLukas22/Capture-completion-while-streaming

Capture `result.content` while streaming from chat LLM
This commit is contained in:
Nate Sesti 2025-03-12 18:56:54 -07:00 • committed by GitHub
commit 8ee83eb87c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -821,6 +821,7 @@ export abstract class BaseLLM implements ILLM {
for await (const chunk of stream) {
const result = fromChatCompletionChunk(chunk);
if (result) {
completion += result.content;
yield result;
}
if (!citations && (chunk as any).citations && Array.isArray((chunk as any).citations)) {