Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Apr 16, 2024
2 parents a24c826 + 1e2a662 commit 185a1db
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/client/platforms/google.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
18 changes: 13 additions & 5 deletions app/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -136,6 +134,7 @@ export const KnowledgeCutOffDate: Record<string, string> = {
// 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 = [
Expand Down Expand Up @@ -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",
Expand Down
10 changes: 9 additions & 1 deletion app/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 185a1db

Please sign in to comment.