Skip to content

Commit

Permalink
Add GPT-4 Turbo with Vision (#576)
Browse files Browse the repository at this point in the history
* latest GPT-4 Turbo model with vision capabilities

* update function calling
  • Loading branch information
mingming-ma committed Apr 16, 2024
1 parent 36af0b2 commit 1cb17f4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/PromptForm/DesktopPromptForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function DesktopPromptForm({

// Update model to the supported model when inputImages is not empty
useEffect(() => {
if (inputImageUrls?.length > 0) {
if (inputImageUrls?.length > 0 && !settings.model.supportsImages) {
const visionModel = models.find((model) => model.supportsImages);
if (visionModel && visionModel.name != settings.model.name) {
setSettings({ ...settings, model: visionModel });
Expand Down
7 changes: 5 additions & 2 deletions src/lib/ChatCraftModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,14 @@ export class ChatCraftModel {
get supportsFunctionCalling() {
const { name } = this;
// The OpenAI vision models can't do function calling
return !this.supportsImages && (name.startsWith("gpt-3.5-turbo") || name.startsWith("gpt-4"));
return (
!this.name.includes("vision") &&
(name.startsWith("gpt-3.5-turbo") || name.startsWith("gpt-4"))
);
}

get supportsImages() {
return this.name.includes("vision");
return this.name.includes("vision") || this.name == "gpt-4-turbo";
}

get prettyModel(): string {
Expand Down

0 comments on commit 1cb17f4

Please sign in to comment.