You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2024/03/06 14:25:10 UTC

(camel-kamelets) 01/03: Added AWS Bedrock Text Sink Kamelet

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git

commit d53603c8c91a9ee3dfe048a818be2fa2d7308696
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Mar 6 15:15:48 2024 +0100

    Added AWS Bedrock Text Sink Kamelet
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 kamelets/aws-bedrock-text-sink.kamelet.yaml | 107 ++++++++++++++++++++++++++++
 1 file changed, 107 insertions(+)

diff --git a/kamelets/aws-bedrock-text-sink.kamelet.yaml b/kamelets/aws-bedrock-text-sink.kamelet.yaml
new file mode 100644
index 00000000..dfedb4fe
--- /dev/null
+++ b/kamelets/aws-bedrock-text-sink.kamelet.yaml
@@ -0,0 +1,107 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+  name: aws-bedrock-text-sink
+  annotations:
+    camel.apache.org/kamelet.support.level: "Stable"
+    camel.apache.org/catalog.version: "4.5.0-SNAPSHOT"
+    camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgZGF0YS1uYW1lPSJMYXllciAxIiBpZD0iTGF5ZXJfMSIgdmlld0JveD0iMCAwIDUxMiA1MTIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTQzMC40MiwxOTYuMzJjOC0xMS4zOSwyMS4xNS0zOC4zMywwLTcyLjEzYTUyLjc5LDUyLjc5LDAsMCwwLTE3LjA2LTE3LjMxYy0xLjUzLTgtNy41NC0yNy4yNi0zMS40Mi00My45MUMzNTksNDcsMzI1LjUyLDQ5LjUzLDMxOS40NCw1MC4xNmE2NC4yNyw2NC4yNywwLDAsMC0xNi4wNy0yLjk0Yy0xNy4xNy0uODEtMzAuMzcsMy44OS0zOS43OCwxNC [...]
+    camel.apache.org/provider: "Apache Software Foundation"
+    camel.apache.org/kamelet.group: "AWS Bedrock"
+    camel.apache.org/kamelet.namespace: "AWS"
+  labels:
+    camel.apache.org/kamelet.type: "sink"
+spec:
+  definition:
+    title: "AWS Bedrock Text Sink"
+    description: |-
+      Send data for invoking a text model of Amazon Bedrock.
+
+      The basic authentication method for the Bedrock service is to specify an access key and a secret key. These parameters are optional because the Kamelet provides a default credentials provider.
+
+      If you use the default credentials provider, the Bedrock client loads the credentials through this provider and doesn't use the basic authentication method.
+    required:
+      - modelId
+      - region
+    type: object
+    properties:
+      modelId:
+        title: Model Id
+        description: The model Id to be used.
+        type: string
+        enum: ["amazon.titan-text-express-v1", "amazon.titan-text-lite-v1", "ai21.j2-ultra-v1", "ai21.j2-mid-v1"]
+      accessKey:
+        title: Access Key
+        description: The access key obtained from AWS.
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      secretKey:
+        title: Secret Key
+        description: The secret key obtained from AWS.
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      region:
+        title: AWS Region
+        description: The AWS region to access.
+        type: string
+        enum: ["us-east-1", "us-west-1", "ap-southeast-1", "ap-northeast-1", "eu-central-1"]
+      useDefaultCredentialsProvider:
+        title: Default Credentials Provider
+        description: If true, the Bedrock client loads credentials through a default credentials provider. If false, it uses the basic authentication method (access key and secret key).
+        type: boolean
+        default: false
+      uriEndpointOverride:
+        title: Overwrite Endpoint URI
+        description: The overriding endpoint URI. To use this option, you must also select the `overrideEndpoint` option.
+        type: string
+      overrideEndpoint:
+        title: Endpoint Overwrite
+        description: Select this option to override the endpoint URI. To use this option, you must also provide a URI for the `uriEndpointOverride` option.
+        type: boolean
+        default: false
+  dependencies:
+    - "camel:core"
+    - "camel:aws-bedrock"
+    - "camel:kamelet"
+  template:
+    from:
+      uri: "kamelet:source"
+      steps:
+      - setHeader:
+          name: "CamelAwsBedrockContentType"
+          constant: "application/json"
+      - setHeader:
+          name: "CamelAwsBedrockAcceptContentType"
+          constant: "application/json"       
+      - to:
+          uri: "aws-bedrock:bedrock-text"
+          parameters:
+            secretKey: "{{?secretKey}}"
+            accessKey: "{{?accessKey}}"
+            region: "{{region}}"
+            modelId: "{{modelId}}"
+            operation: invokeTextModel
+            useDefaultCredentialsProvider: "{{useDefaultCredentialsProvider}}"
+            uriEndpointOverride: "{{?uriEndpointOverride}}"
+            overrideEndpoint: "{{overrideEndpoint}}"