mirror of
https://github.com/stackblitz/bolt.new
synced 2025-06-26 18:17:50 +00:00
🤖 [feat] Implement model creation for multiple providers
- Add getOpenAIModel function for OpenAI models - Implement getBedrockModel function for AWS Bedrock - Update imports to include new SDK components
This commit is contained in:
parent
aa4c5dc676
commit
f544c0c654
@ -1,4 +1,6 @@
|
||||
import { createAnthropic } from '@ai-sdk/anthropic';
|
||||
import { createOpenAI } from '@ai-sdk/openai';
|
||||
import { createAmazonBedrock } from '@ai-sdk/amazon-bedrock';
|
||||
|
||||
export function getAnthropicModel(apiKey: string) {
|
||||
const anthropic = createAnthropic({
|
||||
@ -7,3 +9,27 @@ export function getAnthropicModel(apiKey: string) {
|
||||
|
||||
return anthropic('claude-3-5-sonnet-20240620');
|
||||
}
|
||||
|
||||
export function getOpenAIModel(model: string, apiKey: string) {
|
||||
const openai = createOpenAI({
|
||||
apiKey,
|
||||
});
|
||||
|
||||
return openai(model);
|
||||
}
|
||||
|
||||
interface AWSCredentials {
|
||||
accessKeyId: string;
|
||||
secretAccessKey: string;
|
||||
region: string;
|
||||
}
|
||||
|
||||
export function getBedrockModel(modelId: string, credentials: AWSCredentials) {
|
||||
const bedrock = createAmazonBedrock({
|
||||
region: credentials.region,
|
||||
accessKeyId: credentials.accessKeyId,
|
||||
secretAccessKey: credentials.secretAccessKey,
|
||||
});
|
||||
|
||||
return bedrock(modelId);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user