Skip to content

Commit 8c52580

Browse files
committed
remove bracket stripping in process gemini response
1 parent 779b3e4 commit 8c52580

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

core/llm/llms/Gemini.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -317,15 +317,6 @@ class Gemini extends BaseLLM {
317317
let buffer = "";
318318
for await (const chunk of stream) {
319319
buffer += chunk;
320-
if (buffer.startsWith("[")) {
321-
buffer = buffer.slice(1);
322-
}
323-
if (buffer.endsWith("]")) {
324-
buffer = buffer.slice(0, -1);
325-
}
326-
if (buffer.startsWith(",")) {
327-
buffer = buffer.slice(1);
328-
}
329320

330321
const parts = buffer.split("\n,");
331322

@@ -415,7 +406,7 @@ class Gemini extends BaseLLM {
415406
signal,
416407
});
417408

418-
for await (const chunk of streamSse(response)) {
409+
for await (const chunk of this.processGeminiResponse(streamSse(response))) {
419410
yield chunk;
420411
}
421412
}

0 commit comments

Comments
 (0)