File tree Expand file tree Collapse file tree 1 file changed +10
-12
lines changed
samples/mastra-nextjs/app/src/mastra/agent Expand file tree Collapse file tree 1 file changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -13,24 +13,22 @@ import { getRepositoryPullRequests } from "../tools/getRepositoryPullRequests";
1313import { getRepositoryStars } from "../tools/getRepositoryStars" ;
1414
1515function getModel ( ) {
16- const provider = process . env . AWS_REGION ? "aws" : "gcp" ;
1716 const modelName = process . env . LLM_MODEL ;
1817 if ( modelName === undefined ) {
1918 throw new Error ( "LLM_MODEL is not defined in environment variables" ) ;
2019 }
2120
22- switch ( provider ) {
23- case "aws" :
24- // https://ai-sdk.dev/providers/ai-sdk-providers/amazon-bedrock#using-aws-sdk-credentials-chain-instance-profiles-instance-roles-ecs-roles-eks-service-accounts-etc
25- return createAmazonBedrock ( {
26- credentialProvider : fromNodeProviderChain ( ) ,
27- } ) ( modelName ) ;
28- case "gcp" :
29- // https://ai-sdk.dev/providers/ai-sdk-providers/google-vertex
30- return vertex ( modelName ) ;
31- default :
32- return modelName ;
21+ if ( process . env . AWS_REGION ) {
22+ // https://ai-sdk.dev/providers/ai-sdk-providers/amazon-bedrock#using-aws-sdk-credentials-chain-instance-profiles-instance-roles-ecs-roles-eks-service-accounts-etc
23+ return createAmazonBedrock ( {
24+ credentialProvider : fromNodeProviderChain ( ) ,
25+ } ) ( modelName ) ;
26+ } else if ( process . env . GOOGLE_VERTEX_LOCATION ) {
27+ // https://ai-sdk.dev/providers/ai-sdk-providers/google-vertex
28+ return vertex ( modelName ) ;
3329 }
30+
31+ return modelName ;
3432}
3533
3634export const agent = new Agent ( {
You can’t perform that action at this time.
0 commit comments