You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2025/01/08 13:10:40 UTC
(camel) 01/01: Camel AWS Bedrock: Fixed Integration Tests
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch aws-bedrock
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 2086b876465b83e62aed7c5477694cc7e89d5f77
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Jan 8 14:09:54 2025 +0100
Camel AWS Bedrock: Fixed Integration Tests
Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
.../aws2/bedrock/runtime/BedrockProducer.java | 4 +--
.../runtime/integration/BedrockProducerIT.java | 34 +++++++++++-----------
2 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/runtime/BedrockProducer.java b/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/runtime/BedrockProducer.java
index 591e29af7cb..99f32f3c10a 100644
--- a/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/runtime/BedrockProducer.java
+++ b/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/runtime/BedrockProducer.java
@@ -65,8 +65,8 @@ public class BedrockProducer extends DefaultProducer {
}
private BedrockOperations determineOperation(Exchange exchange) {
- BedrockOperations operation = exchange.getIn().getHeader(BedrockConstants.OPERATION, BedrockOperations.class);
- if (operation == null) {
+ BedrockOperations operation = exchange.getMessage().getHeader(BedrockConstants.OPERATION, BedrockOperations.class);
+ if (ObjectHelper.isEmpty(operation)) {
operation = getConfiguration().getOperation();
}
return operation;
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 c2bc5520dd4..8a7bc51730a 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
@@ -513,17 +513,17 @@ class BedrockProducerIT extends CamelTestSupport {
@Override
public void configure() {
from("direct:send_titan_express")
- .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}}®ion=eu-central-1&operation=invokeTextModel&modelId="
+ .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}})®ion=eu-central-1&operation=invokeTextModel&modelId="
+ BedrockModels.TITAN_TEXT_EXPRESS_V1.model)
.to(result);
from("direct:send_titan_lite")
- .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}}®ion=us-east-1&operation=invokeTextModel&modelId="
+ .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}})®ion=us-east-1&operation=invokeTextModel&modelId="
+ BedrockModels.TITAN_TEXT_LITE_V1.model)
.to(result);
from("direct:send_titan_image")
- .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}}®ion=us-east-1&operation=invokeImageModel&modelId="
+ .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}})®ion=us-east-1&operation=invokeImageModel&modelId="
+ BedrockModels.TITAN_IMAGE_GENERATOR_V1.model)
.split(body())
.unmarshal().base64()
@@ -531,27 +531,27 @@ class BedrockProducerIT extends CamelTestSupport {
.to(result);
from("direct:send_titan_embeddings")
- .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}}®ion=us-east-1&operation=invokeEmbeddingsModel&modelId="
+ .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_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="
+ .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_titan_text_embeddings_v2")
- .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}}®ion=us-east-1&operation=invokeEmbeddingsModel&modelId="
+ .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_TEXT_EMBEDDINGS_V2.model)
.to(result);
from("direct:send_titan_premier")
- .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}}®ion=us-east-1&operation=invokeTextModel&modelId="
+ .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}})®ion=us-east-1&operation=invokeTextModel&modelId="
+ BedrockModels.TITAN_TEXT_PREMIER_V1.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="
+ .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)
.split(body())
.transform().jq(".data.text")
@@ -559,7 +559,7 @@ class BedrockProducerIT extends CamelTestSupport {
.to(result);
from("direct:send_jurassic2_mid_model")
- .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}}®ion=us-east-1&operation=invokeTextModel&modelId="
+ .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_MID.model)
.split(body())
.transform().jq(".data.text")
@@ -567,49 +567,49 @@ class BedrockProducerIT extends CamelTestSupport {
.to(result);
from("direct:send_anthropic_v1_model")
- .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}}®ion=us-east-1&operation=invokeTextModel&modelId="
+ .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}})®ion=us-east-1&operation=invokeTextModel&modelId="
+ BedrockModels.ANTROPHIC_CLAUDE_INSTANT_V1.model)
.log("${body}")
.to(result);
from("direct:send_anthropic_v2_model")
- .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}}®ion=us-east-1&operation=invokeTextModel&modelId="
+ .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}})®ion=us-east-1&operation=invokeTextModel&modelId="
+ BedrockModels.ANTROPHIC_CLAUDE_V2.model)
.log("${body}")
.to(result);
from("direct:send_anthropic_v21_model")
- .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}}®ion=us-east-1&operation=invokeTextModel&modelId="
+ .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}})®ion=us-east-1&operation=invokeTextModel&modelId="
+ BedrockModels.ANTROPHIC_CLAUDE_V2_1.model)
.log("${body}")
.to(result);
from("direct:send_anthropic_v3_model")
- .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}}®ion=us-east-1&operation=invokeTextModel&modelId="
+ .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}})®ion=us-east-1&operation=invokeTextModel&modelId="
+ BedrockModels.ANTROPHIC_CLAUDE_V3.model)
.log("Completions: ${body}")
.to(result);
from("direct:send_anthropic_v3_haiku_model")
- .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}}®ion=us-east-1&operation=invokeTextModel&modelId="
+ .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}})®ion=us-east-1&operation=invokeTextModel&modelId="
+ BedrockModels.ANTROPHIC_CLAUDE_HAIKU_V3.model)
.log("Completions: ${body}")
.to(result);
from("direct:send_mistral_7b_instruct_model")
- .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}}®ion=us-east-1&operation=invokeTextModel&modelId="
+ .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}})®ion=us-east-1&operation=invokeTextModel&modelId="
+ BedrockModels.MISTRAL_7B_INSTRUCT.model)
.log("Completions: ${body}")
.to(result);
from("direct:send_mistral_8x7b_instruct_model")
- .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}}®ion=us-east-1&operation=invokeTextModel&modelId="
+ .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}})®ion=us-east-1&operation=invokeTextModel&modelId="
+ BedrockModels.MISTRAL_8x7B_INSTRUCT.model)
.log("Completions: ${body}")
.to(result);
from("direct:send_mistral_large_model")
- .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}}®ion=us-east-1&operation=invokeTextModel&modelId="
+ .to("aws-bedrock:label?accessKey=RAW({{aws.manual.access.key}})&secretKey=RAW({{aws.manual.secret.key}})®ion=us-east-1&operation=invokeTextModel&modelId="
+ BedrockModels.MISTRAL_LARGE.model)
.log("Completions: ${body}")
.to(result);