This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch ibm-watson-nlu in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git
commit f046ba0abaf8a71e7f67a5ceab4a118a7325b4e7 Author: Andrea Cosentino <[email protected]> AuthorDate: Mon Nov 3 14:53:31 2025 +0100 Add IBM Watson Language Sink Kamelet Signed-off-by: Andrea Cosentino <[email protected]> --- docs/modules/ROOT/nav.adoc | 1 + .../ibm-watson-language-sink-description.adoc | 60 ++++++++++ kamelets/ibm-watson-language-sink.kamelet.yaml | 129 +++++++++++++++++++++ .../kamelets/ibm-watson-language-sink.kamelet.yaml | 129 +++++++++++++++++++++ 4 files changed, 319 insertions(+) diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc index 0ad644c1e..6c05f6573 100644 --- a/docs/modules/ROOT/nav.adoc +++ b/docs/modules/ROOT/nav.adoc @@ -109,6 +109,7 @@ * xref:http-source.adoc[] * xref:ibm-cos-sink.adoc[] * xref:ibm-cos-source.adoc[] +* xref:ibm-watson-language-sink.adoc[] * xref:infinispan-sink.adoc[] * xref:infinispan-source.adoc[] * xref:insert-field-action.adoc[] diff --git a/docs/modules/ROOT/partials/ibm-watson-language-sink-description.adoc b/docs/modules/ROOT/partials/ibm-watson-language-sink-description.adoc new file mode 100644 index 000000000..0ae664761 --- /dev/null +++ b/docs/modules/ROOT/partials/ibm-watson-language-sink-description.adoc @@ -0,0 +1,60 @@ +== IBM Watson Natural Language Understanding Sink Kamelet Description + +=== Authentication + +This Kamelet uses IBM Cloud IAM (Identity and Access Management) for authentication. You need to provide: + +- **apiKey**: Your IBM Cloud API key with access to Watson Natural Language Understanding service +- **serviceUrl** (optional): The Watson NLU service endpoint URL for your region + +=== Getting your credentials + +1. Log in to the https://cloud.ibm.com[IBM Cloud Console] +2. Navigate to your Watson Natural Language Understanding service instance +3. Go to **Service credentials** section +4. Create new credentials or use existing ones +5. Copy the **apikey** value + +=== Regional endpoints + +Watson Natural Language Understanding provides different endpoints for different regions: + +- **US South**: `https://api.us-south.natural-language-understanding.watson.cloud.ibm.com` +- **US East**: `https://api.us-east.natural-language-understanding.watson.cloud.ibm.com` +- **EU GB (London)**: `https://api.eu-gb.natural-language-understanding.watson.cloud.ibm.com` +- **EU DE (Frankfurt)**: `https://api.eu-de.natural-language-understanding.watson.cloud.ibm.com` +- **Tokyo**: `https://api.jp-tok.natural-language-understanding.watson.cloud.ibm.com` +- **Sydney**: `https://api.au-syd.natural-language-understanding.watson.cloud.ibm.com` + +If not specified, the kamelet uses the default US South endpoint. + +For more information, see the https://cloud.ibm.com/apidocs/natural-language-understanding[Watson Natural Language Understanding API documentation]. + +=== Analysis features + +Watson NLU can analyze text for: + +- **Sentiment** - Detect positive, negative, or neutral sentiment (enabled by default) +- **Emotions** - Identify joy, anger, sadness, fear, disgust +- **Entities** - Extract people, companies, organizations, cities (enabled by default) +- **Keywords** - Extract important keywords and phrases (enabled by default) +- **Concepts** - Identify high-level concepts not explicitly mentioned +- **Categories** - Classify content into hierarchical categories + +You can enable or disable each feature using the kamelet properties. + +=== Operations + +This kamelet supports two operations: + +- **analyzeText** (default) - Analyze text provided in the message body +- **analyzeUrl** - Analyze content from a URL specified in the `CamelIBMWatsonLanguageUrl` header + +=== Pricing + +Watson Natural Language Understanding offers a free tier: + +- **Lite Plan**: 30,000 NLU items per month (free) +- Additional items are charged per item + +For current pricing details, visit the https://www.ibm.com/cloud/watson-natural-language-understanding/pricing[Watson NLU Pricing page]. diff --git a/kamelets/ibm-watson-language-sink.kamelet.yaml b/kamelets/ibm-watson-language-sink.kamelet.yaml new file mode 100644 index 000000000..6544d4bed --- /dev/null +++ b/kamelets/ibm-watson-language-sink.kamelet.yaml @@ -0,0 +1,129 @@ +# --------------------------------------------------------------------------- +# 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: ibm-watson-language-sink + annotations: + camel.apache.org/kamelet.support.level: "Preview" + camel.apache.org/catalog.version: "4.16.0-SNAPSHOT" + camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjU2IiBoZWlnaHQ9IjI1NiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgPHBhdGggZD0iTTAgMGgyNTZ2MjU2SDB6Ii8+CiAgICA8cGF0aCBkPSJNMTI4IDIwYTEwOCAxMDggMCAxIDEgMCAyMTYgMTA4IDEwOCAwIDAgMSAwLTIxNnptMCAyNGE4NCA4NCAwIDEgMCAwIDE2OCA4NCA4NCAwIDAgMCAwLTE2OHoiIGZpbGw9IiMwNTNFRkYiLz4KICAgIDxwYXRoIGQ9Ik0xMjggNzJhNTYgNTYgMCAxIDEgMCAxMTIgNTYgNTYgMCAwIDEgMC0xMTJ6bTAgMjRhMz [...] + camel.apache.org/provider: "Apache Software Foundation" + camel.apache.org/kamelet.group: "IBM Watson" + camel.apache.org/kamelet.namespace: "IBM" + labels: + camel.apache.org/kamelet.type: "sink" +spec: + definition: + title: "IBM Watson Natural Language Understanding Sink" + description: Analyze text using IBM Watson Natural Language Understanding to extract sentiment, entities, keywords, concepts, categories, and emotions. + required: + - apiKey + type: object + properties: + apiKey: + title: API Key + description: The IBM Cloud API key for Watson Natural Language Understanding. + type: string + format: password + x-descriptors: + - urn:camel:group:credentials + serviceUrl: + title: Service URL + description: The Watson Natural Language Understanding service endpoint URL. If not specified, the default URL will be used. + type: string + example: "https://api.us-south.natural-language-understanding.watson.cloud.ibm.com" + operation: + title: Operation + description: The operation to perform. + type: string + default: analyzeText + enum: + - analyzeText + - analyzeUrl + analyzeSentiment: + title: Analyze Sentiment + description: Enable sentiment analysis to detect positive, negative, or neutral sentiment. + type: boolean + default: true + analyzeEmotion: + title: Analyze Emotion + description: Enable emotion analysis to detect emotions like joy, anger, sadness, fear, and disgust. + type: boolean + default: false + analyzeEntities: + title: Analyze Entities + description: Enable entity extraction to identify people, companies, organizations, cities, and more. + type: boolean + default: true + analyzeKeywords: + title: Analyze Keywords + description: Enable keyword extraction to identify important keywords and phrases. + type: boolean + default: true + analyzeConcepts: + title: Analyze Concepts + description: Enable concept extraction to identify high-level concepts that aren't necessarily mentioned in the text. + type: boolean + default: false + analyzeCategories: + title: Analyze Categories + description: Enable category classification to classify content into a hierarchy of categories. + type: boolean + default: false + dataTypes: + out: + default: watson-analysis + headers: + CamelIBMWatsonLanguageSentimentLabel: + title: Sentiment Label + description: The sentiment label (positive, negative, or neutral). + type: string + CamelIBMWatsonLanguageSentimentScore: + title: Sentiment Score + description: The sentiment score (-1 to 1, where -1 is most negative and 1 is most positive). + type: number + CamelIBMWatsonLanguageLanguage: + title: Detected Language + description: The detected language of the analyzed text. + type: string + types: + watson-analysis: + format: "application-json" + description: Watson Natural Language Understanding analysis results containing sentiment, entities, keywords, concepts, categories, and emotions. + mediaType: application/json + dependencies: + - "camel:core" + - "camel:ibm-watson-language" + - "camel:kamelet" + template: + from: + uri: "kamelet:source" + steps: + - to: + uri: "ibm-watson-language:analyze" + parameters: + apiKey: "RAW({{apiKey}})" + serviceUrl: "{{?serviceUrl}}" + operation: "{{operation}}" + analyzeSentiment: "{{analyzeSentiment}}" + analyzeEmotion: "{{analyzeEmotion}}" + analyzeEntities: "{{analyzeEntities}}" + analyzeKeywords: "{{analyzeKeywords}}" + analyzeConcepts: "{{analyzeConcepts}}" + analyzeCategories: "{{analyzeCategories}}" diff --git a/library/camel-kamelets/src/main/resources/kamelets/ibm-watson-language-sink.kamelet.yaml b/library/camel-kamelets/src/main/resources/kamelets/ibm-watson-language-sink.kamelet.yaml new file mode 100644 index 000000000..6544d4bed --- /dev/null +++ b/library/camel-kamelets/src/main/resources/kamelets/ibm-watson-language-sink.kamelet.yaml @@ -0,0 +1,129 @@ +# --------------------------------------------------------------------------- +# 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: ibm-watson-language-sink + annotations: + camel.apache.org/kamelet.support.level: "Preview" + camel.apache.org/catalog.version: "4.16.0-SNAPSHOT" + camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjU2IiBoZWlnaHQ9IjI1NiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgPHBhdGggZD0iTTAgMGgyNTZ2MjU2SDB6Ii8+CiAgICA8cGF0aCBkPSJNMTI4IDIwYTEwOCAxMDggMCAxIDEgMCAyMTYgMTA4IDEwOCAwIDAgMSAwLTIxNnptMCAyNGE4NCA4NCAwIDEgMCAwIDE2OCA4NCA4NCAwIDAgMCAwLTE2OHoiIGZpbGw9IiMwNTNFRkYiLz4KICAgIDxwYXRoIGQ9Ik0xMjggNzJhNTYgNTYgMCAxIDEgMCAxMTIgNTYgNTYgMCAwIDEgMC0xMTJ6bTAgMjRhMz [...] + camel.apache.org/provider: "Apache Software Foundation" + camel.apache.org/kamelet.group: "IBM Watson" + camel.apache.org/kamelet.namespace: "IBM" + labels: + camel.apache.org/kamelet.type: "sink" +spec: + definition: + title: "IBM Watson Natural Language Understanding Sink" + description: Analyze text using IBM Watson Natural Language Understanding to extract sentiment, entities, keywords, concepts, categories, and emotions. + required: + - apiKey + type: object + properties: + apiKey: + title: API Key + description: The IBM Cloud API key for Watson Natural Language Understanding. + type: string + format: password + x-descriptors: + - urn:camel:group:credentials + serviceUrl: + title: Service URL + description: The Watson Natural Language Understanding service endpoint URL. If not specified, the default URL will be used. + type: string + example: "https://api.us-south.natural-language-understanding.watson.cloud.ibm.com" + operation: + title: Operation + description: The operation to perform. + type: string + default: analyzeText + enum: + - analyzeText + - analyzeUrl + analyzeSentiment: + title: Analyze Sentiment + description: Enable sentiment analysis to detect positive, negative, or neutral sentiment. + type: boolean + default: true + analyzeEmotion: + title: Analyze Emotion + description: Enable emotion analysis to detect emotions like joy, anger, sadness, fear, and disgust. + type: boolean + default: false + analyzeEntities: + title: Analyze Entities + description: Enable entity extraction to identify people, companies, organizations, cities, and more. + type: boolean + default: true + analyzeKeywords: + title: Analyze Keywords + description: Enable keyword extraction to identify important keywords and phrases. + type: boolean + default: true + analyzeConcepts: + title: Analyze Concepts + description: Enable concept extraction to identify high-level concepts that aren't necessarily mentioned in the text. + type: boolean + default: false + analyzeCategories: + title: Analyze Categories + description: Enable category classification to classify content into a hierarchy of categories. + type: boolean + default: false + dataTypes: + out: + default: watson-analysis + headers: + CamelIBMWatsonLanguageSentimentLabel: + title: Sentiment Label + description: The sentiment label (positive, negative, or neutral). + type: string + CamelIBMWatsonLanguageSentimentScore: + title: Sentiment Score + description: The sentiment score (-1 to 1, where -1 is most negative and 1 is most positive). + type: number + CamelIBMWatsonLanguageLanguage: + title: Detected Language + description: The detected language of the analyzed text. + type: string + types: + watson-analysis: + format: "application-json" + description: Watson Natural Language Understanding analysis results containing sentiment, entities, keywords, concepts, categories, and emotions. + mediaType: application/json + dependencies: + - "camel:core" + - "camel:ibm-watson-language" + - "camel:kamelet" + template: + from: + uri: "kamelet:source" + steps: + - to: + uri: "ibm-watson-language:analyze" + parameters: + apiKey: "RAW({{apiKey}})" + serviceUrl: "{{?serviceUrl}}" + operation: "{{operation}}" + analyzeSentiment: "{{analyzeSentiment}}" + analyzeEmotion: "{{analyzeEmotion}}" + analyzeEntities: "{{analyzeEntities}}" + analyzeKeywords: "{{analyzeKeywords}}" + analyzeConcepts: "{{analyzeConcepts}}" + analyzeCategories: "{{analyzeCategories}}"
