Skip to content
This repository was archived by the owner on Sep 15, 2024. It is now read-only.

Commit

Permalink
Improve [Utils] Check Vision Model (#308)
Browse files Browse the repository at this point in the history
- [+] refactor(utils.ts): improve isVisionModel function to use array.some instead of model.includes
  • Loading branch information
H0llyW00dzZ authored Mar 15, 2024
1 parent 8c96b11 commit a8bbe38
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions app/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,11 @@ export function getMessageImages(message: RequestMessage): string[] {
}

export function isVisionModel(model: string) {
return (
// model.startsWith("gpt-4-vision") ||
// model.startsWith("gemini-pro-vision") ||
model.includes("vision")
);
// 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",
];

return visionKeywords.some(keyword => model.includes(keyword));
}

0 comments on commit a8bbe38

Please sign in to comment.