diff --git a/app/client/platforms/google.ts b/app/client/platforms/google.ts index 848e5cd3f0d..3a814b90328 100644 --- a/app/client/platforms/google.ts +++ b/app/client/platforms/google.ts @@ -112,8 +112,8 @@ export class GeminiProApi implements LLMApi { options.onController?.(controller); try { let googleChatPath = visionModel - ? Google.VisionChatPath - : Google.ChatPath; + ? Google.VisionChatPath(modelConfig.model) + : Google.ChatPath(modelConfig.model); let chatPath = this.path(googleChatPath); // let baseUrl = accessStore.googleUrl; diff --git a/app/constant.ts b/app/constant.ts index 2032115301e..b90467bb5c2 100644 --- a/app/constant.ts +++ b/app/constant.ts @@ -98,10 +98,8 @@ export const Azure = { export const Google = { ExampleEndpoint: "https://generativelanguage.googleapis.com/", - ChatPath: "v1beta/models/gemini-pro:generateContent", - VisionChatPath: "v1beta/models/gemini-pro-vision:generateContent", - - // /api/openai/v1/chat/completions + ChatPath: (modelName: string) => `v1beta/models/${modelName}:generateContent`, + VisionChatPath: (modelName: string) => `v1beta/models/${modelName}:generateContent`, }; export const DEFAULT_INPUT_TEMPLATE = `{{input}}`; // input / time / model / lang @@ -136,6 +134,7 @@ export const KnowledgeCutOffDate: Record = { // After improvements, // it's now easier to add "KnowledgeCutOffDate" instead of stupid hardcoding it, as was done previously. "gemini-pro": "2023-12", + "gemini-pro-vision": "2023-12", }; export const DEFAULT_MODELS = [ @@ -311,7 +310,16 @@ export const DEFAULT_MODELS = [ }, }, { - name: "gemini-pro", + name: "gemini-1.0-pro", + available: true, + provider: { + id: "google", + providerName: "Google", + providerType: "google", + }, + }, + { + name: "gemini-1.5-pro-latest", available: true, provider: { id: "google", diff --git a/app/utils.ts b/app/utils.ts index b3155697738..07d0dcb13cc 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -290,7 +290,15 @@ export function getMessageImages(message: RequestMessage): string[] { } export function isVisionModel(model: string) { - const visionKeywords = ["vision", "claude-3"]; + + // Note: This is a better way using the TypeScript feature instead of `&&` or `||` (ts v5.5.0-dev.20240314 I've been using) + + const visionKeywords = [ + "vision", + "claude-3", + "gemini-1.5-pro", + ]; + const isGpt4Turbo = model.includes("gpt-4-turbo") && !model.includes("preview"); return visionKeywords.some((keyword) => model.includes(keyword)) || isGpt4Turbo;