-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(bedrock): add cross region inference profiles #31958
feat(bedrock): add cross region inference profiles #31958
Conversation
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
I was thinking if it's possible we can have a For example, claud 3.5 sonnet v2
I was considering a class like this export interface IInferenceProfile {
profileArn: string;
}
export class InferenceProfile implements IInferenceProfile {
readonly profileArn: string;
private static getCountryCode(scope: Construct): string {
const stack = Stack.of(scope);
if (!Token.isUnresolved(stack.region)) {
return stack.region.startsWith('us') ? 'us' : 'eu';
}
return 'us';
}
static fromModel(scope: Construct, model: bedrock.FoundationModelIdentifier): IInferenceProfile {
// Construct the inference profile ARN dynamically
const profileArn = Stack.of(scope).formatArn({
service: 'bedrock',
resource: 'inference-profile',
resourceName: `${this.getCountryCode(scope)}.${model.modelId}`,
});
return new InferenceProfile(profileArn);
}
static fromInferenceProfileArn(arn: string): IInferenceProfile {
return new InferenceProfile(arn);
}
constructor(profileArn: string) {
this.profileArn = profileArn;
}
} So we can bulid up the inference profile for Claude 3.5 Sonnet v2 like this // Create an inference profile for the model
const inferenceProfile = InferenceProfile.fromModel(this, bedrock.FoundationModelIdentifier.ANTHROPIC_CLAUDE_3_5_SONNET_20241022_V2_0); Things we need to check:
|
Thanks for the suggestions @pahud, I think that'd be a good way to proceed and I'll take a closer look in the coming weeks |
We are adding support for it also in awslabs/generative-ai-cdk-constructs#800 for the L2 Bedrock construct, which we expect to merge back to the core cdk |
This PR has been in the MERGE CONFLICTS state for 3 weeks, and looks abandoned. To keep this PR from being closed, please continue work on it. If not, it will automatically be closed in a week. |
This PR has been deemed to be abandoned, and will be automatically closed. Please create a new PR for these changes if you think this decision has been made in error. |
Comments on closed issues and PRs are hard for our team to see. |
Issue # (if applicable)
Closes #31957
Reason for this change
Abstractions for Bedrock cross region inference profiles and their identifiers (see), similar to those for Bedrock foundation models (see), do not currently exist; these would be useful for granting invoke permissions.
Description of changes
Added
CrossRegionInferenceProfileIdentifier
class containing cross region inference profile identifiersCrossRegionInferenceProfile
class containingDescription of how you validated changes
Unit tests and an integration test.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license