diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws-bedrock-agent-runtime.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws-bedrock-agent-runtime.json index ef1b2ae6034c9..3b6d1f8fa0cd4 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws-bedrock-agent-runtime.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws-bedrock-agent-runtime.json @@ -87,6 +87,10 @@ "CamelAwsBedrockAgentRuntimeNextToken": { "index": 24, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Pagination token used by the retrieve operation. Set on the in-message to request the next page; set on the out-message when the response carries one.", "constantName": "org.apache.camel.component.aws2.bedrock.agentruntime.BedrockAgentRuntimeConstants#NEXT_TOKEN" }, "CamelAwsBedrockAgentRuntimeRetrieveGuardrailAction": { "index": 25, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "When performing a retrieve operation, this header will contain the guardrail action (if any) applied by the knowledge base.", "constantName": "org.apache.camel.component.aws2.bedrock.agentruntime.BedrockAgentRuntimeConstants#RETRIEVE_GUARDRAIL_ACTION" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "text", "bytes", "stream", "file" ], "byOption": [ { "option": "operation", "value": "invokeFlow", "carriers": [ "text", "list", "pojo" ] } ], "description": "The question, the query or the input of the agent as text for retrieveAndGenerate, retrieve, invokeAgent and invokeInlineAgent: bytes, a stream or a file are read as text, a Map or a POJO is sent as its toString(), so take the text out of it first, and no body fails. invokeFlow takes a String, which becomes the document of the input node FlowInputNode, or a FlowInput or a List of FlowInput of the AWS SDK: another body fails. With pojoRequest=true the request of the AWS SDK for the operation, such as a RetrieveAndGenerateRequest: another body fails" }, + "producerOut": { "carriers": [ "text", "list" ], "byOption": [ { "option": "operation", "value": "retrieveAndGenerate", "carriers": [ "text" ], "javaType": "java.lang.String" }, { "option": "operation", "value": "retrieve", "carriers": [ "list" ], "javaType": "java.util.List" }, { "option": "operation", "value": "invokeFlow", "carriers": [ "text", "pojo", "unchanged" ] } ], "description": "The answer as text for retrieveAndGenerate, with the citations and the session id in headers, and a List of KnowledgeBaseRetrievalResult for retrieve. invokeAgent and invokeInlineAgent give the answer as text, or a List of the chunks with streamOutputMode=chunks or the CamelAwsBedrockAgentRuntimeAgentStreamOutputMode header; the text is empty when the agent returns control. invokeFlow gives the document of the last output of the flow as text, or as a Document of the AWS SDK for another type, and keeps the body when the flow has no output" } + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agentruntime.BedrockAgentRuntimeConfiguration", "configurationField": "configuration", "description": "Logical name" }, "knowledgeBaseId": { "index": 1, "kind": "parameter", "displayName": "Knowledge Base Id", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agentruntime.BedrockAgentRuntimeConfiguration", "configurationField": "configuration", "description": "Define the Knowledge Base Id we are going to use" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws-bedrock-agent.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws-bedrock-agent.json index 59f861132332b..6480a7ee98636 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws-bedrock-agent.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws-bedrock-agent.json @@ -79,6 +79,11 @@ "CamelAwsBedrockAgentRuntimeNextToken": { "index": 24, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Pagination token used by the retrieve operation. Set on the in-message to request the next page; set on the out-message when the response carries one.", "constantName": "org.apache.camel.component.aws2.bedrock.agentruntime.BedrockAgentRuntimeConstants#NEXT_TOKEN" }, "CamelAwsBedrockAgentRuntimeRetrieveGuardrailAction": { "index": 25, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "When performing a retrieve operation, this header will contain the guardrail action (if any) applied by the knowledge base.", "constantName": "org.apache.camel.component.aws2.bedrock.agentruntime.BedrockAgentRuntimeConstants#RETRIEVE_GUARDRAIL_ACTION" } }, + "bodyTypes": { + "consumerOut": { "carriers": [ "pojo" ], "javaType": "software.amazon.awssdk.services.bedrockagent.model.IngestionJob", "description": "The ingestion job of the knowledgeBaseId, dataSourceId and ingestionJobId options, one message per poll, also when the job did not change, with its status in the CamelAwsBedrockAgentIngestionJobStatus header" }, + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "pojoRequest", "value": "true", "carriers": [ "pojo" ] } ], "description": "Not used: the knowledge base, the data source and the ingestion job come from the options, or from headers such as CamelAwsBedrockAgentKnowledgeBaseId when the option is not set. With pojoRequest=true the request of the AWS SDK for the operation, such as a StartIngestionJobRequest: another body fails" }, + "producerOut": { "carriers": [ "pojo" ], "javaType": "software.amazon.awssdk.services.bedrockagent.model.IngestionJob", "byOption": [ { "option": "operation", "value": "startIngestionJob", "carriers": [ "text" ], "javaType": "java.lang.String" }, { "option": "operation", "value": "listIngestionJobs", "carriers": [ "list" ], "javaType": "java.util.List" } ], "description": "The id of the ingestion job as text for startIngestionJob, a List of IngestionJobSummary for listIngestionJobs, and the IngestionJob for getIngestionJob, with its status in the CamelAwsBedrockAgentIngestionJobStatus header" } + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "description": "Logical name" }, "dataSourceId": { "index": 1, "kind": "parameter", "displayName": "Data Source Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "description": "Define the Data source Id we are going to use" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws-bedrock.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws-bedrock.json index f1447a8d21057..27287f9994c7c 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws-bedrock.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws-bedrock.json @@ -36,7 +36,7 @@ "pojoRequest": { "index": 9, "kind": "property", "displayName": "Pojo Request", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "If we want to use a POJO request as body or not" }, "profileCredentialsName": { "index": 10, "kind": "property", "displayName": "Profile Credentials Name", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "false", "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "If using a profile credentials provider, this parameter will set the profile name" }, "region": { "index": 11, "kind": "property", "displayName": "Region", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "us-east-1", "us-east-2", "us-west-2", "us-gov-west-1", "ap-northeast-1", "ap-northeast-2", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ca-central-1", "eu-central-1", "eu-central-2", "eu-west-1", "eu-west-2", "eu-west-3", "sa-east-1" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "The region in which Bedrock client needs to work. When using this parameter, the configuration will expect the lowercase name of the region (for example, ap-east-1) You'll need to use the name Region.EU_WEST_1.id()" }, - "streamOutputMode": { "index": 12, "kind": "property", "displayName": "Stream Output Mode", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "complete", "chunks" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "complete", "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "The streaming output mode (complete or chunks). In complete mode, the full response is accumulated and returned as a single message. In chunks mode, each chunk is emitted as a separate exchange." }, + "streamOutputMode": { "index": 12, "kind": "property", "displayName": "Stream Output Mode", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "complete", "chunks" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "complete", "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "The streaming output mode (complete or chunks). In complete mode, the full response is accumulated and returned as a single message. In chunks mode, the message body is a List of the chunks." }, "uriEndpointOverride": { "index": 13, "kind": "property", "displayName": "Uri Endpoint Override", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option" }, "useDefaultCredentialsProvider": { "index": 14, "kind": "property", "displayName": "Use Default Credentials Provider", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "Set whether the Bedrock client should expect to load credentials through a default credentials provider or to expect static credentials to be passed in." }, "useProfileCredentialsProvider": { "index": 15, "kind": "property", "displayName": "Use Profile Credentials Provider", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "Set whether the Bedrock client should expect to load credentials through a profile credentials provider." }, @@ -79,6 +79,10 @@ "CamelAwsBedrockGuardrailAssessments": { "index": 21, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "List", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The guardrail assessments from ApplyGuardrail response", "constantName": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConstants#GUARDRAIL_ASSESSMENTS" }, "CamelAwsBedrockGuardrailUsage": { "index": 22, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "GuardrailUsage", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The guardrail usage metrics from ApplyGuardrail response", "constantName": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConstants#GUARDRAIL_USAGE" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "text" ], "byOption": [ { "option": "operation", "value": "converse", "carriers": [ "any" ] }, { "option": "operation", "value": "converseStream", "carriers": [ "any" ] }, { "option": "operation", "value": "applyGuardrail", "carriers": [ "any" ] } ], "description": "The request of the model as JSON text for the invoke operations, which also need the CamelAwsBedrockContentType and CamelAwsBedrockAcceptContentType headers. Bytes, a stream or a file are sent as their toString(): convert them to a String first, and marshal a Map or a POJO to JSON. converse, converseStream and applyGuardrail take their input from headers, such as CamelAwsBedrockConverseMessages. With pojoRequest=true an InvokeModelRequest of the AWS SDK: another body fails" }, + "producerOut": { "carriers": [ "text", "list" ], "byOption": [ { "option": "operation", "value": "invokeTextModel", "carriers": [ "text", "pojo" ] }, { "option": "operation", "value": "invokeImageModel", "carriers": [ "pojo" ] }, { "option": "operation", "value": "invokeEmbeddingsModel", "carriers": [ "pojo" ], "javaType": "software.amazon.awssdk.services.bedrockruntime.model.InvokeModelResponse" }, { "option": "operation", "value": "converse", "carriers": [ "text" ], "javaType": "java.lang.String" }, { "option": "operation", "value": "applyGuardrail", "carriers": [ "text" ], "javaType": "java.lang.String" } ], "description": "The streaming operations and converseStream give the text, or a List of the chunks with streamOutputMode=chunks. invokeTextModel gives the JSON response as text for the Amazon Titan models, and a Jackson JsonNode for the others: the response, or the generated text for Llama, Cohere and Claude 2. invokeImageModel gives a JsonNode array of the images as Base64 text, and invokeEmbeddingsModel the InvokeModelResponse of the AWS SDK. converse gives the answer as text, empty when the model asks for a tool, and applyGuardrail its action as text: NONE or GUARDRAIL_INTERVENED" } + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "Logical name" }, "guardrailIdentifier": { "index": 1, "kind": "parameter", "displayName": "Guardrail Identifier", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "The identifier (ID or ARN) for the guardrail to apply to the model invocation" }, @@ -91,7 +95,7 @@ "pojoRequest": { "index": 8, "kind": "parameter", "displayName": "Pojo Request", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "If we want to use a POJO request as body or not" }, "profileCredentialsName": { "index": 9, "kind": "parameter", "displayName": "Profile Credentials Name", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "false", "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "If using a profile credentials provider, this parameter will set the profile name" }, "region": { "index": 10, "kind": "parameter", "displayName": "Region", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "us-east-1", "us-east-2", "us-west-2", "us-gov-west-1", "ap-northeast-1", "ap-northeast-2", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ca-central-1", "eu-central-1", "eu-central-2", "eu-west-1", "eu-west-2", "eu-west-3", "sa-east-1" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "The region in which Bedrock client needs to work. When using this parameter, the configuration will expect the lowercase name of the region (for example, ap-east-1) You'll need to use the name Region.EU_WEST_1.id()" }, - "streamOutputMode": { "index": 11, "kind": "parameter", "displayName": "Stream Output Mode", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "complete", "chunks" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "complete", "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "The streaming output mode (complete or chunks). In complete mode, the full response is accumulated and returned as a single message. In chunks mode, each chunk is emitted as a separate exchange." }, + "streamOutputMode": { "index": 11, "kind": "parameter", "displayName": "Stream Output Mode", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "complete", "chunks" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "complete", "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "The streaming output mode (complete or chunks). In complete mode, the full response is accumulated and returned as a single message. In chunks mode, the message body is a List of the chunks." }, "uriEndpointOverride": { "index": 12, "kind": "parameter", "displayName": "Uri Endpoint Override", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option" }, "useDefaultCredentialsProvider": { "index": 13, "kind": "parameter", "displayName": "Use Default Credentials Provider", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "Set whether the Bedrock client should expect to load credentials through a default credentials provider or to expect static credentials to be passed in." }, "useProfileCredentialsProvider": { "index": 14, "kind": "parameter", "displayName": "Use Profile Credentials Provider", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "Set whether the Bedrock client should expect to load credentials through a profile credentials provider." }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws-cloudtrail.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws-cloudtrail.json index e609d1650cdef..888fdbc12fe4f 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws-cloudtrail.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws-cloudtrail.json @@ -55,6 +55,9 @@ "CamelAwsCloudTrailEventSource": { "index": 2, "kind": "header", "displayName": "", "group": "consumer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The event Source of the cloud trail event consumed.", "constantName": "org.apache.camel.component.aws.cloudtrail.CloudtrailConstants#EVENT_SOURCE" }, "CamelAwsCloudTrailEventUsername": { "index": 3, "kind": "header", "displayName": "", "group": "consumer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The associated username of the event of the cloud trail event consumed.", "constantName": "org.apache.camel.component.aws.cloudtrail.CloudtrailConstants#USERNAME" } }, + "bodyTypes": { + "consumerOut": { "carriers": [ "bytes" ], "javaType": "byte[]", "format": "json", "description": "The CloudTrail record of the event as JSON in a byte array, one message per event, the newest first within a poll, with the id, the name, the source and the user name of the event in headers: unmarshal it to read its fields" } + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "consumer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.cloudtrail.CloudtrailConfiguration", "configurationField": "configuration", "description": "A label for indexing cloudtrail endpoints" }, "eventSource": { "index": 1, "kind": "parameter", "displayName": "Event Source", "group": "consumer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.cloudtrail.CloudtrailConfiguration", "configurationField": "configuration", "description": "Specify an event source to select events" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-comprehend.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-comprehend.json index 31e1559928141..31d5e8fbb5a90 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-comprehend.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-comprehend.json @@ -58,6 +58,10 @@ "CamelAwsComprehendDetectedSentiment": { "index": 5, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The detected sentiment", "constantName": "org.apache.camel.component.aws2.comprehend.Comprehend2Constants#DETECTED_SENTIMENT" }, "CamelAwsComprehendDetectedSentimentScore": { "index": 6, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "software.amazon.awssdk.services.comprehend.model.SentimentScore", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The detected sentiment scores", "constantName": "org.apache.camel.component.aws2.comprehend.Comprehend2Constants#DETECTED_SENTIMENT_SCORE" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "text", "bytes", "stream", "file" ], "description": "The text to analyze, for every operation: bytes, a stream or a file are read as text, a Map or a POJO is analyzed as its toString(), so take the text out of it first, and no body fails. With pojoRequest=true the request of the AWS SDK for the operation, such as a DetectSentimentRequest: another body fails" }, + "producerOut": { "carriers": [ "list" ], "byOption": [ { "option": "operation", "value": "detectSentiment", "carriers": [ "pojo" ], "javaType": "software.amazon.awssdk.services.comprehend.model.DetectSentimentResponse" }, { "option": "operation", "value": "classifyDocument", "carriers": [ "pojo" ], "javaType": "software.amazon.awssdk.services.comprehend.model.ClassifyDocumentResponse" } ], "description": "A List of what is found: the languages for detectDominantLanguage, the default, with the first one and its score in headers, and the entities, key phrases, syntax tokens, PII entities or toxic labels of the other operations. The DetectSentimentResponse of the AWS SDK for detectSentiment, with the sentiment and its scores in headers, and the ClassifyDocumentResponse for classifyDocument. The text is not kept: store it in a variable to analyze it again" } + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.comprehend.Comprehend2Configuration", "configurationField": "configuration", "description": "Logical name" }, "endpointArn": { "index": 1, "kind": "parameter", "displayName": "Endpoint Arn", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.comprehend.Comprehend2Configuration", "configurationField": "configuration", "description": "The Amazon Resource Name (ARN) of the endpoint to use for document classification. Required for classifyDocument operation." }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-polly.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-polly.json index d2290ba44fc61..d55f0f1558004 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-polly.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-polly.json @@ -78,6 +78,10 @@ "CamelAwsPollyContentType": { "index": 14, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The content type of the audio stream", "constantName": "org.apache.camel.component.aws2.polly.Polly2Constants#CONTENT_TYPE" }, "CamelAwsPollyRequestCharacters": { "index": 15, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Number of characters synthesized", "constantName": "org.apache.camel.component.aws2.polly.Polly2Constants#REQUEST_CHARACTERS" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "operation", "value": "synthesizeSpeech", "carriers": [ "text", "bytes", "stream", "file" ] }, { "option": "operation", "value": "startSpeechSynthesisTask", "carriers": [ "text", "bytes", "stream", "file" ] } ], "description": "The text to speak for synthesizeSpeech, the default, and startSpeechSynthesisTask: plain text, or SSML with textType=ssml. Bytes, a stream or a file are read as text, a Map or a POJO is spoken as its toString(), so take the text out of it first, and no body fails. putLexicon takes the lexicon from the body when neither the lexiconContent option nor the CamelAwsPollyLexiconContent header is set. The other operations do not use the body. With pojoRequest=true the request of the AWS SDK for the operation, such as a SynthesizeSpeechRequest: another body fails" }, + "producerOut": { "carriers": [ "pojo" ], "byOption": [ { "option": "operation", "value": "synthesizeSpeech", "carriers": [ "stream" ] }, { "option": "operation", "value": "describeVoices", "carriers": [ "list" ], "javaType": "java.util.List" }, { "option": "operation", "value": "listLexicons", "carriers": [ "list" ], "javaType": "java.util.List" }, { "option": "operation", "value": "listSpeechSynthesisTasks", "carriers": [ "list" ], "javaType": "java.util.List" } ], "description": "The audio of synthesizeSpeech, the default, as a stream, with its content type and the number of characters in headers: read it once, or write it to a file. A List for describeVoices, listLexicons and listSpeechSynthesisTasks, the SynthesisTask for startSpeechSynthesisTask, with its id in a header, and getSpeechSynthesisTask, the Lexicon for getLexicon, and the response of the AWS SDK for putLexicon and deleteLexicon" } + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.polly.Polly2Configuration", "configurationField": "configuration", "description": "Logical name" }, "engine": { "index": 1, "kind": "parameter", "displayName": "Engine", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "software.amazon.awssdk.services.polly.model.Engine", "enum": [ "standard", "neural", "long-form", "generative", "null" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.polly.Polly2Configuration", "configurationField": "configuration", "description": "The engine to use for synthesis (standard, neural, long-form, generative)" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-rekognition.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-rekognition.json index 9aa551cdd4737..abe23848e21d5 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-rekognition.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-rekognition.json @@ -84,6 +84,10 @@ "CamelAwsRekognitionFaceMatchThreshold": { "index": 33, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Float", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Optional value specifying the minimum confidence in the face match to return", "constantName": "org.apache.camel.component.aws2.rekognition.Rekognition2Constants#FACE_MATCH_THRESHOLD" }, "CamelAwsRekognitionMaxUsers": { "index": 34, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Maximum number of users to return in the response", "constantName": "org.apache.camel.component.aws2.rekognition.Rekognition2Constants#MAX_USERS" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "pojoRequest", "value": "true", "carriers": [ "pojo" ] } ], "description": "Not used, not even for the picture: the image comes from the CamelAwsRekognitionImage header, and for compareFaces from the CamelAwsRekognitionSourceImage and CamelAwsRekognitionTargetImage headers, as an Image of the AWS SDK with the bytes or the S3 object of a JPEG or PNG; bytes in these headers are not used. The other inputs come from headers too, such as CamelAwsRekognitionCollectionId. With pojoRequest=true the request of the AWS SDK for the operation, such as a DetectLabelsRequest: another body fails" }, + "producerOut": { "carriers": [ "pojo" ], "description": "The response of the AWS SDK for the operation, such as the DetectLabelsResponse of detectLabels, whose labels hold the names and the confidence of what the image shows" } + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.rekognition.Rekognition2Configuration", "configurationField": "configuration", "description": "Logical name" }, "operation": { "index": 1, "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "", "required": true, "type": "enum", "javaType": "org.apache.camel.component.aws2.rekognition.Rekognition2Operations", "enum": [ "associateFaces", "compareFaces", "createCollection", "createUser", "deleteCollection", "deleteFaces", "deleteUser", "describeCollection", "detectFaces", "detectLabels", "detectModerationLabels", "detectProtectiveEquipment", "detectText", "disassociateFaces", "getCelebrityInfo", "getMediaAnalysisJob", "indexFaces", "listCollections", "listMediaAnalysisJobs", "listFaces", "listUsers", "recognizeCelebrities", "searchFaces", "searchFacesByImage", "searchUsers", "searchUsersByImage", "startMediaAnalysisJob" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.rekognition.Rekognition2Configuration", "configurationField": "configuration", "description": "The operation to perform. It can be listFunctions, getFunction, createFunction, deleteFunction or invokeFunction" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-textract.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-textract.json index c3ac336ad3f2a..fe849e7685863 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-textract.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-textract.json @@ -60,6 +60,10 @@ "CamelAwsTextractNextToken": { "index": 6, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The next token for pagination in operations that return multiple pages", "constantName": "org.apache.camel.component.aws2.textract.Textract2Constants#NEXT_TOKEN" }, "CamelAwsTextractFeatureTypes": { "index": 7, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "List", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The feature types for document analysis (TABLES, FORMS, SIGNATURES, etc.)", "constantName": "org.apache.camel.component.aws2.textract.Textract2Constants#FEATURE_TYPES" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "pojoRequest", "value": "true", "carriers": [ "pojo" ] } ], "description": "The document of detectDocumentText, the default, analyzeDocument and analyzeExpense when no S3 object is named: an image or a PDF as bytes, a stream or a file; a Map, a List, a POJO or no body fails. The s3Bucket and s3Object options, or else the CamelAwsTextractS3Bucket and CamelAwsTextractS3Object headers, name an S3 object instead, and the start operations read only that. The get operations take the job id from the CamelAwsTextractJobId header, or else the body as text. With pojoRequest=true the request of the AWS SDK for the operation, such as a DetectDocumentTextRequest: another body fails" }, + "producerOut": { "carriers": [ "pojo" ], "description": "The response of the AWS SDK for the operation, such as the DetectDocumentTextResponse of detectDocumentText, the default, whose blocks hold the lines and the words found. The start operations give the job id only in the response: set the CamelAwsTextractJobId header from it for the get operations" } + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.textract.Textract2Configuration", "configurationField": "configuration", "description": "Logical name" }, "operation": { "index": 1, "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "", "required": true, "type": "enum", "javaType": "org.apache.camel.component.aws2.textract.Textract2Operations", "enum": [ "detectDocumentText", "analyzeDocument", "analyzeExpense", "startDocumentTextDetection", "startDocumentAnalysis", "startExpenseAnalysis", "getDocumentTextDetection", "getDocumentAnalysis", "getExpenseAnalysis" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": "detectDocumentText", "configurationClass": "org.apache.camel.component.aws2.textract.Textract2Configuration", "configurationField": "configuration", "description": "The operation to perform" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-timestream.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-timestream.json index 37ecd9c677a55..16e38dcedf63a 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-timestream.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-timestream.json @@ -88,6 +88,10 @@ "CamelAwsTimestreamClientToken": { "index": 36, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Using a ClientToken makes the call to CreateScheduledQuery idempotent", "constantName": "org.apache.camel.component.aws2.timestream.Timestream2Constants#CLIENT_TOKEN" }, "CamelAwsTimestreamKmsKeyId": { "index": 37, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Amazon KMS key used to encrypt the scheduled query resource, at-rest.", "constantName": "org.apache.camel.component.aws2.timestream.Timestream2Constants#KMS_KEY_ID" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "pojoRequest", "value": "true", "carriers": [ "pojo" ] } ], "description": "Not used: the operations of both client types take their input from headers, such as the records of writeRecords in CamelAwsTimestreamRecordList, a List of the Record of the AWS SDK, and the SQL of query in CamelAwsTimestreamQueryString. With pojoRequest=true the request of the AWS SDK for the operation, such as a WriteRecordsRequest or a QueryRequest: another body fails" }, + "producerOut": { "carriers": [ "pojo" ], "description": "The response of the AWS SDK for the operation, such as the WriteRecordsResponse of writeRecords, or the QueryResponse of query with one page of rows: the next page needs a QueryRequest with its nextToken and pojoRequest=true" } + }, "properties": { "clientType": { "index": 0, "kind": "path", "displayName": "Client Type", "group": "producer", "label": "", "required": true, "type": "enum", "javaType": "org.apache.camel.component.aws2.timestream.Timestream2ClientType", "enum": [ "write", "query" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.timestream.Timestream2Configuration", "configurationField": "configuration", "description": "Type of client - write\/query" }, "label": { "index": 1, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.timestream.Timestream2Configuration", "configurationField": "configuration", "description": "Logical name" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-transcribe.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-transcribe.json index b7ef6e8f485e3..5e4991853e349 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-transcribe.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-transcribe.json @@ -73,6 +73,10 @@ "CamelAwsTranscribeSpecialty": { "index": 21, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The medical specialty of a medical transcription job", "constantName": "org.apache.camel.component.aws2.transcribe.Transcribe2Constants#SPECIALTY" }, "CamelAwsTranscribeType": { "index": 22, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The audio type of a medical transcription job", "constantName": "org.apache.camel.component.aws2.transcribe.Transcribe2Constants#TYPE" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "pojoRequest", "value": "true", "carriers": [ "pojo" ] } ], "description": "Not used: AWS reads the audio from S3, at the URI in the CamelAwsTranscribeMediaUri header, and the other inputs come from headers too, such as the job name in CamelAwsTranscribeTranscriptionJobName. With pojoRequest=true the request of the AWS SDK for the operation, such as a StartTranscriptionJobRequest: another body fails" }, + "producerOut": { "carriers": [ "pojo" ], "byOption": [ { "option": "operation", "value": "deleteTranscriptionJob", "carriers": [ "unchanged" ] }, { "option": "operation", "value": "deleteVocabulary", "carriers": [ "unchanged" ] } ], "description": "The response of the AWS SDK for the operation, such as the StartTranscriptionJobResponse of startTranscriptionJob. The transcript is not in the body: the job writes it to S3, at the URI that getTranscriptionJob gives. deleteTranscriptionJob and deleteVocabulary keep the body" } + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.transcribe.Transcribe2Configuration", "configurationField": "configuration", "description": "Logical name" }, "operation": { "index": 1, "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "producer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.aws2.transcribe.Transcribe2Operations", "enum": [ "startTranscriptionJob", "getTranscriptionJob", "listTranscriptionJobs", "deleteTranscriptionJob", "createVocabulary", "getVocabulary", "listVocabularies", "updateVocabulary", "deleteVocabulary", "createVocabularyFilter", "getVocabularyFilter", "listVocabularyFilters", "updateVocabularyFilter", "deleteVocabularyFilter", "createLanguageModel", "describeLanguageModel", "listLanguageModels", "deleteLanguageModel", "createMedicalVocabulary", "getMedicalVocabulary", "listMedicalVocabularies", "updateMedicalVocabulary", "deleteMedicalVocabulary", "startMedicalTranscriptionJob", "getMedicalTranscriptionJob", "listMedicalTranscriptionJobs", "deleteMedicalTranscriptionJob", "tagResource", "untagResource", "listTagsForResource" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.transcribe.Transcribe2Configuration", "configurationField": "configuration", "description": "The operation to perform" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-translate.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-translate.json index 88dadd2d7a35c..03466169d6783 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-translate.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-translate.json @@ -56,6 +56,10 @@ "CamelAwsTranslateTerminologyNames": { "index": 2, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Collection", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The terminologies to use", "constantName": "org.apache.camel.component.aws2.translate.Translate2Constants#TERMINOLOGY_NAMES" }, "CamelAwsTranslateOperation": { "index": 3, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The operation we want to perform", "constantName": "org.apache.camel.component.aws2.translate.Translate2Constants#OPERATION" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "text", "bytes", "stream", "file" ], "description": "The text to translate: bytes, a stream or a file are read as text, a Map or a POJO is translated as its toString(), so take the text out of it first, and no body fails. With pojoRequest=true the body is a TranslateTextRequest of the AWS SDK: another body fails" }, + "producerOut": { "carriers": [ "text" ], "javaType": "java.lang.String", "description": "The translated text. The source language that AWS detects with autodetectSourceLanguage=true is not kept" } + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.translate.Translate2Configuration", "configurationField": "configuration", "description": "Logical name" }, "autodetectSourceLanguage": { "index": 1, "kind": "parameter", "displayName": "Autodetect Source Language", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.translate.Translate2Configuration", "configurationField": "configuration", "description": "Being able to autodetect the source language" }, diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws-bedrock-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws-bedrock-component.adoc index 14af8e96e6c56..d193f3bea8cbe 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws-bedrock-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws-bedrock-component.adoc @@ -99,7 +99,7 @@ Two streaming modes are supported: *Complete Mode (default)*: Accumulates all chunks and returns the complete response as a single message. This is the simplest mode and behaves similarly to non-streaming operations, but with lower time-to-first-token. -*Chunks Mode*: Emits each chunk as it arrives in a List. Useful for reactive streaming pipelines or when you need to process chunks individually. +*Chunks Mode*: Returns the chunks as a List in a single message, once the model has finished. Useful when you need to process chunks individually, for example with a split. ==== Streaming Configuration Options diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-comprehend-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-comprehend-component.adoc index 15f9d183c8d77..0b206bf21df6f 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-comprehend-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-comprehend-component.adoc @@ -641,10 +641,13 @@ Analyze customer feedback for sentiment and key topics: ---- from("kafka:customer-feedback") .log("Processing feedback: ${body}") + // Keep the text, as each operation replaces the body with its result + .setVariable("feedback", body()) // Analyze sentiment .to("aws2-comprehend://test?operation=detectSentiment&languageCode=en&useDefaultCredentialsProvider=true®ion=us-east-1") .setHeader("sentiment", simple("${header.CamelAwsComprehendDetectedSentiment}")) - // Extract key phrases + // Restore the text and extract key phrases + .setBody(variable("feedback")) .to("aws2-comprehend://test?operation=detectKeyPhrases&languageCode=en&useDefaultCredentialsProvider=true®ion=us-east-1") .setHeader("keyPhrases", body()) .log("Sentiment: ${header.sentiment}, Key topics: ${header.keyPhrases}") diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-timestream-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-timestream-component.adoc index 37a71156ad224..840a2f052a09c 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-timestream-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-timestream-component.adoc @@ -226,8 +226,8 @@ YAML:: === Using a POJO as body Sometimes building an AWS Request can be complex because of multiple options. We introduce the possibility to use a POJO as the body. -In AWS Timestream there are multiple operations you can submit, as an example for Create state machine - request, you can do something like: +In AWS Timestream there are multiple operations you can submit, as an example for a create database +request, you can do something like: * Write Operation ** createDatabase: this operation will create a timestream database @@ -236,7 +236,7 @@ In AWS Timestream there are multiple operations you can submit, as an example fo [source,java] ---- from("direct:start") - .setBody(CreateDatabaseRequest.builder().database(Database.builder().databaseName("testDb").kmsKeyId("testKmsKey").build()).build()) + .setBody(CreateDatabaseRequest.builder().databaseName("testDb").kmsKeyId("testKmsKey").build()) .to("aws2-timestream://write:test?awsTimestreamWriteClient=#awsTimestreamWriteClient&operation=createDatabase&pojoRequest=true") ---- diff --git a/components/camel-aws/camel-aws-bedrock/src/generated/resources/META-INF/org/apache/camel/component/aws2/bedrock/agent/aws-bedrock-agent.json b/components/camel-aws/camel-aws-bedrock/src/generated/resources/META-INF/org/apache/camel/component/aws2/bedrock/agent/aws-bedrock-agent.json index 59f861132332b..6480a7ee98636 100644 --- a/components/camel-aws/camel-aws-bedrock/src/generated/resources/META-INF/org/apache/camel/component/aws2/bedrock/agent/aws-bedrock-agent.json +++ b/components/camel-aws/camel-aws-bedrock/src/generated/resources/META-INF/org/apache/camel/component/aws2/bedrock/agent/aws-bedrock-agent.json @@ -79,6 +79,11 @@ "CamelAwsBedrockAgentRuntimeNextToken": { "index": 24, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Pagination token used by the retrieve operation. Set on the in-message to request the next page; set on the out-message when the response carries one.", "constantName": "org.apache.camel.component.aws2.bedrock.agentruntime.BedrockAgentRuntimeConstants#NEXT_TOKEN" }, "CamelAwsBedrockAgentRuntimeRetrieveGuardrailAction": { "index": 25, "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "When performing a retrieve operation, this header will contain the guardrail action (if any) applied by the knowledge base.", "constantName": "org.apache.camel.component.aws2.bedrock.agentruntime.BedrockAgentRuntimeConstants#RETRIEVE_GUARDRAIL_ACTION" } }, + "bodyTypes": { + "consumerOut": { "carriers": [ "pojo" ], "javaType": "software.amazon.awssdk.services.bedrockagent.model.IngestionJob", "description": "The ingestion job of the knowledgeBaseId, dataSourceId and ingestionJobId options, one message per poll, also when the job did not change, with its status in the CamelAwsBedrockAgentIngestionJobStatus header" }, + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "pojoRequest", "value": "true", "carriers": [ "pojo" ] } ], "description": "Not used: the knowledge base, the data source and the ingestion job come from the options, or from headers such as CamelAwsBedrockAgentKnowledgeBaseId when the option is not set. With pojoRequest=true the request of the AWS SDK for the operation, such as a StartIngestionJobRequest: another body fails" }, + "producerOut": { "carriers": [ "pojo" ], "javaType": "software.amazon.awssdk.services.bedrockagent.model.IngestionJob", "byOption": [ { "option": "operation", "value": "startIngestionJob", "carriers": [ "text" ], "javaType": "java.lang.String" }, { "option": "operation", "value": "listIngestionJobs", "carriers": [ "list" ], "javaType": "java.util.List" } ], "description": "The id of the ingestion job as text for startIngestionJob, a List of IngestionJobSummary for listIngestionJobs, and the IngestionJob for getIngestionJob, with its status in the CamelAwsBedrockAgentIngestionJobStatus header" } + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "description": "Logical name" }, "dataSourceId": { "index": 1, "kind": "parameter", "displayName": "Data Source Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agent.BedrockAgentConfiguration", "configurationField": "configuration", "description": "Define the Data source Id we are going to use" }, diff --git a/components/camel-aws/camel-aws-bedrock/src/generated/resources/META-INF/org/apache/camel/component/aws2/bedrock/agentruntime/aws-bedrock-agent-runtime.json b/components/camel-aws/camel-aws-bedrock/src/generated/resources/META-INF/org/apache/camel/component/aws2/bedrock/agentruntime/aws-bedrock-agent-runtime.json index ef1b2ae6034c9..3b6d1f8fa0cd4 100644 --- a/components/camel-aws/camel-aws-bedrock/src/generated/resources/META-INF/org/apache/camel/component/aws2/bedrock/agentruntime/aws-bedrock-agent-runtime.json +++ b/components/camel-aws/camel-aws-bedrock/src/generated/resources/META-INF/org/apache/camel/component/aws2/bedrock/agentruntime/aws-bedrock-agent-runtime.json @@ -87,6 +87,10 @@ "CamelAwsBedrockAgentRuntimeNextToken": { "index": 24, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Pagination token used by the retrieve operation. Set on the in-message to request the next page; set on the out-message when the response carries one.", "constantName": "org.apache.camel.component.aws2.bedrock.agentruntime.BedrockAgentRuntimeConstants#NEXT_TOKEN" }, "CamelAwsBedrockAgentRuntimeRetrieveGuardrailAction": { "index": 25, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "When performing a retrieve operation, this header will contain the guardrail action (if any) applied by the knowledge base.", "constantName": "org.apache.camel.component.aws2.bedrock.agentruntime.BedrockAgentRuntimeConstants#RETRIEVE_GUARDRAIL_ACTION" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "text", "bytes", "stream", "file" ], "byOption": [ { "option": "operation", "value": "invokeFlow", "carriers": [ "text", "list", "pojo" ] } ], "description": "The question, the query or the input of the agent as text for retrieveAndGenerate, retrieve, invokeAgent and invokeInlineAgent: bytes, a stream or a file are read as text, a Map or a POJO is sent as its toString(), so take the text out of it first, and no body fails. invokeFlow takes a String, which becomes the document of the input node FlowInputNode, or a FlowInput or a List of FlowInput of the AWS SDK: another body fails. With pojoRequest=true the request of the AWS SDK for the operation, such as a RetrieveAndGenerateRequest: another body fails" }, + "producerOut": { "carriers": [ "text", "list" ], "byOption": [ { "option": "operation", "value": "retrieveAndGenerate", "carriers": [ "text" ], "javaType": "java.lang.String" }, { "option": "operation", "value": "retrieve", "carriers": [ "list" ], "javaType": "java.util.List" }, { "option": "operation", "value": "invokeFlow", "carriers": [ "text", "pojo", "unchanged" ] } ], "description": "The answer as text for retrieveAndGenerate, with the citations and the session id in headers, and a List of KnowledgeBaseRetrievalResult for retrieve. invokeAgent and invokeInlineAgent give the answer as text, or a List of the chunks with streamOutputMode=chunks or the CamelAwsBedrockAgentRuntimeAgentStreamOutputMode header; the text is empty when the agent returns control. invokeFlow gives the document of the last output of the flow as text, or as a Document of the AWS SDK for another type, and keeps the body when the flow has no output" } + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agentruntime.BedrockAgentRuntimeConfiguration", "configurationField": "configuration", "description": "Logical name" }, "knowledgeBaseId": { "index": 1, "kind": "parameter", "displayName": "Knowledge Base Id", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.agentruntime.BedrockAgentRuntimeConfiguration", "configurationField": "configuration", "description": "Define the Knowledge Base Id we are going to use" }, diff --git a/components/camel-aws/camel-aws-bedrock/src/generated/resources/META-INF/org/apache/camel/component/aws2/bedrock/runtime/aws-bedrock.json b/components/camel-aws/camel-aws-bedrock/src/generated/resources/META-INF/org/apache/camel/component/aws2/bedrock/runtime/aws-bedrock.json index f1447a8d21057..27287f9994c7c 100644 --- a/components/camel-aws/camel-aws-bedrock/src/generated/resources/META-INF/org/apache/camel/component/aws2/bedrock/runtime/aws-bedrock.json +++ b/components/camel-aws/camel-aws-bedrock/src/generated/resources/META-INF/org/apache/camel/component/aws2/bedrock/runtime/aws-bedrock.json @@ -36,7 +36,7 @@ "pojoRequest": { "index": 9, "kind": "property", "displayName": "Pojo Request", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "If we want to use a POJO request as body or not" }, "profileCredentialsName": { "index": 10, "kind": "property", "displayName": "Profile Credentials Name", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "false", "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "If using a profile credentials provider, this parameter will set the profile name" }, "region": { "index": 11, "kind": "property", "displayName": "Region", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "us-east-1", "us-east-2", "us-west-2", "us-gov-west-1", "ap-northeast-1", "ap-northeast-2", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ca-central-1", "eu-central-1", "eu-central-2", "eu-west-1", "eu-west-2", "eu-west-3", "sa-east-1" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "The region in which Bedrock client needs to work. When using this parameter, the configuration will expect the lowercase name of the region (for example, ap-east-1) You'll need to use the name Region.EU_WEST_1.id()" }, - "streamOutputMode": { "index": 12, "kind": "property", "displayName": "Stream Output Mode", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "complete", "chunks" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "complete", "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "The streaming output mode (complete or chunks). In complete mode, the full response is accumulated and returned as a single message. In chunks mode, each chunk is emitted as a separate exchange." }, + "streamOutputMode": { "index": 12, "kind": "property", "displayName": "Stream Output Mode", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "complete", "chunks" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "complete", "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "The streaming output mode (complete or chunks). In complete mode, the full response is accumulated and returned as a single message. In chunks mode, the message body is a List of the chunks." }, "uriEndpointOverride": { "index": 13, "kind": "property", "displayName": "Uri Endpoint Override", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option" }, "useDefaultCredentialsProvider": { "index": 14, "kind": "property", "displayName": "Use Default Credentials Provider", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "Set whether the Bedrock client should expect to load credentials through a default credentials provider or to expect static credentials to be passed in." }, "useProfileCredentialsProvider": { "index": 15, "kind": "property", "displayName": "Use Profile Credentials Provider", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "Set whether the Bedrock client should expect to load credentials through a profile credentials provider." }, @@ -79,6 +79,10 @@ "CamelAwsBedrockGuardrailAssessments": { "index": 21, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "List", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The guardrail assessments from ApplyGuardrail response", "constantName": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConstants#GUARDRAIL_ASSESSMENTS" }, "CamelAwsBedrockGuardrailUsage": { "index": 22, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "GuardrailUsage", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The guardrail usage metrics from ApplyGuardrail response", "constantName": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConstants#GUARDRAIL_USAGE" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "text" ], "byOption": [ { "option": "operation", "value": "converse", "carriers": [ "any" ] }, { "option": "operation", "value": "converseStream", "carriers": [ "any" ] }, { "option": "operation", "value": "applyGuardrail", "carriers": [ "any" ] } ], "description": "The request of the model as JSON text for the invoke operations, which also need the CamelAwsBedrockContentType and CamelAwsBedrockAcceptContentType headers. Bytes, a stream or a file are sent as their toString(): convert them to a String first, and marshal a Map or a POJO to JSON. converse, converseStream and applyGuardrail take their input from headers, such as CamelAwsBedrockConverseMessages. With pojoRequest=true an InvokeModelRequest of the AWS SDK: another body fails" }, + "producerOut": { "carriers": [ "text", "list" ], "byOption": [ { "option": "operation", "value": "invokeTextModel", "carriers": [ "text", "pojo" ] }, { "option": "operation", "value": "invokeImageModel", "carriers": [ "pojo" ] }, { "option": "operation", "value": "invokeEmbeddingsModel", "carriers": [ "pojo" ], "javaType": "software.amazon.awssdk.services.bedrockruntime.model.InvokeModelResponse" }, { "option": "operation", "value": "converse", "carriers": [ "text" ], "javaType": "java.lang.String" }, { "option": "operation", "value": "applyGuardrail", "carriers": [ "text" ], "javaType": "java.lang.String" } ], "description": "The streaming operations and converseStream give the text, or a List of the chunks with streamOutputMode=chunks. invokeTextModel gives the JSON response as text for the Amazon Titan models, and a Jackson JsonNode for the others: the response, or the generated text for Llama, Cohere and Claude 2. invokeImageModel gives a JsonNode array of the images as Base64 text, and invokeEmbeddingsModel the InvokeModelResponse of the AWS SDK. converse gives the answer as text, empty when the model asks for a tool, and applyGuardrail its action as text: NONE or GUARDRAIL_INTERVENED" } + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "Logical name" }, "guardrailIdentifier": { "index": 1, "kind": "parameter", "displayName": "Guardrail Identifier", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "The identifier (ID or ARN) for the guardrail to apply to the model invocation" }, @@ -91,7 +95,7 @@ "pojoRequest": { "index": 8, "kind": "parameter", "displayName": "Pojo Request", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "If we want to use a POJO request as body or not" }, "profileCredentialsName": { "index": 9, "kind": "parameter", "displayName": "Profile Credentials Name", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "false", "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "If using a profile credentials provider, this parameter will set the profile name" }, "region": { "index": 10, "kind": "parameter", "displayName": "Region", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "us-east-1", "us-east-2", "us-west-2", "us-gov-west-1", "ap-northeast-1", "ap-northeast-2", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ca-central-1", "eu-central-1", "eu-central-2", "eu-west-1", "eu-west-2", "eu-west-3", "sa-east-1" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "The region in which Bedrock client needs to work. When using this parameter, the configuration will expect the lowercase name of the region (for example, ap-east-1) You'll need to use the name Region.EU_WEST_1.id()" }, - "streamOutputMode": { "index": 11, "kind": "parameter", "displayName": "Stream Output Mode", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "complete", "chunks" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "complete", "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "The streaming output mode (complete or chunks). In complete mode, the full response is accumulated and returned as a single message. In chunks mode, each chunk is emitted as a separate exchange." }, + "streamOutputMode": { "index": 11, "kind": "parameter", "displayName": "Stream Output Mode", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "complete", "chunks" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "complete", "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "The streaming output mode (complete or chunks). In complete mode, the full response is accumulated and returned as a single message. In chunks mode, the message body is a List of the chunks." }, "uriEndpointOverride": { "index": 12, "kind": "parameter", "displayName": "Uri Endpoint Override", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option" }, "useDefaultCredentialsProvider": { "index": 13, "kind": "parameter", "displayName": "Use Default Credentials Provider", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "Set whether the Bedrock client should expect to load credentials through a default credentials provider or to expect static credentials to be passed in." }, "useProfileCredentialsProvider": { "index": 14, "kind": "parameter", "displayName": "Use Profile Credentials Provider", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.bedrock.runtime.BedrockConfiguration", "configurationField": "configuration", "description": "Set whether the Bedrock client should expect to load credentials through a profile credentials provider." }, diff --git a/components/camel-aws/camel-aws-bedrock/src/main/docs/aws-bedrock-component.adoc b/components/camel-aws/camel-aws-bedrock/src/main/docs/aws-bedrock-component.adoc index 14af8e96e6c56..d193f3bea8cbe 100644 --- a/components/camel-aws/camel-aws-bedrock/src/main/docs/aws-bedrock-component.adoc +++ b/components/camel-aws/camel-aws-bedrock/src/main/docs/aws-bedrock-component.adoc @@ -99,7 +99,7 @@ Two streaming modes are supported: *Complete Mode (default)*: Accumulates all chunks and returns the complete response as a single message. This is the simplest mode and behaves similarly to non-streaming operations, but with lower time-to-first-token. -*Chunks Mode*: Emits each chunk as it arrives in a List. Useful for reactive streaming pipelines or when you need to process chunks individually. +*Chunks Mode*: Returns the chunks as a List in a single message, once the model has finished. Useful when you need to process chunks individually, for example with a split. ==== Streaming Configuration Options diff --git a/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/agent/BedrockAgentEndpoint.java b/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/agent/BedrockAgentEndpoint.java index b4a95b266c99e..cb7167234eba5 100644 --- a/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/agent/BedrockAgentEndpoint.java +++ b/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/agent/BedrockAgentEndpoint.java @@ -23,6 +23,9 @@ import org.apache.camel.Producer; import org.apache.camel.component.aws2.bedrock.agent.client.BedrockAgentClientFactory; import org.apache.camel.component.aws2.bedrock.agentruntime.BedrockAgentRuntimeConstants; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -36,6 +39,31 @@ @UriEndpoint(firstVersion = "4.5.0", scheme = "aws-bedrock-agent", title = "AWS Bedrock Agent", syntax = "aws-bedrock-agent:label", category = { Category.AI, Category.CLOUD }, headersClass = BedrockAgentRuntimeConstants.class) +@BodyTypes(consumerOut = @BodyType(value = Carrier.POJO, + javaType = "software.amazon.awssdk.services.bedrockagent.model.IngestionJob", + description = "The ingestion job of the knowledgeBaseId, dataSourceId and ingestionJobId" + + " options, one message per poll, also when the job did not change, with its" + + " status in the CamelAwsBedrockAgentIngestionJobStatus header"), + producerIn = @BodyType(value = Carrier.ANY, + byOption = @BodyType.When(option = "pojoRequest", value = "true", carriers = Carrier.POJO), + description = "Not used: the knowledge base, the data source and the ingestion job come from" + + " the options, or from headers such as CamelAwsBedrockAgentKnowledgeBaseId" + + " when the option is not set. With pojoRequest=true the request of the AWS" + + " SDK for the operation, such as a StartIngestionJobRequest: another body" + + " fails"), + producerOut = @BodyType(value = Carrier.POJO, + javaType = "software.amazon.awssdk.services.bedrockagent.model.IngestionJob", + byOption = { + @BodyType.When(option = "operation", value = "startIngestionJob", + carriers = Carrier.TEXT, + javaType = "java.lang.String"), + @BodyType.When(option = "operation", value = "listIngestionJobs", + carriers = Carrier.LIST, + javaType = "java.util.List") }, + description = "The id of the ingestion job as text for startIngestionJob, a List of" + + " IngestionJobSummary for listIngestionJobs, and the IngestionJob for" + + " getIngestionJob, with its status in the" + + " CamelAwsBedrockAgentIngestionJobStatus header")) public class BedrockAgentEndpoint extends ScheduledPollEndpoint implements EndpointServiceLocation { private BedrockAgentClient bedrockAgentClient; diff --git a/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/agentruntime/BedrockAgentRuntimeEndpoint.java b/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/agentruntime/BedrockAgentRuntimeEndpoint.java index 763710ecb770b..e9c18b44be5c0 100644 --- a/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/agentruntime/BedrockAgentRuntimeEndpoint.java +++ b/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/agentruntime/BedrockAgentRuntimeEndpoint.java @@ -21,6 +21,9 @@ import org.apache.camel.*; import org.apache.camel.component.aws2.bedrock.agentruntime.client.BedrockAgentRuntimeClientFactory; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -35,6 +38,34 @@ @UriEndpoint(firstVersion = "4.5.0", scheme = "aws-bedrock-agent-runtime", title = "AWS Bedrock Agent Runtime", syntax = "aws-bedrock-agent-runtime:label", producerOnly = true, category = { Category.AI, Category.CLOUD }, headersClass = BedrockAgentRuntimeConstants.class) +@BodyTypes(producerIn = @BodyType(value = { Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, Carrier.FILE }, + byOption = @BodyType.When(option = "operation", value = "invokeFlow", + carriers = { Carrier.TEXT, Carrier.LIST, Carrier.POJO }), + description = "The question, the query or the input of the agent as text for" + + " retrieveAndGenerate, retrieve, invokeAgent and invokeInlineAgent: bytes, a" + + " stream or a file are read as text, a Map or a POJO is sent as its" + + " toString(), so take the text out of it first, and no body fails. invokeFlow" + + " takes a String, which becomes the document of the input node FlowInputNode," + + " or a FlowInput or a List of FlowInput of the AWS SDK: another body fails." + + " With pojoRequest=true the request of the AWS SDK for the operation, such as" + + " a RetrieveAndGenerateRequest: another body fails"), + producerOut = @BodyType(value = { Carrier.TEXT, Carrier.LIST }, + byOption = { + @BodyType.When(option = "operation", value = "retrieveAndGenerate", + carriers = Carrier.TEXT, + javaType = "java.lang.String"), + @BodyType.When(option = "operation", value = "retrieve", carriers = Carrier.LIST, + javaType = "java.util.List"), + @BodyType.When(option = "operation", value = "invokeFlow", + carriers = { Carrier.TEXT, Carrier.POJO, Carrier.UNCHANGED }) }, + description = "The answer as text for retrieveAndGenerate, with the citations and the" + + " session id in headers, and a List of KnowledgeBaseRetrievalResult for" + + " retrieve. invokeAgent and invokeInlineAgent give the answer as text, or a" + + " List of the chunks with streamOutputMode=chunks or the" + + " CamelAwsBedrockAgentRuntimeAgentStreamOutputMode header; the text is empty" + + " when the agent returns control. invokeFlow gives the document of the last" + + " output of the flow as text, or as a Document of the AWS SDK for another" + + " type, and keeps the body when the flow has no output")) public class BedrockAgentRuntimeEndpoint extends ScheduledPollEndpoint implements EndpointServiceLocation { private BedrockAgentRuntimeClient bedrockAgentRuntimeClient; diff --git a/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/runtime/BedrockConfiguration.java b/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/runtime/BedrockConfiguration.java index 976c878e70ee1..a026a3f1c3899 100644 --- a/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/runtime/BedrockConfiguration.java +++ b/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/runtime/BedrockConfiguration.java @@ -305,7 +305,7 @@ public String getStreamOutputMode() { /** * The streaming output mode (complete or chunks). In complete mode, the full response is accumulated and returned - * as a single message. In chunks mode, each chunk is emitted as a separate exchange. + * as a single message. In chunks mode, the message body is a List of the chunks. */ public void setStreamOutputMode(String streamOutputMode) { this.streamOutputMode = streamOutputMode; diff --git a/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/runtime/BedrockEndpoint.java b/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/runtime/BedrockEndpoint.java index 405b05c2ba817..4c017a1c6f3e3 100644 --- a/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/runtime/BedrockEndpoint.java +++ b/components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/runtime/BedrockEndpoint.java @@ -25,6 +25,9 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.aws2.bedrock.runtime.client.BedrockClientFactory; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -39,6 +42,42 @@ @UriEndpoint(firstVersion = "4.5.0", scheme = "aws-bedrock", title = "AWS Bedrock", syntax = "aws-bedrock:label", producerOnly = true, category = { Category.AI, Category.CLOUD }, headersClass = BedrockConstants.class) +@BodyTypes(producerIn = @BodyType(value = Carrier.TEXT, + byOption = { + @BodyType.When(option = "operation", value = "converse", carriers = Carrier.ANY), + @BodyType.When(option = "operation", value = "converseStream", + carriers = Carrier.ANY), + @BodyType.When(option = "operation", value = "applyGuardrail", + carriers = Carrier.ANY) }, + description = "The request of the model as JSON text for the invoke operations, which also" + + " need the CamelAwsBedrockContentType and CamelAwsBedrockAcceptContentType" + + " headers. Bytes, a stream or a file are sent as their toString(): convert" + + " them to a String first, and marshal a Map or a POJO to JSON. converse," + + " converseStream and applyGuardrail take their input from headers, such as" + + " CamelAwsBedrockConverseMessages. With pojoRequest=true an" + + " InvokeModelRequest of the AWS SDK: another body fails"), + producerOut = @BodyType(value = { Carrier.TEXT, Carrier.LIST }, + byOption = { + @BodyType.When(option = "operation", value = "invokeTextModel", + carriers = { Carrier.TEXT, Carrier.POJO }), + @BodyType.When(option = "operation", value = "invokeImageModel", + carriers = Carrier.POJO), + @BodyType.When(option = "operation", value = "invokeEmbeddingsModel", + carriers = Carrier.POJO, + javaType = "software.amazon.awssdk.services.bedrockruntime.model.InvokeModelResponse"), + @BodyType.When(option = "operation", value = "converse", carriers = Carrier.TEXT, + javaType = "java.lang.String"), + @BodyType.When(option = "operation", value = "applyGuardrail", + carriers = Carrier.TEXT, + javaType = "java.lang.String") }, + description = "The streaming operations and converseStream give the text, or a List of the" + + " chunks with streamOutputMode=chunks. invokeTextModel gives the JSON" + + " response as text for the Amazon Titan models, and a Jackson JsonNode for" + + " the others: the response, or the generated text for Llama, Cohere and" + + " Claude 2. invokeImageModel gives a JsonNode array of the images as Base64" + + " text, and invokeEmbeddingsModel the InvokeModelResponse of the AWS SDK." + + " converse gives the answer as text, empty when the model asks for a tool," + + " and applyGuardrail its action as text: NONE or GUARDRAIL_INTERVENED")) public class BedrockEndpoint extends ScheduledPollEndpoint implements EndpointServiceLocation { private BedrockRuntimeClient bedrockRuntimeClient; diff --git a/components/camel-aws/camel-aws-cloudtrail/src/generated/resources/META-INF/org/apache/camel/component/aws/cloudtrail/aws-cloudtrail.json b/components/camel-aws/camel-aws-cloudtrail/src/generated/resources/META-INF/org/apache/camel/component/aws/cloudtrail/aws-cloudtrail.json index e609d1650cdef..888fdbc12fe4f 100644 --- a/components/camel-aws/camel-aws-cloudtrail/src/generated/resources/META-INF/org/apache/camel/component/aws/cloudtrail/aws-cloudtrail.json +++ b/components/camel-aws/camel-aws-cloudtrail/src/generated/resources/META-INF/org/apache/camel/component/aws/cloudtrail/aws-cloudtrail.json @@ -55,6 +55,9 @@ "CamelAwsCloudTrailEventSource": { "index": 2, "kind": "header", "displayName": "", "group": "consumer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The event Source of the cloud trail event consumed.", "constantName": "org.apache.camel.component.aws.cloudtrail.CloudtrailConstants#EVENT_SOURCE" }, "CamelAwsCloudTrailEventUsername": { "index": 3, "kind": "header", "displayName": "", "group": "consumer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The associated username of the event of the cloud trail event consumed.", "constantName": "org.apache.camel.component.aws.cloudtrail.CloudtrailConstants#USERNAME" } }, + "bodyTypes": { + "consumerOut": { "carriers": [ "bytes" ], "javaType": "byte[]", "format": "json", "description": "The CloudTrail record of the event as JSON in a byte array, one message per event, the newest first within a poll, with the id, the name, the source and the user name of the event in headers: unmarshal it to read its fields" } + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "consumer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.cloudtrail.CloudtrailConfiguration", "configurationField": "configuration", "description": "A label for indexing cloudtrail endpoints" }, "eventSource": { "index": 1, "kind": "parameter", "displayName": "Event Source", "group": "consumer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.cloudtrail.CloudtrailConfiguration", "configurationField": "configuration", "description": "Specify an event source to select events" }, diff --git a/components/camel-aws/camel-aws-cloudtrail/src/main/java/org/apache/camel/component/aws/cloudtrail/CloudtrailEndpoint.java b/components/camel-aws/camel-aws-cloudtrail/src/main/java/org/apache/camel/component/aws/cloudtrail/CloudtrailEndpoint.java index 3029a98c26eab..e63fb82c1a5f1 100644 --- a/components/camel-aws/camel-aws-cloudtrail/src/main/java/org/apache/camel/component/aws/cloudtrail/CloudtrailEndpoint.java +++ b/components/camel-aws/camel-aws-cloudtrail/src/main/java/org/apache/camel/component/aws/cloudtrail/CloudtrailEndpoint.java @@ -23,6 +23,9 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.aws.cloudtrail.client.CloudtrailClientFactory; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -36,6 +39,11 @@ @UriEndpoint(firstVersion = "3.19.0", scheme = "aws-cloudtrail", title = "AWS CloudTrail", syntax = "aws-cloudtrail:label", consumerOnly = true, category = { Category.CLOUD, Category.MANAGEMENT, Category.MONITORING }, headersClass = CloudtrailConstants.class) +@BodyTypes(consumerOut = @BodyType(value = Carrier.BYTES, javaType = "byte[]", format = "json", + description = "The CloudTrail record of the event as JSON in a byte array, one message per" + + " event, the newest first within a poll, with the id, the name, the source" + + " and the user name of the event in headers: unmarshal it to read its" + + " fields")) public class CloudtrailEndpoint extends ScheduledPollEndpoint implements EndpointServiceLocation { @UriParam diff --git a/components/camel-aws/camel-aws2-comprehend/src/generated/resources/META-INF/org/apache/camel/component/aws2/comprehend/aws2-comprehend.json b/components/camel-aws/camel-aws2-comprehend/src/generated/resources/META-INF/org/apache/camel/component/aws2/comprehend/aws2-comprehend.json index 31e1559928141..31d5e8fbb5a90 100644 --- a/components/camel-aws/camel-aws2-comprehend/src/generated/resources/META-INF/org/apache/camel/component/aws2/comprehend/aws2-comprehend.json +++ b/components/camel-aws/camel-aws2-comprehend/src/generated/resources/META-INF/org/apache/camel/component/aws2/comprehend/aws2-comprehend.json @@ -58,6 +58,10 @@ "CamelAwsComprehendDetectedSentiment": { "index": 5, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The detected sentiment", "constantName": "org.apache.camel.component.aws2.comprehend.Comprehend2Constants#DETECTED_SENTIMENT" }, "CamelAwsComprehendDetectedSentimentScore": { "index": 6, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "software.amazon.awssdk.services.comprehend.model.SentimentScore", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The detected sentiment scores", "constantName": "org.apache.camel.component.aws2.comprehend.Comprehend2Constants#DETECTED_SENTIMENT_SCORE" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "text", "bytes", "stream", "file" ], "description": "The text to analyze, for every operation: bytes, a stream or a file are read as text, a Map or a POJO is analyzed as its toString(), so take the text out of it first, and no body fails. With pojoRequest=true the request of the AWS SDK for the operation, such as a DetectSentimentRequest: another body fails" }, + "producerOut": { "carriers": [ "list" ], "byOption": [ { "option": "operation", "value": "detectSentiment", "carriers": [ "pojo" ], "javaType": "software.amazon.awssdk.services.comprehend.model.DetectSentimentResponse" }, { "option": "operation", "value": "classifyDocument", "carriers": [ "pojo" ], "javaType": "software.amazon.awssdk.services.comprehend.model.ClassifyDocumentResponse" } ], "description": "A List of what is found: the languages for detectDominantLanguage, the default, with the first one and its score in headers, and the entities, key phrases, syntax tokens, PII entities or toxic labels of the other operations. The DetectSentimentResponse of the AWS SDK for detectSentiment, with the sentiment and its scores in headers, and the ClassifyDocumentResponse for classifyDocument. The text is not kept: store it in a variable to analyze it again" } + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.comprehend.Comprehend2Configuration", "configurationField": "configuration", "description": "Logical name" }, "endpointArn": { "index": 1, "kind": "parameter", "displayName": "Endpoint Arn", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.comprehend.Comprehend2Configuration", "configurationField": "configuration", "description": "The Amazon Resource Name (ARN) of the endpoint to use for document classification. Required for classifyDocument operation." }, diff --git a/components/camel-aws/camel-aws2-comprehend/src/main/docs/aws2-comprehend-component.adoc b/components/camel-aws/camel-aws2-comprehend/src/main/docs/aws2-comprehend-component.adoc index 15f9d183c8d77..0b206bf21df6f 100644 --- a/components/camel-aws/camel-aws2-comprehend/src/main/docs/aws2-comprehend-component.adoc +++ b/components/camel-aws/camel-aws2-comprehend/src/main/docs/aws2-comprehend-component.adoc @@ -641,10 +641,13 @@ Analyze customer feedback for sentiment and key topics: ---- from("kafka:customer-feedback") .log("Processing feedback: ${body}") + // Keep the text, as each operation replaces the body with its result + .setVariable("feedback", body()) // Analyze sentiment .to("aws2-comprehend://test?operation=detectSentiment&languageCode=en&useDefaultCredentialsProvider=true®ion=us-east-1") .setHeader("sentiment", simple("${header.CamelAwsComprehendDetectedSentiment}")) - // Extract key phrases + // Restore the text and extract key phrases + .setBody(variable("feedback")) .to("aws2-comprehend://test?operation=detectKeyPhrases&languageCode=en&useDefaultCredentialsProvider=true®ion=us-east-1") .setHeader("keyPhrases", body()) .log("Sentiment: ${header.sentiment}, Key topics: ${header.keyPhrases}") diff --git a/components/camel-aws/camel-aws2-comprehend/src/main/java/org/apache/camel/component/aws2/comprehend/Comprehend2Endpoint.java b/components/camel-aws/camel-aws2-comprehend/src/main/java/org/apache/camel/component/aws2/comprehend/Comprehend2Endpoint.java index 7108043d7964a..459de5d36763c 100644 --- a/components/camel-aws/camel-aws2-comprehend/src/main/java/org/apache/camel/component/aws2/comprehend/Comprehend2Endpoint.java +++ b/components/camel-aws/camel-aws2-comprehend/src/main/java/org/apache/camel/component/aws2/comprehend/Comprehend2Endpoint.java @@ -22,6 +22,9 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.aws2.comprehend.client.Comprehend2ClientFactory; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -34,6 +37,27 @@ */ @UriEndpoint(firstVersion = "4.18.0", scheme = "aws2-comprehend", title = "AWS Comprehend", syntax = "aws2-comprehend:label", producerOnly = true, category = { Category.CLOUD, Category.AI }, headersClass = Comprehend2Constants.class) +@BodyTypes(producerIn = @BodyType(value = { Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, Carrier.FILE }, + description = "The text to analyze, for every operation: bytes, a stream or a file are read" + + " as text, a Map or a POJO is analyzed as its toString(), so take the text" + + " out of it first, and no body fails. With pojoRequest=true the request of" + + " the AWS SDK for the operation, such as a DetectSentimentRequest: another" + + " body fails"), + producerOut = @BodyType(value = Carrier.LIST, + byOption = { + @BodyType.When(option = "operation", value = "detectSentiment", + carriers = Carrier.POJO, + javaType = "software.amazon.awssdk.services.comprehend.model.DetectSentimentResponse"), + @BodyType.When(option = "operation", value = "classifyDocument", + carriers = Carrier.POJO, + javaType = "software.amazon.awssdk.services.comprehend.model.ClassifyDocumentResponse") }, + description = "A List of what is found: the languages for detectDominantLanguage, the" + + " default, with the first one and its score in headers, and the entities," + + " key phrases, syntax tokens, PII entities or toxic labels of the other" + + " operations. The DetectSentimentResponse of the AWS SDK for" + + " detectSentiment, with the sentiment and its scores in headers, and the" + + " ClassifyDocumentResponse for classifyDocument. The text is not kept: store" + + " it in a variable to analyze it again")) public class Comprehend2Endpoint extends ScheduledPollEndpoint implements EndpointServiceLocation { private ComprehendClient comprehendClient; diff --git a/components/camel-aws/camel-aws2-polly/src/generated/resources/META-INF/org/apache/camel/component/aws2/polly/aws2-polly.json b/components/camel-aws/camel-aws2-polly/src/generated/resources/META-INF/org/apache/camel/component/aws2/polly/aws2-polly.json index d2290ba44fc61..d55f0f1558004 100644 --- a/components/camel-aws/camel-aws2-polly/src/generated/resources/META-INF/org/apache/camel/component/aws2/polly/aws2-polly.json +++ b/components/camel-aws/camel-aws2-polly/src/generated/resources/META-INF/org/apache/camel/component/aws2/polly/aws2-polly.json @@ -78,6 +78,10 @@ "CamelAwsPollyContentType": { "index": 14, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The content type of the audio stream", "constantName": "org.apache.camel.component.aws2.polly.Polly2Constants#CONTENT_TYPE" }, "CamelAwsPollyRequestCharacters": { "index": 15, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Number of characters synthesized", "constantName": "org.apache.camel.component.aws2.polly.Polly2Constants#REQUEST_CHARACTERS" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "operation", "value": "synthesizeSpeech", "carriers": [ "text", "bytes", "stream", "file" ] }, { "option": "operation", "value": "startSpeechSynthesisTask", "carriers": [ "text", "bytes", "stream", "file" ] } ], "description": "The text to speak for synthesizeSpeech, the default, and startSpeechSynthesisTask: plain text, or SSML with textType=ssml. Bytes, a stream or a file are read as text, a Map or a POJO is spoken as its toString(), so take the text out of it first, and no body fails. putLexicon takes the lexicon from the body when neither the lexiconContent option nor the CamelAwsPollyLexiconContent header is set. The other operations do not use the body. With pojoRequest=true the request of the AWS SDK for the operation, such as a SynthesizeSpeechRequest: another body fails" }, + "producerOut": { "carriers": [ "pojo" ], "byOption": [ { "option": "operation", "value": "synthesizeSpeech", "carriers": [ "stream" ] }, { "option": "operation", "value": "describeVoices", "carriers": [ "list" ], "javaType": "java.util.List" }, { "option": "operation", "value": "listLexicons", "carriers": [ "list" ], "javaType": "java.util.List" }, { "option": "operation", "value": "listSpeechSynthesisTasks", "carriers": [ "list" ], "javaType": "java.util.List" } ], "description": "The audio of synthesizeSpeech, the default, as a stream, with its content type and the number of characters in headers: read it once, or write it to a file. A List for describeVoices, listLexicons and listSpeechSynthesisTasks, the SynthesisTask for startSpeechSynthesisTask, with its id in a header, and getSpeechSynthesisTask, the Lexicon for getLexicon, and the response of the AWS SDK for putLexicon and deleteLexicon" } + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.polly.Polly2Configuration", "configurationField": "configuration", "description": "Logical name" }, "engine": { "index": 1, "kind": "parameter", "displayName": "Engine", "group": "producer", "label": "", "required": false, "type": "enum", "javaType": "software.amazon.awssdk.services.polly.model.Engine", "enum": [ "standard", "neural", "long-form", "generative", "null" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.polly.Polly2Configuration", "configurationField": "configuration", "description": "The engine to use for synthesis (standard, neural, long-form, generative)" }, diff --git a/components/camel-aws/camel-aws2-polly/src/main/java/org/apache/camel/component/aws2/polly/Polly2Endpoint.java b/components/camel-aws/camel-aws2-polly/src/main/java/org/apache/camel/component/aws2/polly/Polly2Endpoint.java index 2b4f80a3c3084..b8389b9e8881f 100644 --- a/components/camel-aws/camel-aws2-polly/src/main/java/org/apache/camel/component/aws2/polly/Polly2Endpoint.java +++ b/components/camel-aws/camel-aws2-polly/src/main/java/org/apache/camel/component/aws2/polly/Polly2Endpoint.java @@ -22,6 +22,9 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.aws2.polly.client.Polly2ClientFactory; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -34,6 +37,41 @@ */ @UriEndpoint(firstVersion = "4.18.0", scheme = "aws2-polly", title = "AWS Polly", syntax = "aws2-polly:label", producerOnly = true, category = { Category.CLOUD, Category.AI }, headersClass = Polly2Constants.class) +@BodyTypes(producerIn = @BodyType(value = Carrier.ANY, + byOption = { + @BodyType.When(option = "operation", value = "synthesizeSpeech", + carriers = { + Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, Carrier.FILE }), + @BodyType.When(option = "operation", value = "startSpeechSynthesisTask", + carriers = { + Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, Carrier.FILE }) }, + description = "The text to speak for synthesizeSpeech, the default, and" + + " startSpeechSynthesisTask: plain text, or SSML with textType=ssml. Bytes, a" + + " stream or a file are read as text, a Map or a POJO is spoken as its" + + " toString(), so take the text out of it first, and no body fails. putLexicon" + + " takes the lexicon from the body when neither the lexiconContent option nor" + + " the CamelAwsPollyLexiconContent header is set. The other operations do not" + + " use the body. With pojoRequest=true the request of the AWS SDK for the" + + " operation, such as a SynthesizeSpeechRequest: another body fails"), + producerOut = @BodyType(value = Carrier.POJO, + byOption = { + @BodyType.When(option = "operation", value = "synthesizeSpeech", + carriers = Carrier.STREAM), + @BodyType.When(option = "operation", value = "describeVoices", + carriers = Carrier.LIST, + javaType = "java.util.List"), + @BodyType.When(option = "operation", value = "listLexicons", carriers = Carrier.LIST, + javaType = "java.util.List"), + @BodyType.When(option = "operation", value = "listSpeechSynthesisTasks", + carriers = Carrier.LIST, + javaType = "java.util.List") }, + description = "The audio of synthesizeSpeech, the default, as a stream, with its content" + + " type and the number of characters in headers: read it once, or write it to" + + " a file. A List for describeVoices, listLexicons and" + + " listSpeechSynthesisTasks, the SynthesisTask for startSpeechSynthesisTask," + + " with its id in a header, and getSpeechSynthesisTask, the Lexicon for" + + " getLexicon, and the response of the AWS SDK for putLexicon and" + + " deleteLexicon")) public class Polly2Endpoint extends ScheduledPollEndpoint implements EndpointServiceLocation { private PollyClient pollyClient; diff --git a/components/camel-aws/camel-aws2-rekognition/src/generated/resources/META-INF/org/apache/camel/component/aws2/rekognition/aws2-rekognition.json b/components/camel-aws/camel-aws2-rekognition/src/generated/resources/META-INF/org/apache/camel/component/aws2/rekognition/aws2-rekognition.json index 9aa551cdd4737..abe23848e21d5 100644 --- a/components/camel-aws/camel-aws2-rekognition/src/generated/resources/META-INF/org/apache/camel/component/aws2/rekognition/aws2-rekognition.json +++ b/components/camel-aws/camel-aws2-rekognition/src/generated/resources/META-INF/org/apache/camel/component/aws2/rekognition/aws2-rekognition.json @@ -84,6 +84,10 @@ "CamelAwsRekognitionFaceMatchThreshold": { "index": 33, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Float", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Optional value specifying the minimum confidence in the face match to return", "constantName": "org.apache.camel.component.aws2.rekognition.Rekognition2Constants#FACE_MATCH_THRESHOLD" }, "CamelAwsRekognitionMaxUsers": { "index": 34, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Maximum number of users to return in the response", "constantName": "org.apache.camel.component.aws2.rekognition.Rekognition2Constants#MAX_USERS" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "pojoRequest", "value": "true", "carriers": [ "pojo" ] } ], "description": "Not used, not even for the picture: the image comes from the CamelAwsRekognitionImage header, and for compareFaces from the CamelAwsRekognitionSourceImage and CamelAwsRekognitionTargetImage headers, as an Image of the AWS SDK with the bytes or the S3 object of a JPEG or PNG; bytes in these headers are not used. The other inputs come from headers too, such as CamelAwsRekognitionCollectionId. With pojoRequest=true the request of the AWS SDK for the operation, such as a DetectLabelsRequest: another body fails" }, + "producerOut": { "carriers": [ "pojo" ], "description": "The response of the AWS SDK for the operation, such as the DetectLabelsResponse of detectLabels, whose labels hold the names and the confidence of what the image shows" } + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.rekognition.Rekognition2Configuration", "configurationField": "configuration", "description": "Logical name" }, "operation": { "index": 1, "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "", "required": true, "type": "enum", "javaType": "org.apache.camel.component.aws2.rekognition.Rekognition2Operations", "enum": [ "associateFaces", "compareFaces", "createCollection", "createUser", "deleteCollection", "deleteFaces", "deleteUser", "describeCollection", "detectFaces", "detectLabels", "detectModerationLabels", "detectProtectiveEquipment", "detectText", "disassociateFaces", "getCelebrityInfo", "getMediaAnalysisJob", "indexFaces", "listCollections", "listMediaAnalysisJobs", "listFaces", "listUsers", "recognizeCelebrities", "searchFaces", "searchFacesByImage", "searchUsers", "searchUsersByImage", "startMediaAnalysisJob" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.rekognition.Rekognition2Configuration", "configurationField": "configuration", "description": "The operation to perform. It can be listFunctions, getFunction, createFunction, deleteFunction or invokeFunction" }, diff --git a/components/camel-aws/camel-aws2-rekognition/src/main/java/org/apache/camel/component/aws2/rekognition/Rekognition2Endpoint.java b/components/camel-aws/camel-aws2-rekognition/src/main/java/org/apache/camel/component/aws2/rekognition/Rekognition2Endpoint.java index 3b189225e7b1a..a94bd0e73f1c9 100644 --- a/components/camel-aws/camel-aws2-rekognition/src/main/java/org/apache/camel/component/aws2/rekognition/Rekognition2Endpoint.java +++ b/components/camel-aws/camel-aws2-rekognition/src/main/java/org/apache/camel/component/aws2/rekognition/Rekognition2Endpoint.java @@ -18,6 +18,9 @@ import org.apache.camel.*; import org.apache.camel.component.aws2.rekognition.client.Rekognition2ClientFactory; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -32,6 +35,20 @@ syntax = "aws2-rekognition:label", producerOnly = true, category = { Category.CLOUD, Category.AI }, headersClass = Rekognition2Constants.class) +@BodyTypes(producerIn = @BodyType(value = Carrier.ANY, + byOption = @BodyType.When(option = "pojoRequest", value = "true", carriers = Carrier.POJO), + description = "Not used, not even for the picture: the image comes from the" + + " CamelAwsRekognitionImage header, and for compareFaces from the" + + " CamelAwsRekognitionSourceImage and CamelAwsRekognitionTargetImage headers," + + " as an Image of the AWS SDK with the bytes or the S3 object of a JPEG or" + + " PNG; bytes in these headers are not used. The other inputs come from" + + " headers too, such as CamelAwsRekognitionCollectionId. With pojoRequest=true" + + " the request of the AWS SDK for the operation, such as a" + + " DetectLabelsRequest: another body fails"), + producerOut = @BodyType(value = Carrier.POJO, + description = "The response of the AWS SDK for the operation, such as the" + + " DetectLabelsResponse of detectLabels, whose labels hold the names and the" + + " confidence of what the image shows")) public class Rekognition2Endpoint extends DefaultEndpoint implements EndpointServiceLocation { private RekognitionClient awsRekognitionClient; diff --git a/components/camel-aws/camel-aws2-textract/src/generated/resources/META-INF/org/apache/camel/component/aws2/textract/aws2-textract.json b/components/camel-aws/camel-aws2-textract/src/generated/resources/META-INF/org/apache/camel/component/aws2/textract/aws2-textract.json index c3ac336ad3f2a..fe849e7685863 100644 --- a/components/camel-aws/camel-aws2-textract/src/generated/resources/META-INF/org/apache/camel/component/aws2/textract/aws2-textract.json +++ b/components/camel-aws/camel-aws2-textract/src/generated/resources/META-INF/org/apache/camel/component/aws2/textract/aws2-textract.json @@ -60,6 +60,10 @@ "CamelAwsTextractNextToken": { "index": 6, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The next token for pagination in operations that return multiple pages", "constantName": "org.apache.camel.component.aws2.textract.Textract2Constants#NEXT_TOKEN" }, "CamelAwsTextractFeatureTypes": { "index": 7, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "List", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The feature types for document analysis (TABLES, FORMS, SIGNATURES, etc.)", "constantName": "org.apache.camel.component.aws2.textract.Textract2Constants#FEATURE_TYPES" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "pojoRequest", "value": "true", "carriers": [ "pojo" ] } ], "description": "The document of detectDocumentText, the default, analyzeDocument and analyzeExpense when no S3 object is named: an image or a PDF as bytes, a stream or a file; a Map, a List, a POJO or no body fails. The s3Bucket and s3Object options, or else the CamelAwsTextractS3Bucket and CamelAwsTextractS3Object headers, name an S3 object instead, and the start operations read only that. The get operations take the job id from the CamelAwsTextractJobId header, or else the body as text. With pojoRequest=true the request of the AWS SDK for the operation, such as a DetectDocumentTextRequest: another body fails" }, + "producerOut": { "carriers": [ "pojo" ], "description": "The response of the AWS SDK for the operation, such as the DetectDocumentTextResponse of detectDocumentText, the default, whose blocks hold the lines and the words found. The start operations give the job id only in the response: set the CamelAwsTextractJobId header from it for the get operations" } + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.textract.Textract2Configuration", "configurationField": "configuration", "description": "Logical name" }, "operation": { "index": 1, "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "", "required": true, "type": "enum", "javaType": "org.apache.camel.component.aws2.textract.Textract2Operations", "enum": [ "detectDocumentText", "analyzeDocument", "analyzeExpense", "startDocumentTextDetection", "startDocumentAnalysis", "startExpenseAnalysis", "getDocumentTextDetection", "getDocumentAnalysis", "getExpenseAnalysis" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": "detectDocumentText", "configurationClass": "org.apache.camel.component.aws2.textract.Textract2Configuration", "configurationField": "configuration", "description": "The operation to perform" }, diff --git a/components/camel-aws/camel-aws2-textract/src/main/java/org/apache/camel/component/aws2/textract/Textract2Endpoint.java b/components/camel-aws/camel-aws2-textract/src/main/java/org/apache/camel/component/aws2/textract/Textract2Endpoint.java index b1abe44061cee..41d24ca44759a 100644 --- a/components/camel-aws/camel-aws2-textract/src/main/java/org/apache/camel/component/aws2/textract/Textract2Endpoint.java +++ b/components/camel-aws/camel-aws2-textract/src/main/java/org/apache/camel/component/aws2/textract/Textract2Endpoint.java @@ -22,6 +22,9 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.aws2.textract.client.Textract2ClientFactory; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -34,6 +37,23 @@ */ @UriEndpoint(firstVersion = "4.15.0", scheme = "aws2-textract", title = "AWS Textract", syntax = "aws2-textract:label", producerOnly = true, category = { Category.CLOUD, Category.DOCUMENT }, headersClass = Textract2Constants.class) +@BodyTypes(producerIn = @BodyType(value = Carrier.ANY, + byOption = @BodyType.When(option = "pojoRequest", value = "true", carriers = Carrier.POJO), + description = "The document of detectDocumentText, the default, analyzeDocument and" + + " analyzeExpense when no S3 object is named: an image or a PDF as bytes, a" + + " stream or a file; a Map, a List, a POJO or no body fails. The s3Bucket and" + + " s3Object options, or else the CamelAwsTextractS3Bucket and" + + " CamelAwsTextractS3Object headers, name an S3 object instead, and the start" + + " operations read only that. The get operations take the job id from the" + + " CamelAwsTextractJobId header, or else the body as text. With" + + " pojoRequest=true the request of the AWS SDK for the operation, such as a" + + " DetectDocumentTextRequest: another body fails"), + producerOut = @BodyType(value = Carrier.POJO, + description = "The response of the AWS SDK for the operation, such as the" + + " DetectDocumentTextResponse of detectDocumentText, the default, whose" + + " blocks hold the lines and the words found. The start operations give the" + + " job id only in the response: set the CamelAwsTextractJobId header from it" + + " for the get operations")) public class Textract2Endpoint extends ScheduledPollEndpoint implements EndpointServiceLocation { private TextractClient textractClient; diff --git a/components/camel-aws/camel-aws2-timestream/src/generated/resources/META-INF/org/apache/camel/component/aws2/timestream/aws2-timestream.json b/components/camel-aws/camel-aws2-timestream/src/generated/resources/META-INF/org/apache/camel/component/aws2/timestream/aws2-timestream.json index 37ecd9c677a55..16e38dcedf63a 100644 --- a/components/camel-aws/camel-aws2-timestream/src/generated/resources/META-INF/org/apache/camel/component/aws2/timestream/aws2-timestream.json +++ b/components/camel-aws/camel-aws2-timestream/src/generated/resources/META-INF/org/apache/camel/component/aws2/timestream/aws2-timestream.json @@ -88,6 +88,10 @@ "CamelAwsTimestreamClientToken": { "index": 36, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Using a ClientToken makes the call to CreateScheduledQuery idempotent", "constantName": "org.apache.camel.component.aws2.timestream.Timestream2Constants#CLIENT_TOKEN" }, "CamelAwsTimestreamKmsKeyId": { "index": 37, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Amazon KMS key used to encrypt the scheduled query resource, at-rest.", "constantName": "org.apache.camel.component.aws2.timestream.Timestream2Constants#KMS_KEY_ID" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "pojoRequest", "value": "true", "carriers": [ "pojo" ] } ], "description": "Not used: the operations of both client types take their input from headers, such as the records of writeRecords in CamelAwsTimestreamRecordList, a List of the Record of the AWS SDK, and the SQL of query in CamelAwsTimestreamQueryString. With pojoRequest=true the request of the AWS SDK for the operation, such as a WriteRecordsRequest or a QueryRequest: another body fails" }, + "producerOut": { "carriers": [ "pojo" ], "description": "The response of the AWS SDK for the operation, such as the WriteRecordsResponse of writeRecords, or the QueryResponse of query with one page of rows: the next page needs a QueryRequest with its nextToken and pojoRequest=true" } + }, "properties": { "clientType": { "index": 0, "kind": "path", "displayName": "Client Type", "group": "producer", "label": "", "required": true, "type": "enum", "javaType": "org.apache.camel.component.aws2.timestream.Timestream2ClientType", "enum": [ "write", "query" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.timestream.Timestream2Configuration", "configurationField": "configuration", "description": "Type of client - write\/query" }, "label": { "index": 1, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.timestream.Timestream2Configuration", "configurationField": "configuration", "description": "Logical name" }, diff --git a/components/camel-aws/camel-aws2-timestream/src/main/docs/aws2-timestream-component.adoc b/components/camel-aws/camel-aws2-timestream/src/main/docs/aws2-timestream-component.adoc index 37a71156ad224..840a2f052a09c 100644 --- a/components/camel-aws/camel-aws2-timestream/src/main/docs/aws2-timestream-component.adoc +++ b/components/camel-aws/camel-aws2-timestream/src/main/docs/aws2-timestream-component.adoc @@ -226,8 +226,8 @@ YAML:: === Using a POJO as body Sometimes building an AWS Request can be complex because of multiple options. We introduce the possibility to use a POJO as the body. -In AWS Timestream there are multiple operations you can submit, as an example for Create state machine - request, you can do something like: +In AWS Timestream there are multiple operations you can submit, as an example for a create database +request, you can do something like: * Write Operation ** createDatabase: this operation will create a timestream database @@ -236,7 +236,7 @@ In AWS Timestream there are multiple operations you can submit, as an example fo [source,java] ---- from("direct:start") - .setBody(CreateDatabaseRequest.builder().database(Database.builder().databaseName("testDb").kmsKeyId("testKmsKey").build()).build()) + .setBody(CreateDatabaseRequest.builder().databaseName("testDb").kmsKeyId("testKmsKey").build()) .to("aws2-timestream://write:test?awsTimestreamWriteClient=#awsTimestreamWriteClient&operation=createDatabase&pojoRequest=true") ---- diff --git a/components/camel-aws/camel-aws2-timestream/src/main/java/org/apache/camel/component/aws2/timestream/Timestream2AbstractEndpoint.java b/components/camel-aws/camel-aws2-timestream/src/main/java/org/apache/camel/component/aws2/timestream/Timestream2AbstractEndpoint.java index ec86d781bd74b..f0e2ee59b0de5 100644 --- a/components/camel-aws/camel-aws2-timestream/src/main/java/org/apache/camel/component/aws2/timestream/Timestream2AbstractEndpoint.java +++ b/components/camel-aws/camel-aws2-timestream/src/main/java/org/apache/camel/component/aws2/timestream/Timestream2AbstractEndpoint.java @@ -17,6 +17,9 @@ package org.apache.camel.component.aws2.timestream; import org.apache.camel.*; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.support.DefaultEndpoint; @@ -25,6 +28,19 @@ syntax = "aws2-timestream:clientType:label", producerOnly = true, category = { Category.CLOUD, Category.DATABASE }, headersClass = Timestream2Constants.class) +@BodyTypes(producerIn = @BodyType(value = Carrier.ANY, + byOption = @BodyType.When(option = "pojoRequest", value = "true", carriers = Carrier.POJO), + description = "Not used: the operations of both client types take their input from headers," + + " such as the records of writeRecords in CamelAwsTimestreamRecordList, a List" + + " of the Record of the AWS SDK, and the SQL of query in" + + " CamelAwsTimestreamQueryString. With pojoRequest=true the request of the AWS" + + " SDK for the operation, such as a WriteRecordsRequest or a QueryRequest:" + + " another body fails"), + producerOut = @BodyType(value = Carrier.POJO, + description = "The response of the AWS SDK for the operation, such as the" + + " WriteRecordsResponse of writeRecords, or the QueryResponse of query with" + + " one page of rows: the next page needs a QueryRequest with its nextToken" + + " and pojoRequest=true")) public abstract class Timestream2AbstractEndpoint extends DefaultEndpoint { @UriParam diff --git a/components/camel-aws/camel-aws2-transcribe/src/generated/resources/META-INF/org/apache/camel/component/aws2/transcribe/aws2-transcribe.json b/components/camel-aws/camel-aws2-transcribe/src/generated/resources/META-INF/org/apache/camel/component/aws2/transcribe/aws2-transcribe.json index b7ef6e8f485e3..5e4991853e349 100644 --- a/components/camel-aws/camel-aws2-transcribe/src/generated/resources/META-INF/org/apache/camel/component/aws2/transcribe/aws2-transcribe.json +++ b/components/camel-aws/camel-aws2-transcribe/src/generated/resources/META-INF/org/apache/camel/component/aws2/transcribe/aws2-transcribe.json @@ -73,6 +73,10 @@ "CamelAwsTranscribeSpecialty": { "index": 21, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The medical specialty of a medical transcription job", "constantName": "org.apache.camel.component.aws2.transcribe.Transcribe2Constants#SPECIALTY" }, "CamelAwsTranscribeType": { "index": 22, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The audio type of a medical transcription job", "constantName": "org.apache.camel.component.aws2.transcribe.Transcribe2Constants#TYPE" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "any" ], "byOption": [ { "option": "pojoRequest", "value": "true", "carriers": [ "pojo" ] } ], "description": "Not used: AWS reads the audio from S3, at the URI in the CamelAwsTranscribeMediaUri header, and the other inputs come from headers too, such as the job name in CamelAwsTranscribeTranscriptionJobName. With pojoRequest=true the request of the AWS SDK for the operation, such as a StartTranscriptionJobRequest: another body fails" }, + "producerOut": { "carriers": [ "pojo" ], "byOption": [ { "option": "operation", "value": "deleteTranscriptionJob", "carriers": [ "unchanged" ] }, { "option": "operation", "value": "deleteVocabulary", "carriers": [ "unchanged" ] } ], "description": "The response of the AWS SDK for the operation, such as the StartTranscriptionJobResponse of startTranscriptionJob. The transcript is not in the body: the job writes it to S3, at the URI that getTranscriptionJob gives. deleteTranscriptionJob and deleteVocabulary keep the body" } + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.transcribe.Transcribe2Configuration", "configurationField": "configuration", "description": "Logical name" }, "operation": { "index": 1, "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "producer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.aws2.transcribe.Transcribe2Operations", "enum": [ "startTranscriptionJob", "getTranscriptionJob", "listTranscriptionJobs", "deleteTranscriptionJob", "createVocabulary", "getVocabulary", "listVocabularies", "updateVocabulary", "deleteVocabulary", "createVocabularyFilter", "getVocabularyFilter", "listVocabularyFilters", "updateVocabularyFilter", "deleteVocabularyFilter", "createLanguageModel", "describeLanguageModel", "listLanguageModels", "deleteLanguageModel", "createMedicalVocabulary", "getMedicalVocabulary", "listMedicalVocabularies", "updateMedicalVocabulary", "deleteMedicalVocabulary", "startMedicalTranscriptionJob", "getMedicalTranscriptionJob", "listMedicalTranscriptionJobs", "deleteMedicalTranscriptionJob", "tagResource", "untagResource", "listTagsForResource" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.transcribe.Transcribe2Configuration", "configurationField": "configuration", "description": "The operation to perform" }, diff --git a/components/camel-aws/camel-aws2-transcribe/src/main/java/org/apache/camel/component/aws2/transcribe/Transcribe2Endpoint.java b/components/camel-aws/camel-aws2-transcribe/src/main/java/org/apache/camel/component/aws2/transcribe/Transcribe2Endpoint.java index cc68f0017c84a..85f5bcb9265fe 100644 --- a/components/camel-aws/camel-aws2-transcribe/src/main/java/org/apache/camel/component/aws2/transcribe/Transcribe2Endpoint.java +++ b/components/camel-aws/camel-aws2-transcribe/src/main/java/org/apache/camel/component/aws2/transcribe/Transcribe2Endpoint.java @@ -21,6 +21,9 @@ import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.support.DefaultEndpoint; @@ -33,6 +36,24 @@ @UriEndpoint(firstVersion = "4.15.0", scheme = "aws2-transcribe", title = "AWS Transcribe", syntax = "aws2-transcribe:label", category = { Category.CLOUD, Category.MESSAGING }, producerOnly = true, headersClass = Transcribe2Constants.class) +@BodyTypes(producerIn = @BodyType(value = Carrier.ANY, + byOption = @BodyType.When(option = "pojoRequest", value = "true", carriers = Carrier.POJO), + description = "Not used: AWS reads the audio from S3, at the URI in the" + + " CamelAwsTranscribeMediaUri header, and the other inputs come from headers" + + " too, such as the job name in CamelAwsTranscribeTranscriptionJobName. With" + + " pojoRequest=true the request of the AWS SDK for the operation, such as a" + + " StartTranscriptionJobRequest: another body fails"), + producerOut = @BodyType(value = Carrier.POJO, + byOption = { + @BodyType.When(option = "operation", value = "deleteTranscriptionJob", + carriers = Carrier.UNCHANGED), + @BodyType.When(option = "operation", value = "deleteVocabulary", + carriers = Carrier.UNCHANGED) }, + description = "The response of the AWS SDK for the operation, such as the" + + " StartTranscriptionJobResponse of startTranscriptionJob. The transcript is" + + " not in the body: the job writes it to S3, at the URI that" + + " getTranscriptionJob gives. deleteTranscriptionJob and deleteVocabulary" + + " keep the body")) public class Transcribe2Endpoint extends DefaultEndpoint { private TranscribeClient transcribeClient; diff --git a/components/camel-aws/camel-aws2-translate/src/generated/resources/META-INF/org/apache/camel/component/aws2/translate/aws2-translate.json b/components/camel-aws/camel-aws2-translate/src/generated/resources/META-INF/org/apache/camel/component/aws2/translate/aws2-translate.json index 88dadd2d7a35c..03466169d6783 100644 --- a/components/camel-aws/camel-aws2-translate/src/generated/resources/META-INF/org/apache/camel/component/aws2/translate/aws2-translate.json +++ b/components/camel-aws/camel-aws2-translate/src/generated/resources/META-INF/org/apache/camel/component/aws2/translate/aws2-translate.json @@ -56,6 +56,10 @@ "CamelAwsTranslateTerminologyNames": { "index": 2, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Collection", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The terminologies to use", "constantName": "org.apache.camel.component.aws2.translate.Translate2Constants#TERMINOLOGY_NAMES" }, "CamelAwsTranslateOperation": { "index": 3, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The operation we want to perform", "constantName": "org.apache.camel.component.aws2.translate.Translate2Constants#OPERATION" } }, + "bodyTypes": { + "producerIn": { "carriers": [ "text", "bytes", "stream", "file" ], "description": "The text to translate: bytes, a stream or a file are read as text, a Map or a POJO is translated as its toString(), so take the text out of it first, and no body fails. With pojoRequest=true the body is a TranslateTextRequest of the AWS SDK: another body fails" }, + "producerOut": { "carriers": [ "text" ], "javaType": "java.lang.String", "description": "The translated text. The source language that AWS detects with autodetectSourceLanguage=true is not kept" } + }, "properties": { "label": { "index": 0, "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.translate.Translate2Configuration", "configurationField": "configuration", "description": "Logical name" }, "autodetectSourceLanguage": { "index": 1, "kind": "parameter", "displayName": "Autodetect Source Language", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.translate.Translate2Configuration", "configurationField": "configuration", "description": "Being able to autodetect the source language" }, diff --git a/components/camel-aws/camel-aws2-translate/src/main/java/org/apache/camel/component/aws2/translate/Translate2Endpoint.java b/components/camel-aws/camel-aws2-translate/src/main/java/org/apache/camel/component/aws2/translate/Translate2Endpoint.java index bd5472b31c06a..21f2a8ef0e61a 100644 --- a/components/camel-aws/camel-aws2-translate/src/main/java/org/apache/camel/component/aws2/translate/Translate2Endpoint.java +++ b/components/camel-aws/camel-aws2-translate/src/main/java/org/apache/camel/component/aws2/translate/Translate2Endpoint.java @@ -22,6 +22,9 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.aws2.translate.client.Translate2ClientFactory; +import org.apache.camel.spi.BodyType; +import org.apache.camel.spi.BodyType.Carrier; +import org.apache.camel.spi.BodyTypes; import org.apache.camel.spi.EndpointServiceLocation; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; @@ -34,6 +37,14 @@ */ @UriEndpoint(firstVersion = "3.1.0", scheme = "aws2-translate", title = "AWS Translate", syntax = "aws2-translate:label", producerOnly = true, category = { Category.CLOUD, Category.MANAGEMENT }, headersClass = Translate2Constants.class) +@BodyTypes(producerIn = @BodyType(value = { Carrier.TEXT, Carrier.BYTES, Carrier.STREAM, Carrier.FILE }, + description = "The text to translate: bytes, a stream or a file are read as text, a Map or a" + + " POJO is translated as its toString(), so take the text out of it first, and" + + " no body fails. With pojoRequest=true the body is a TranslateTextRequest of" + + " the AWS SDK: another body fails"), + producerOut = @BodyType(value = Carrier.TEXT, javaType = "java.lang.String", + description = "The translated text. The source language that AWS detects with" + + " autodetectSourceLanguage=true is not kept")) public class Translate2Endpoint extends ScheduledPollEndpoint implements EndpointServiceLocation { private TranslateClient translateClient; diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AwsBedrockComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AwsBedrockComponentBuilderFactory.java index 784ba10139eca..9308add1cedf2 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AwsBedrockComponentBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AwsBedrockComponentBuilderFactory.java @@ -265,7 +265,7 @@ default AwsBedrockComponentBuilder region(java.lang.String region) { /** * The streaming output mode (complete or chunks). In complete mode, the * full response is accumulated and returned as a single message. In - * chunks mode, each chunk is emitted as a separate exchange. + * chunks mode, the message body is a List of the chunks. * * The option is a: <code>java.lang.String</code> type. * diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/BedrockEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/BedrockEndpointBuilderFactory.java index c9b80486ecc0e..1cb83e8e392e7 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/BedrockEndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/BedrockEndpointBuilderFactory.java @@ -281,7 +281,7 @@ default BedrockEndpointBuilder region(String region) { /** * The streaming output mode (complete or chunks). In complete mode, the * full response is accumulated and returned as a single message. In - * chunks mode, each chunk is emitted as a separate exchange. + * chunks mode, the message body is a List of the chunks. * * The option is a: java.lang.String type. * diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/test/java/org/apache/camel/dsl/yaml/validator/TextBodyFlowTest.java b/dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/test/java/org/apache/camel/dsl/yaml/validator/TextBodyFlowTest.java index 88695c3f60046..4fed1d1142d28 100644 --- a/dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/test/java/org/apache/camel/dsl/yaml/validator/TextBodyFlowTest.java +++ b/dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/test/java/org/apache/camel/dsl/yaml/validator/TextBodyFlowTest.java @@ -1899,6 +1899,125 @@ public void testTheBodyOfQueriesDocumentsAndFiles() { .anySatisfy(m -> assertThat(m).contains("route trap: simple reads a field of the body (${body[oid]})")); } + @Test + public void testTheBodyOfAwsAiServices() { + // translate, comprehend, the speech of polly and the question of retrieveAndGenerate are text, and the invoke + // operations of aws-bedrock send the body as its toString(), so a Map is not the JSON of the request; the + // translation is text and a cloudtrail event is JSON in bytes. converse, rekognition, textract and timestream + // take their input from headers, and polly without an operation is not known, as the component may set it + String yaml = """ + - route: + id: translate + from: + uri: timer:tick + steps: + - setBody: + constant: '{"text": "Ciao"}' + - unmarshal: + json: {} + - to: aws2-translate:t?sourceLanguage=it&targetLanguage=en + - route: + id: analyze + from: + uri: timer:tick + steps: + - setBody: + constant: '{"text": "Great service"}' + - unmarshal: + json: {} + - to: aws2-comprehend:c?operation=detectSentiment&languageCode=en + - route: + id: speak + from: + uri: timer:tick + steps: + - setBody: + constant: '{"text": "Hello"}' + - unmarshal: + json: {} + - to: aws2-polly:p?operation=synthesizeSpeech&voiceId=Joanna + - route: + id: prompt + from: + uri: timer:tick + steps: + - setBody: + constant: '{"inputText": "Hello"}' + - unmarshal: + json: {} + - to: aws-bedrock:b?operation=invokeTextModel&modelId=amazon.titan-text-express-v1 + - route: + id: ask + from: + uri: timer:tick + steps: + - setBody: + constant: '{"question": "What is Camel?"}' + - unmarshal: + json: {} + - to: aws-bedrock-agent-runtime:a?operation=retrieveAndGenerate&knowledgeBaseId=kb1 + - route: + id: translated + from: + uri: timer:tick + steps: + - setBody: + constant: Ciao + - to: aws2-translate:t?sourceLanguage=it&targetLanguage=en + - setHeader: + name: text + simple: ${body[text]} + - route: + id: trail + from: + uri: aws-cloudtrail:trail + steps: + - setHeader: + name: event + simple: ${body[eventName]} + - route: + id: converse + from: + uri: timer:tick + steps: + - setBody: + constant: '{"id": 1}' + - unmarshal: + json: {} + - to: aws-bedrock:b?operation=converse&modelId=amazon.titan-text-express-v1 + - route: + id: labels + from: + uri: timer:tick + steps: + - setBody: + constant: '{"id": 1}' + - unmarshal: + json: {} + - to: aws2-rekognition:r?operation=detectLabels + - to: aws2-textract:t?operation=detectDocumentText + - to: aws2-timestream:write:w?operation=writeRecords + - route: + id: voice + from: + uri: timer:tick + steps: + - setBody: + constant: '{"id": 1}' + - unmarshal: + json: {} + - to: aws2-polly:p?voiceId=Joanna + """; + assertThat(lines(yaml)).hasSize(7) + .anySatisfy(m -> assertThat(m).contains("route translate: to: aws2-translate needs the body as text")) + .anySatisfy(m -> assertThat(m).contains("route analyze: to: aws2-comprehend needs the body as text")) + .anySatisfy(m -> assertThat(m).contains("route speak: to: aws2-polly needs the body as text")) + .anySatisfy(m -> assertThat(m).contains("route prompt: to: aws-bedrock needs the body as text")) + .anySatisfy(m -> assertThat(m).contains("route ask: to: aws-bedrock-agent-runtime needs the body as text")) + .anySatisfy(m -> assertThat(m).contains("route translated: simple reads a field of the body (${body[text]})")) + .anySatisfy(m -> assertThat(m).contains("route trail: simple reads a field of the body (${body[eventName]})")); + } + @Test public void testAnOptionValueInAnotherStyleOfTheEnum() { // the catalog and the enum type converter take convert-to-json and convertToJson as CONVERT_TO_JSON, so after