Skip to content

Commit

Permalink
feat: support new Claude models (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
mondaychen authored Jun 25, 2024
1 parent 7ba06de commit a7efe45
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/helpers/aiSdkUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export enum SupportedModels {
Gpt4Turbo = "gpt-4-turbo",
Gpt4O = "gpt-4o",
Claude3Sonnet = "claude-3-sonnet-20240229",
Claude3Opus = "claude-3-opus-20240229",
Claude35Sonnet = "claude-3-5-sonnet-20240620",
}

function isSupportedModel(value: string): value is SupportedModels {
Expand All @@ -27,14 +29,18 @@ export const DisplayName = {
[SupportedModels.Gpt4Turbo]: "GPT-4 Turbo",
[SupportedModels.Gpt4O]: "GPT-4o",
[SupportedModels.Claude3Sonnet]: "Claude 3 Sonnet",
[SupportedModels.Claude3Opus]: "Claude 3 Opus",
[SupportedModels.Claude35Sonnet]: "Claude 3.5 Sonnet",
};

export function hasVisionSupport(model: SupportedModels) {
return (
model === SupportedModels.Gpt4VisionPreview ||
model === SupportedModels.Gpt4Turbo ||
model === SupportedModels.Gpt4O ||
model === SupportedModels.Claude3Sonnet
model === SupportedModels.Claude3Sonnet ||
model === SupportedModels.Claude3Opus ||
model === SupportedModels.Claude35Sonnet
);
}

Expand Down Expand Up @@ -67,7 +73,7 @@ export function findBestMatchingModel(
}
// ensure the provider's API key is available
if (!openAIKey && anthropicKey && !isAnthropicModel(result)) {
result = SupportedModels.Claude3Sonnet;
result = SupportedModels.Claude35Sonnet;
} else if (openAIKey && !anthropicKey && !isOpenAIModel(result)) {
result = SupportedModels.Gpt4O;
}
Expand Down

0 comments on commit a7efe45

Please sign in to comment.