Skip to content

Commit 1d67e2d

Browse files
committed
support nano banana in strict open ai compliance false mode
1 parent b832886 commit 1d67e2d

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,23 @@ export const GoogleChatCompleteStreamChunkTransform: (
685685
}
686686
}),
687687
};
688+
} else if (generation.content?.parts[0]?.inlineData) {
689+
const part = generation.content.parts[0];
690+
const contentBlocks = [
691+
{
692+
index: streamState.containsChainOfThoughtMessage ? 1 : 0,
693+
delta: {
694+
type: 'image_url',
695+
image_url: {
696+
url: `data:${part.inlineData?.mimeType};base64,${part.inlineData?.data}`,
697+
},
698+
},
699+
},
700+
];
701+
message = {
702+
role: 'assistant',
703+
content_blocks: contentBlocks,
704+
};
688705
}
689706
return {
690707
delta: message,

src/providers/google/chatComplete.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,23 @@ export const GoogleChatCompleteStreamChunkTransform: (
726726
}
727727
}),
728728
};
729+
} else if (generation.content?.parts[0]?.inlineData) {
730+
const part = generation.content.parts[0];
731+
const contentBlocks = [
732+
{
733+
index: streamState.containsChainOfThoughtMessage ? 1 : 0,
734+
delta: {
735+
type: 'image_url',
736+
image_url: {
737+
url: `data:${part.inlineData?.mimeType};base64,${part.inlineData?.data}`,
738+
},
739+
},
740+
},
741+
];
742+
message = {
743+
role: 'assistant',
744+
content_blocks: contentBlocks,
745+
};
729746
}
730747
return {
731748
delta: message,

0 commit comments

Comments
 (0)