Skip to content

Commit c9a10d2

Browse files
committed
chore: concatenate multiple text content parts in case of gemini-2.0-flash-thinking-exp model
1 parent 467c321 commit c9a10d2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/providers/google-vertex-ai/chatComplete.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,12 @@ export const GoogleChatCompleteResponseTransform: (
644644
if (generation.content?.parts[0]?.text) {
645645
message = {
646646
role: 'assistant',
647-
content: generation.content.parts[0]?.text,
647+
content: generation.content.parts.reduce((acc, part) => {
648+
if (part.text) {
649+
acc += part.text;
650+
}
651+
return acc;
652+
}, ''),
648653
};
649654
} else if (generation.content?.parts[0]?.functionCall) {
650655
message = {

0 commit comments

Comments
 (0)