mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
Update AI model check (#37395)
* Update AI model chekc * Add comment * Fix test
This commit is contained in:
1 parent
5f76c85dd1
commit
7505c2923e
2 files changed
+4
-3
No files matched your search
@@ -18,7 +18,7 @@ describe('getModel', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
vi.resetAllMocks()
|
||||
vi.stubEnv('AWS_BEDROCK_PROFILE', 'test')
|
||||
vi.stubEnv('AWS_BEDROCK_ROLE_ARN', 'test')
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
|
||||
@@ -33,10 +33,10 @@ export const ModelErrorMessage =
|
||||
export async function getModel(routingKey?: string, isLimited?: boolean): Promise<ModelResponse> {
|
||||
const hasAwsCredentials = await checkAwsCredentials()
|
||||
|
||||
const hasAwsBedrockprofile = !!process.env.AWS_BEDROCK_PROFILE
|
||||
const hasAwsBedrockRoleArn = !!process.env.AWS_BEDROCK_ROLE_ARN
|
||||
const hasOpenAIKey = !!process.env.OPENAI_API_KEY
|
||||
|
||||
if (hasAwsBedrockprofile && hasAwsCredentials) {
|
||||
if (hasAwsBedrockRoleArn && hasAwsCredentials) {
|
||||
const bedrockModel = IS_THROTTLED || isLimited ? BEDROCK_NORMAL_MODEL : BEDROCK_PRO_MODEL
|
||||
const bedrock = createRoutedBedrock(routingKey)
|
||||
|
||||
@@ -45,6 +45,7 @@ export async function getModel(routingKey?: string, isLimited?: boolean): Promis
|
||||
}
|
||||
}
|
||||
|
||||
// [Joshen] Only for local/self-hosted, hosted should always only use bedrock
|
||||
if (hasOpenAIKey) {
|
||||
return {
|
||||
model: openai(OPENAI_MODEL),
|
||||
|
||||
Reference in new issue
Block a user