Skip to content

Commit

Permalink
CAMEL-20513 - Camel-AWS-Bedrock: Support Amazon Titan Multimodal Embe…
Browse files Browse the repository at this point in the history
…ddings G1 Model (#13896)

Signed-off-by: Andrea Cosentino <[email protected]>
  • Loading branch information
oscerd authored Apr 23, 2024
1 parent bfd2fd3 commit c2b2155
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public enum BedrockModels {
TITAN_TEXT_LITE_V1("amazon.titan-text-lite-v1"),
TITAN_IMAGE_GENERATOR_V1("amazon.titan-image-generator-v1"),
TITAN_EMBEDDINGS_G1("amazon.titan-embed-text-v1"),
TITAN_MULTIMODAL_EMBEDDINGS_G1("amazon.titan-embed-image-v1"),
JURASSIC2_ULTRA("ai21.j2-ultra-v1"),
JURASSIC2_MID("ai21.j2-mid-v1"),
ANTROPHIC_CLAUDE_INSTANT_V1("anthropic.claude-instant-v1"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,24 @@ public void testInvokeMistralLargeModel() throws InterruptedException {
MockEndpoint.assertIsSatisfied(context);
}

@Test
public void testInvokeTitanMultimodalEmbeddingsModel() throws InterruptedException {

result.expectedMessageCount(1);
final Exchange result = template.send("direct:send_titan_multimodal_embeddings", exchange -> {
ObjectMapper mapper = new ObjectMapper();
ObjectNode rootNode = mapper.createObjectNode();
rootNode.putIfAbsent("inputText",
new TextNode("A Sci-fi camel running in the desert"));

exchange.getMessage().setBody(mapper.writer().writeValueAsString(rootNode));
exchange.getMessage().setHeader(BedrockConstants.MODEL_CONTENT_TYPE, "application/json");
exchange.getMessage().setHeader(BedrockConstants.MODEL_ACCEPT_CONTENT_TYPE, "*/*");
});

MockEndpoint.assertIsSatisfied(context);
}

@Override
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
Expand Down Expand Up @@ -471,6 +489,11 @@ public void configure() {
+ BedrockModels.TITAN_EMBEDDINGS_G1.model)
.to(result);

from("direct:send_titan_multimodal_embeddings")
.to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}}&region=us-east-1&operation=invokeEmbeddingsModel&modelId="
+ BedrockModels.TITAN_MULTIMODAL_EMBEDDINGS_G1.model)
.to(result);

from("direct:send_jurassic2_model")
.to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}}&region=us-east-1&operation=invokeTextModel&modelId="
+ BedrockModels.JURASSIC2_ULTRA.model)
Expand Down

0 comments on commit c2b2155

Please sign in to comment.