From 32e56d645acc0581ae0d86a4e945a978416c447f Mon Sep 17 00:00:00 2001 From: Jimmy Gaussen Date: Sat, 23 Mar 2024 01:32:35 +0100 Subject: [PATCH] chore(bedrock): update foundation models (#29468) ### Issue # (if applicable) Could not find any in the backlog ### Reason for this change Update the CDK listed Bedrock foundation models to match the current availability, as well as add missing deprecated versions ### Description of changes * Added new models * Marked existing models as deprecated ### Description of how you validated changes I compared the current CDK models to live SDK data, using the `bedrock:ListFoundationModels` API results. Deprecated versions were established using the `modelLifecycle.status` field ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../aws-bedrock/lib/foundation-model.ts | 119 ++++++++++++++++-- 1 file changed, 109 insertions(+), 10 deletions(-) diff --git a/packages/aws-cdk-lib/aws-bedrock/lib/foundation-model.ts b/packages/aws-cdk-lib/aws-bedrock/lib/foundation-model.ts index 645a696aa7d56..da5edc9979791 100644 --- a/packages/aws-cdk-lib/aws-bedrock/lib/foundation-model.ts +++ b/packages/aws-cdk-lib/aws-bedrock/lib/foundation-model.ts @@ -8,60 +8,159 @@ import { ArnFormat, Stack } from '../../core'; * @see https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html */ export class FoundationModelIdentifier { - /** Base model "ai21.j2-mid-v1". */ - public static readonly AI21_LABS_JURASSIC_2_MID_V1 = new FoundationModelIdentifier('ai21.j2-mid-v1'); + /** Base model "amazon.titan-tg1-large". */ + public static readonly AMAZON_TITAN_TG1_LARGE = new FoundationModelIdentifier('amazon.titan-tg1-large'); - /** Base model "ai21.j2-ultra-v1". */ - public static readonly AI21_LABS_JURASSIC_2_ULTRA_V1 = new FoundationModelIdentifier('ai21.j2-ultra-v1'); + /** Base model "amazon.titan-text-lite-v1". */ + public static readonly AMAZON_TITAN_TEXT_LITE_V1 = new FoundationModelIdentifier('amazon.titan-text-lite-v1'); - /** Base model "amazon.titan-embed-text-v1". */ - public static readonly AMAZON_TITAN_EMBEDDINGS_G1_TEXT_V1 = new FoundationModelIdentifier('amazon.titan-embed-text-v1'); + /** Base model "amazon.titan-text-lite-v1:0:4k". */ + public static readonly AMAZON_TITAN_TEXT_LITE_V1_0_4K = new FoundationModelIdentifier('amazon.titan-text-lite-v1:0:4k'); + + /** Base model "amazon.titan-text-express-v1:0:8k". */ + public static readonly AMAZON_TITAN_TEXT_EXPRESS_V1_0_8K = new FoundationModelIdentifier('amazon.titan-text-express-v1:0:8k'); /** Base model "amazon.titan-text-express-v1". */ public static readonly AMAZON_TITAN_TEXT_G1_EXPRESS_V1 = new FoundationModelIdentifier('amazon.titan-text-express-v1'); - /** Base model "amazon.titan-embed-image-v1". */ - public static readonly AMAZON_TITAN_MULTIMODAL_EMBEDDINGS_G1_V1 = new FoundationModelIdentifier('amazon.titan-embed-image-v1'); + /** Base model "amazon.titan-embed-text-v1". */ + public static readonly AMAZON_TITAN_EMBEDDINGS_G1_TEXT_V1 = new FoundationModelIdentifier('amazon.titan-embed-text-v1'); + + /** Base model "amazon.titan-embed-text-v1:2:8k". */ + public static readonly AMAZON_TITAN_EMBED_TEXT_V1_2_8K = new FoundationModelIdentifier('amazon.titan-embed-text-v1:2:8k'); + + /** Base model "amazon.titan-embed-g1-text-02". */ + public static readonly AMAZON_TITAN_EMBED_G1_TEXT_02 = new FoundationModelIdentifier('amazon.titan-embed-g1-text-02'); /** Base model "amazon.titan-image-generator-v1". */ public static readonly AMAZON_TITAN_IMAGE_GENERATOR_G1_V1 = new FoundationModelIdentifier('amazon.titan-image-generator-v1'); - /** Base model "anthropic.claude-v1". */ + /** Base model "amazon.titan-image-generator-v1:0". */ + public static readonly AMAZON_TITAN_IMAGE_GENERATOR_V1_0 = new FoundationModelIdentifier('amazon.titan-image-generator-v1:0'); + + /** Base model "amazon.titan-embed-image-v1:0". */ + public static readonly AMAZON_TITAN_EMBED_IMAGE_V1_0 = new FoundationModelIdentifier('amazon.titan-embed-image-v1:0'); + + /** Base model "amazon.titan-embed-image-v1". */ + public static readonly AMAZON_TITAN_MULTIMODAL_EMBEDDINGS_G1_V1 = new FoundationModelIdentifier('amazon.titan-embed-image-v1'); + + /** Base model "ai21.j2-mid". */ + public static readonly AI21_J2_MID = new FoundationModelIdentifier('ai21.j2-mid'); + + /** Base model "ai21.j2-mid-v1". */ + public static readonly AI21_LABS_JURASSIC_2_MID_V1 = new FoundationModelIdentifier('ai21.j2-mid-v1'); + + /** Base model "ai21.j2-ultra". */ + public static readonly AI21_J2_ULTRA = new FoundationModelIdentifier('ai21.j2-ultra'); + + /** Base model "ai21.j2-ultra-v1". */ + public static readonly AI21_LABS_JURASSIC_2_ULTRA_V1 = new FoundationModelIdentifier('ai21.j2-ultra-v1'); + + /** Base model "ai21.j2-grande-instruct". */ + public static readonly AI21_J2_GRANDE_INSTRUCT = new FoundationModelIdentifier('ai21.j2-grande-instruct'); + + /** Base model "ai21.j2-jumbo-instruct". */ + public static readonly AI21_J2_JUMBO_INSTRUCT = new FoundationModelIdentifier('ai21.j2-jumbo-instruct'); + + /** + * Base model "anthropic.claude-v1". + * @deprecated use latest version of the model + **/ public static readonly ANTHROPIC_CLAUDE_V1 = new FoundationModelIdentifier('anthropic.claude-v1'); /** Base model "anthropic.claude-v2". */ public static readonly ANTHROPIC_CLAUDE_V2 = new FoundationModelIdentifier('anthropic.claude-v2'); + /** Base model "anthropic.claude-v2:0:18k". */ + public static readonly ANTHROPIC_CLAUDE_V2_0_18K = new FoundationModelIdentifier('anthropic.claude-v2:0:18k'); + + /** Base model "anthropic.claude-v2:0:100k". */ + public static readonly ANTHROPIC_CLAUDE_V2_0_100K = new FoundationModelIdentifier('anthropic.claude-v2:0:100k'); + /** Base model "anthropic.claude-v2:1". */ public static readonly ANTHROPIC_CLAUDE_V2_1 = new FoundationModelIdentifier('anthropic.claude-v2:1'); + /** Base model "anthropic.claude-v2:1:18k". */ + public static readonly ANTHROPIC_CLAUDE_V2_1_18K = new FoundationModelIdentifier('anthropic.claude-v2:1:18k'); + + /** Base model "anthropic.claude-v2:1:200k". */ + public static readonly ANTHROPIC_CLAUDE_V2_1_200K = new FoundationModelIdentifier('anthropic.claude-v2:1:200k'); + + /** Base model "anthropic.claude-3-sonnet-20240229-v1:0". */ + public static readonly ANTHROPIC_CLAUDE_3_SONNET_20240229_V1_0 = new FoundationModelIdentifier('anthropic.claude-3-sonnet-20240229-v1:0'); + /** Base model "anthropic.claude-instant-v1". */ public static readonly ANTHROPIC_CLAUDE_INSTANT_V1 = new FoundationModelIdentifier('anthropic.claude-instant-v1'); + /** Base model "anthropic.claude-instant-v1:2:100k". */ + public static readonly ANTHROPIC_CLAUDE_INSTANT_V1_2_100K = new FoundationModelIdentifier('anthropic.claude-instant-v1:2:100k'); + /** Base model "cohere.command-text-v14". */ public static readonly COHERE_COMMAND_V14 = new FoundationModelIdentifier('cohere.command-text-v14'); /** Base model "cohere.command-light-text-v14". */ public static readonly COHERE_COMMAND_LIGHT_V14 = new FoundationModelIdentifier('cohere.command-light-text-v14'); + /** Base model "cohere.command-text-v14:7:4k". */ + public static readonly COHERE_COMMAND_TEXT_V14_7_4K = new FoundationModelIdentifier('cohere.command-text-v14:7:4k'); + + /** Base model "cohere.command-light-text-v14:7:4k". */ + public static readonly COHERE_COMMAND_LIGHT_TEXT_V14_7_4K = new FoundationModelIdentifier('cohere.command-light-text-v14:7:4k'); + /** Base model "cohere.embed-english-v3". */ public static readonly COHERE_EMBED_ENGLISH_V3 = new FoundationModelIdentifier('cohere.embed-english-v3'); /** Base model "cohere.embed-multilingual-v3". */ public static readonly COHERE_EMBED_MULTILINGUAL_V3 = new FoundationModelIdentifier('cohere.embed-multilingual-v3'); + /** Base model "meta.llama2-13b-v1". */ + public static readonly META_LLAMA_2_13B_V1 = new FoundationModelIdentifier('meta.llama2-13b-v1'); + + /** Base model "meta.llama2-13b-v1:0:4k". */ + public static readonly META_LLAMA_2_13B_V1_0_4K = new FoundationModelIdentifier('meta.llama2-13b-v1:0:4k'); + + /** Base model "meta.llama2-13b-chat-v1:0:4k". */ + public static readonly META_LLAMA_2_13B_CHAT_V1_0_4K = new FoundationModelIdentifier('meta.llama2-13b-chat-v1:0:4k'); + + /** Base model "meta.llama2-70b-v1". */ + public static readonly META_LLAMA_2_70B_V1 = new FoundationModelIdentifier('meta.llama2-70b-v1'); + + /** Base model "meta.llama2-70b-v1:0:4k". */ + public static readonly META_LLAMA_2_70B_V1_0_4K = new FoundationModelIdentifier('meta.llama2-70b-v1:0:4k'); + /** Base model "meta.llama2-13b-chat-v1". */ public static readonly META_LLAMA_2_CHAT_13B_V1 = new FoundationModelIdentifier('meta.llama2-13b-chat-v1'); /** Base model "meta.llama2-70b-chat-v1". */ public static readonly META_LLAMA_2_CHAT_70B_V1 = new FoundationModelIdentifier('meta.llama2-70b-chat-v1'); - /** Base model "stability.stable-diffusion-xl-v0". */ + /** Base model "meta.llama2-70b-chat-v1:0:4k". */ + public static readonly META_LLAMA_2_70B_CHAT_V1_0_4K = new FoundationModelIdentifier('meta.llama2-70b-chat-v1:0:4k'); + + /** Base model "mistral.mistral-7b-instruct-v0:2". */ + public static readonly MISTRAL_MISTRAL_7B_INSTRUCT_V0_2 = new FoundationModelIdentifier('mistral.mistral-7b-instruct-v0:2'); + + /** Base model "mistral.mixtral-8x7b-instruct-v0:1". */ + public static readonly MISTRAL_MIXTRAL_8X7B_INSTRUCT_V0_1 = new FoundationModelIdentifier('mistral.mixtral-8x7b-instruct-v0:1'); + + /** + * Base model "stability.stable-diffusion-xl". + * @deprecated use latest version of the model + **/ + public static readonly STABILITY_STABLE_DIFFUSION_XL = new FoundationModelIdentifier('stability.stable-diffusion-xl'); + + /** + * Base model "stability.stable-diffusion-xl-v0". + * @deprecated use latest version of the model + */ public static readonly STABILITY_STABLE_DIFFUSION_XL_V0 = new FoundationModelIdentifier('stability.stable-diffusion-xl-v0'); /** Base model "stability.stable-diffusion-xl-v1". */ public static readonly STABILITY_STABLE_DIFFUSION_XL_V1 = new FoundationModelIdentifier('stability.stable-diffusion-xl-v1'); + /** Base model "stability.stable-diffusion-xl-v1:0". */ + public static readonly STABILITY_STABLE_DIFFUSION_XL_V1_0 = new FoundationModelIdentifier('stability.stable-diffusion-xl-v1:0'); + /** * Constructor for foundation model identifier * @param modelId the model identifier