Skip to content

Commit

Permalink
chore(model): add support for titan premier (#435)
Browse files Browse the repository at this point in the history
chore(model): add support for titan premier
  • Loading branch information
krokoko authored May 7, 2024
1 parent 7fce037 commit d26b96d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions apidocs/classes/bedrock.BedrockFoundationModel.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ can instantiate a `BedrockFoundationModel` object, e.g: `new BedrockFoundationMo
- [supportsAgents](bedrock.BedrockFoundationModel.md#supportsagents)
- [supportsKnowledgeBase](bedrock.BedrockFoundationModel.md#supportsknowledgebase)
- [vectorDimensions](bedrock.BedrockFoundationModel.md#vectordimensions)
- [AMAZON\_TITAN\_PREMIER\_V1\_0](bedrock.BedrockFoundationModel.md#amazon_titan_premier_v1_0)
- [AMAZON\_TITAN\_TEXT\_EXPRESS\_V1](bedrock.BedrockFoundationModel.md#amazon_titan_text_express_v1)
- [ANTHROPIC\_CLAUDE\_HAIKU\_V1\_0](bedrock.BedrockFoundationModel.md#anthropic_claude_haiku_v1_0)
- [ANTHROPIC\_CLAUDE\_INSTANT\_V1\_2](bedrock.BedrockFoundationModel.md#anthropic_claude_instant_v1_2)
Expand Down Expand Up @@ -79,6 +80,12 @@ ___

___

### AMAZON\_TITAN\_PREMIER\_V1\_0

`Static` `Readonly` **AMAZON\_TITAN\_PREMIER\_V1\_0**: [`BedrockFoundationModel`](bedrock.BedrockFoundationModel.md)

___

### AMAZON\_TITAN\_TEXT\_EXPRESS\_V1

`Static` `Readonly` **AMAZON\_TITAN\_TEXT\_EXPRESS\_V1**: [`BedrockFoundationModel`](bedrock.BedrockFoundationModel.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,4 @@ def get_prompt(self):
# Register the adapter
registry.register(r"^Bedrock.amazon.titan-t*", BedrockTitanAdapter)
registry.register(r"^Bedrock.amazon.titan-e*", BedrockTitanAdapter)
registry.register(r"^Bedrock.amazon.titan-p*", BedrockTitanAdapter)
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class BedrockModel(StrEnum):
AMAZON_TITAN_EMBED_IMAGE_V1 = 'amazon.titan-embed-image-v1',
AMAZON_TITAN_EMBED_TEXT_V1 = 'amazon.titan-embed-text-v1',
AMAZON_TITAN_IMAGE_GENERATOR_V1 = 'amazon.titan-image-generator-v1',
AMAZON_TITAN_TEXT_PREMIER_V1 = 'amazon.titan-text-premier-v1:0'

MAX_TOKENS_MAP = {
Provider.BEDROCK+'.'+BedrockModel.ANTHROPIC_CLAUDE_V2_1 : 200000,
Expand All @@ -33,6 +34,7 @@ class BedrockModel(StrEnum):
Provider.BEDROCK+'.'+BedrockModel.AMAZON_TITAN_EMBED_TEXT_V1: 8000,
Provider.BEDROCK+'.'+BedrockModel.AMAZON_TITAN_EMBED_IMAGE_V1: 128,
Provider.BEDROCK+'.'+BedrockModel.AMAZON_TITAN_IMAGE_GENERATOR_V1: 77,
Provider.BEDROCK+'.'+BedrockModel.AMAZON_TITAN_TEXT_PREMIER_V1: 32000,
}


Expand Down
6 changes: 5 additions & 1 deletion src/cdk-lib/bedrock/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ export class BedrockFoundationModel {
'anthropic.claude-3-haiku-20240307-v1:0',
{ supportsAgents: true },
);
public static readonly AMAZON_TITAN_PREMIER_V1_0 = new BedrockFoundationModel(
'amazon.titan-text-premier-v1:0',
{ supportsAgents: true },
);

public static readonly TITAN_EMBED_TEXT_V1 = new BedrockFoundationModel(
'amazon.titan-embed-text-v1',
Expand Down Expand Up @@ -98,4 +102,4 @@ export class BedrockFoundationModel {
const region = cdk.Stack.of(construct).region;
return `arn:aws:bedrock:${region}::foundation-model/${this.modelId}`;
}
}
}

0 comments on commit d26b96d

Please sign in to comment.