From 0b06f9686b8a6d39ebc98c7fd61e915483f19cb1 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Tue, 21 May 2024 16:14:21 +0300 Subject: [PATCH] Enable image inlining for Gemini flash --- src/prompt-converters.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/prompt-converters.js b/src/prompt-converters.js index 9b35d3c65..5a76f3802 100644 --- a/src/prompt-converters.js +++ b/src/prompt-converters.js @@ -263,8 +263,14 @@ function convertGooglePrompt(messages, model, useSysPrompt = false, charName = ' const PNG_PIXEL = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='; const visionSupportedModels = [ - 'gemini-1.0-pro-vision-latest', + 'gemini-1.5-flash-latest', 'gemini-1.5-pro-latest', + 'gemini-1.0-pro-vision-latest', + 'gemini-pro-vision', + ]; + + const dummyRequiredModels = [ + 'gemini-1.0-pro-vision-latest', 'gemini-pro-vision', ]; @@ -343,7 +349,7 @@ function convertGooglePrompt(messages, model, useSysPrompt = false, charName = ' }); // pro 1.5 doesn't require a dummy image to be attached, other vision models do - if (isMultimodal && model !== 'gemini-1.5-pro-latest' && !hasImage) { + if (isMultimodal && dummyRequiredModels.includes(model) && !hasImage) { contents[0].parts.push({ inlineData: { mimeType: 'image/png',