Browse Source

Allow Amazon Bedrock Marketplace ARNs (#2874)

* Update validate.ts

Allow ARNs from Bedrock Marketplace, which are different because models are deployed using SageMaker Inference behind the scenes.

* Update bedrock.ts

Allow ARNs from Bedrock Marketplace, which are different because models are deployed using SageMaker Inference behind the scenes.
mlopezr 8 months ago
parent
commit
e53d299acf
2 changed files with 2 additions and 2 deletions
  1. 1 1
      src/api/providers/bedrock.ts
  2. 1 1
      webview-ui/src/utils/validate.ts

+ 1 - 1
src/api/providers/bedrock.ts

@@ -532,7 +532,7 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
 		 * match[4] - The resource ID (e.g., "anthropic.claude-3-sonnet-20240229-v1:0")
 		 */
 
-		const arnRegex = /^arn:aws:bedrock:([^:]+):([^:]*):(?:([^\/]+)\/([\w\.\-:]+)|([^\/]+))$/
+		const arnRegex = /^arn:aws:(?:bedrock|sagemaker):([^:]+):([^:]*):(?:([^\/]+)\/([\w\.\-:]+)|([^\/]+))$/
 		let match = arn.match(arnRegex)
 
 		if (match && match[1] && match[3] && match[4]) {

+ 1 - 1
webview-ui/src/utils/validate.ts

@@ -89,7 +89,7 @@ export function validateApiConfiguration(apiConfiguration?: ApiConfiguration): s
  */
 export function validateBedrockArn(arn: string, region?: string) {
 	// Validate ARN format
-	const arnRegex = /^arn:aws:bedrock:([^:]+):([^:]*):(?:([^/]+)\/([\w.\-:]+)|([^/]+))$/
+	const arnRegex = /^arn:aws:(?:bedrock|sagemaker):([^:]+):([^:]*):(?:([^/]+)\/([\w.\-:]+)|([^/]+))$/
 	const match = arn.match(arnRegex)
 
 	if (!match) {