This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new c2b21559da2 CAMEL-20513 - Camel-AWS-Bedrock: Support Amazon Titan
Multimodal Embeddings G1 Model (#13896)
c2b21559da2 is described below
commit c2b21559da229c457ba673747a41be689d1c6f75
Author: Andrea Cosentino <[email protected]>
AuthorDate: Tue Apr 23 14:09:31 2024 +0200
CAMEL-20513 - Camel-AWS-Bedrock: Support Amazon Titan Multimodal Embeddings
G1 Model (#13896)
Signed-off-by: Andrea Cosentino <[email protected]>
---
.../component/aws2/bedrock/BedrockModels.java | 1 +
.../runtime/integration/BedrockProducerIT.java | 23 ++++++++++++++++++++++
2 files changed, 24 insertions(+)
diff --git
a/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/BedrockModels.java
b/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/BedrockModels.java
index 8ca768b90e7..7b02f216a2e 100644
---
a/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/BedrockModels.java
+++
b/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/BedrockModels.java
@@ -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"),
diff --git
a/components/camel-aws/camel-aws-bedrock/src/test/java/org/apache/camel/component/aws2/bedrock/runtime/integration/BedrockProducerIT.java
b/components/camel-aws/camel-aws-bedrock/src/test/java/org/apache/camel/component/aws2/bedrock/runtime/integration/BedrockProducerIT.java
index 56a7f725ea2..9c5ced46233 100644
---
a/components/camel-aws/camel-aws-bedrock/src/test/java/org/apache/camel/component/aws2/bedrock/runtime/integration/BedrockProducerIT.java
+++
b/components/camel-aws/camel-aws-bedrock/src/test/java/org/apache/camel/component/aws2/bedrock/runtime/integration/BedrockProducerIT.java
@@ -443,6 +443,24 @@ class BedrockProducerIT extends CamelTestSupport {
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() {
@@ -471,6 +489,11 @@ class BedrockProducerIT extends CamelTestSupport {
+ 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}}®ion=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}}®ion=us-east-1&operation=invokeTextModel&modelId="
+ BedrockModels.JURASSIC2_ULTRA.model)