Merge branch 'main' into main

This commit is contained in:
Cole Medin
2024-10-24 08:13:26 -05:00
committed by GitHub
18 changed files with 595 additions and 95 deletions

View File

@@ -6,6 +6,8 @@ import { createOpenAI } from '@ai-sdk/openai';
import { createGoogleGenerativeAI } from '@ai-sdk/google';
import { ollama } from 'ollama-ai-provider';
import { createOpenRouter } from "@openrouter/ai-sdk-provider";
import { mistral } from '@ai-sdk/mistral';
import { createMistral } from '@ai-sdk/mistral';
export function getAnthropicModel(apiKey: string, model: string) {
const anthropic = createAnthropic({
@@ -23,6 +25,14 @@ export function getOpenAIModel(apiKey: string, model: string) {
return openai(model);
}
export function getMistralModel(apiKey: string, model: string) {
const mistral = createMistral({
apiKey
});
return mistral(model);
}
export function getGoogleModel(apiKey: string, model: string) {
const google = createGoogleGenerativeAI(
apiKey,
@@ -77,6 +87,8 @@ export function getModel(provider: string, model: string, env: Env) {
return getGoogleModel(apiKey, model)
case 'Deepseek':
return getDeepseekModel(apiKey, model)
case 'Mistral':
return getMistralModel(apiKey, model);
default:
return getOllamaModel(model);
}