IBM watsonx.ai
Generate text, chat, embed, rerank and tokenize text, extract and classify documents, detect harmful content and forecast time series with the foundation models and deployments of IBM watsonx.ai.
What’s inside
-
IBM watsonx.ai component, URI syntax:
ibm-watsonx-ai:label
Please refer to the above links for usage and configuration details.
Maven coordinates
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-ibm-watsonx-ai-starter</artifactId>
</dependency> Spring Boot Auto-Configuration
The starter supports 72 options, which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
camel.component.ibm-watsonx-ai.api-key | The IBM Cloud API key, exchanged at IBM Cloud IAM for an access token that is sent to watsonx.ai. Required unless oauthProfile or authenticator is set, or the operation is processToolCalls, which runs locally; when several are set, authenticator is used first, then oauthProfile. | String | |
camel.component.ibm-watsonx-ai.authenticator | A custom authenticator of the watsonx.ai SDK (com.ibm.watsonx.ai.core.auth.Authenticator) that gives the token of every request, such as a CP4DAuthenticator for watsonx.ai software on Cloud Pak for Data. When set, apiKey and oauthProfile are not used. The option is a com.ibm.watsonx.ai.core.auth.Authenticator type. | Authenticator | |
camel.component.ibm-watsonx-ai.auto-rotation-correction | Whether text extraction and classification correct the rotation of the pages | Boolean | |
camel.component.ibm-watsonx-ai.autowired-enabled | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | Boolean |
camel.component.ibm-watsonx-ai.base-url | The watsonx.ai API URL of the region, such as https://us-south.ml.cloud.ibm.com or https://eu-de.ml.cloud.ibm.com. The endpoint does not start without it, unless its operation is runTool or listTools, which call the wxUrl instead, or processToolCalls, which runs locally. | String | |
camel.component.ibm-watsonx-ai.classification-mode | How text classification classifies: exact (the document type) or binary (whether it is one) | String | |
camel.component.ibm-watsonx-ai.configuration | The configuration that the endpoints share. Each endpoint starts from a copy of it, and its URI options override the copied values. The option is a org.apache.camel.component.ibm.watsonx.ai.WatsonxAiConfiguration type. | WatsonxAiConfiguration | |
camel.component.ibm-watsonx-ai.cos-url | The endpoint URL of the IBM Cloud Object Storage region of the document and result buckets, such as https://s3.us-south.cloud-object-storage.appdomain.cloud. Required for text extraction and text classification. | String | |
camel.component.ibm-watsonx-ai.deployment-id | The ID of the deployment of deploymentInfo, deploymentGenerate, deploymentChat and deploymentForecast. The CamelIBMWatsonxAiDeploymentId header overrides it; when neither is set, these operations fail. | String | |
camel.component.ibm-watsonx-ai.detect-hap | Whether detect looks for hate, abuse and profanity (HAP), when neither the detectors option nor the CamelIBMWatsonxAiDetectors header is set. When neither detectPii nor detectHap is set, detect uses both detectors. | Boolean | |
camel.component.ibm-watsonx-ai.detect-pii | Whether detect looks for personal identifiable information (PII), when neither the detectors option nor the CamelIBMWatsonxAiDetectors header is set. When neither detectPii nor detectHap is set, detect uses both detectors. | Boolean | |
camel.component.ibm-watsonx-ai.detection-threshold | The threshold (0 to 1) of the detectors of detect, detectContext and detectGenerated, but the PII detector, which takes none. The defaults of watsonx.ai apply when not set. | Double | |
camel.component.ibm-watsonx-ai.detectors | The detectors, comma separated, in the place of detectPii and detectHap: hap, pii and granite_guardian for detect, context_relevance and faithfulness for detectContext (default context_relevance), answer_relevance for detectGenerated (default answer_relevance). The detectionThreshold applies to all but pii | String | |
camel.component.ibm-watsonx-ai.document-bucket | The Cloud Object Storage bucket of the documents of text extraction and text classification: the upload operations upload into it, and the operations with a file path read the document from it. Required for these operations. | String | |
camel.component.ibm-watsonx-ai.document-connection-id | The ID of the connection asset, in the project or space, that gives watsonx.ai access to the documentBucket. Required for text extraction and text classification. | String | |
camel.component.ibm-watsonx-ai.document-languages | The languages of the documents of text extraction and classification, comma separated ISO 639 codes, such as en,fr | String | |
camel.component.ibm-watsonx-ai.embedded-images | What text extraction does with the images of the document | String | |
camel.component.ibm-watsonx-ai.enabled | Whether to enable auto configuration of the ibm-watsonx-ai component. This is enabled by default. | Boolean | |
camel.component.ibm-watsonx-ai.extraction-mode | The quality of text extraction: standard or high_quality | String | |
camel.component.ibm-watsonx-ai.extraction-outputs | The outputs of text extraction, comma separated: md (the default), json, html, plain_text, page_images. The operations that return the text (AndFetch) take one output, but page_images | String | |
camel.component.ibm-watsonx-ai.frequency-penalty | The penalty of chat for tokens in proportion to how often they already appear, from -2 to 2: positive values make the answer repeat itself less. There is no header for it. | Double | |
camel.component.ibm-watsonx-ai.governance-instance-id | The watsonx.governance instance that runs the detectors of detectContext and detectGenerated (and of detect, in the place of the project or space), which IBM Cloud requires for them | String | |
camel.component.ibm-watsonx-ai.guided-choice | Guided decoding of chat: the answer is one of these comma separated choices | String | |
camel.component.ibm-watsonx-ai.guided-grammar | Guided decoding of chat: the answer follows this context free grammar (EBNF) | String | |
camel.component.ibm-watsonx-ai.guided-regex | Guided decoding of chat: the answer matches this regular expression | String | |
camel.component.ibm-watsonx-ai.include-reasoning | Whether watsonx.ai returns the reasoning of the model, in the CamelIBMWatsonxAiReasoningContent header | Boolean | |
camel.component.ibm-watsonx-ai.json-schema | A JSON schema (as JSON text) that the chat answer follows (the json_schema response format) | String | |
camel.component.ibm-watsonx-ai.json-schema-strict | Whether the chat answer must follow the jsonSchema strictly | true | Boolean |
camel.component.ibm-watsonx-ai.kvp-mode | The key-value pair extraction of text extraction: disabled, invoice, ubill or generic_with_semantic. When not set, text extraction extracts no key-value pairs. | String | |
camel.component.ibm-watsonx-ai.lazy-start-producer | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | Boolean |
camel.component.ibm-watsonx-ai.log-requests | Whether to log HTTP requests to the watsonx.ai API | false | Boolean |
camel.component.ibm-watsonx-ai.log-responses | Whether to log HTTP responses from the watsonx.ai API | false | Boolean |
camel.component.ibm-watsonx-ai.max-completion-tokens | The maximum number of tokens of the answer of chat, chatStreaming and deploymentChat. The CamelIBMWatsonxAiMaxNewTokens header overrides it. | Integer | |
camel.component.ibm-watsonx-ai.max-new-tokens | The maximum number of tokens that textGeneration, textGenerationStreaming and deploymentGenerate generate. Chat uses maxCompletionTokens instead. The CamelIBMWatsonxAiMaxNewTokens header overrides it. | Integer | |
camel.component.ibm-watsonx-ai.model-id | The ID of the foundation model, such as ibm/granite-4-h-small, of textGeneration, chat, embedding, rerank, tokenize, forecast and their streaming variants. The CamelIBMWatsonxAiModelId header overrides it for chat and chatStreaming. The deployment operations use the model of the deployment instead. | String | |
camel.component.ibm-watsonx-ai.moderation-granite-guardian | Chat guardrail: whether watsonx.ai checks the input with Granite Guardian (watsonx.ai applies it to the input only) | Boolean | |
camel.component.ibm-watsonx-ai.moderation-hap | Chat guardrail: whether watsonx.ai checks the input and the answer for hate, abuse and profanity (HAP) | Boolean | |
camel.component.ibm-watsonx-ai.moderation-pii | Chat guardrail: whether watsonx.ai checks the input and the answer for personal identifiable information (PII) | Boolean | |
camel.component.ibm-watsonx-ai.moderation-threshold | The threshold (0 to 1) of the HAP and Granite Guardian chat guardrails | Float | |
camel.component.ibm-watsonx-ai.number-of-choices | How many answers chat generates for the request (n). The body is the first one, and the CamelIBMWatsonxAiAssistantMessages header has them all | Integer | |
camel.component.ibm-watsonx-ai.oauth-profile | OAuth profile name for obtaining an access token via the OAuth 2.0 Client Credentials grant. When set, the token of the configured identity provider is sent to watsonx.ai as a Bearer token instead of an IBM Cloud API key, and obtained again when it expires. Requires camel-oauth on the classpath. | String | |
camel.component.ibm-watsonx-ai.ocr-mode | The optical character recognition of text extraction and classification: auto, disabled, enabled or forced | String | |
camel.component.ibm-watsonx-ai.operation | The operation to perform. The CamelIBMWatsonxAiOperation header overrides it; when neither is set, the exchange fails. | WatsonxAiOperations | |
camel.component.ibm-watsonx-ai.output-dpi | The resolution, in dots per inch, of the images that text extraction outputs. | Integer | |
camel.component.ibm-watsonx-ai.output-tokens | Whether text extraction gives the tokens of the text, with their positions | Boolean | |
camel.component.ibm-watsonx-ai.prediction-length | The number of time steps to forecast (forecast and deploymentForecast). The model forecasts its own default length when not set | Integer | |
camel.component.ibm-watsonx-ai.presence-penalty | The penalty of chat for any token that already appeared, from -2 to 2: positive values make the model move on to new topics. There is no header for it. | Double | |
camel.component.ibm-watsonx-ai.processing-timeout | How long the text extraction and classification operations that wait (AndFetch) wait for the result, in milliseconds. Defaults to the timeout of the endpoint. The option is a java.lang.Long type. | Long | |
camel.component.ibm-watsonx-ai.project-id | The ID of the watsonx.ai project in which the operations of foundation models (textGeneration, chat, embedding, rerank, tokenize, forecast and their streaming variants), detection, text extraction and text classification run. Set projectId or spaceId. deploymentInfo looks the deployment up in this project when no space ID is set. | String | |
camel.component.ibm-watsonx-ai.reasoning-effort | How much the model of chat reasons: low, medium or high, for the models that support it | String | |
camel.component.ibm-watsonx-ai.remove-output-file | Whether the text extraction operations that wait (AndFetch) remove the output file from Cloud Object Storage once read (asynchronously) | Boolean | |
camel.component.ibm-watsonx-ai.remove-uploaded-file | Whether the operations that upload and wait (UploadAndFetch) remove the uploaded document from Cloud Object Storage once the result is read (asynchronously) | Boolean | |
camel.component.ibm-watsonx-ai.repetition-penalty | The penalty of text generation for repeating tokens it already generated: 1 means no penalty, and higher values repeat less. Chat does not use it (see frequencyPenalty). The CamelIBMWatsonxAiRepetitionPenalty header overrides it. | Double | |
camel.component.ibm-watsonx-ai.rerank-top-n | The number of best ranked inputs that rerank returns. The CamelIBMWatsonxAiRerankTopN header overrides it. | Integer | |
camel.component.ibm-watsonx-ai.response-format | The format of the chat answer: text, or json for a JSON object. Set jsonSchema for an answer that follows a JSON schema | String | |
camel.component.ibm-watsonx-ai.result-bucket | The Cloud Object Storage bucket where text extraction writes its output files, which textExtractionReadFile and textExtractionDeleteFile read and delete unless the CamelIBMWatsonxAiBucketName header names another bucket. Required for text extraction. | String | |
camel.component.ibm-watsonx-ai.result-connection-id | The ID of the connection asset, in the project or space, that gives watsonx.ai access to the resultBucket. Required for text extraction. | String | |
camel.component.ibm-watsonx-ai.return-documents | Whether each result of rerank includes its input text, besides its index and score. | Boolean | |
camel.component.ibm-watsonx-ai.seed | The random seed of chat sampling, for repeatable answers | Integer | |
camel.component.ibm-watsonx-ai.space-id | The ID of the deployment space, in the place of projectId, in which the same operations run. deploymentInfo looks the deployment up in this space; there the CamelIBMWatsonxAiSpaceId header overrides it. | String | |
camel.component.ibm-watsonx-ai.stop | Comma separated sequences that stop the generation of the chat answer | String | |
camel.component.ibm-watsonx-ai.stream-endpoint | The endpoint URI, such as seda:chunks, that receives each chunk of textGenerationStreaming and chatStreaming as a message when the CamelIBMWatsonxAiStreamConsumer header is not set. The chunks are sent from the threads of the watsonx.ai SDK, with the exchange ID of the streaming exchange in the CamelCorrelationId header. | String | |
camel.component.ibm-watsonx-ai.temperature | The sampling temperature of text generation and chat (the streaming and deployment operations included), from 0 to 2: higher values give more random text. The CamelIBMWatsonxAiTemperature header overrides it. | Double | |
camel.component.ibm-watsonx-ai.thinking | Whether the model of chat reasons before it answers, for the models that support it (chat template thinking) | Boolean | |
camel.component.ibm-watsonx-ai.thinking-tags | For models that write their reasoning in the answer between tags: the tag of the reasoning, and optionally the tag of the answer after a comma, such as think,response. The reasoning goes to the CamelIBMWatsonxAiReasoningContent header and the answer to the body | String | |
camel.component.ibm-watsonx-ai.timeout | The timeout of each HTTP request to watsonx.ai and to IBM Cloud IAM, in milliseconds; the watsonx.ai SDK uses 60 seconds when not set. The streaming operations wait for the end of the stream at most this timeout and 30 seconds more. | Long | |
camel.component.ibm-watsonx-ai.tool-choice | How the model chooses the tools of chat: auto (the model decides), required (the model must call a tool), none (the model must not call a tool), or the name of the tool the model must call | String | |
camel.component.ibm-watsonx-ai.top-k | The top-k sampling of text generation: the model picks the next token from this number of most likely tokens. Chat does not use it. The CamelIBMWatsonxAiTopK header overrides it. | Integer | |
camel.component.ibm-watsonx-ai.top-p | The nucleus sampling of text generation and chat: the model picks the next token from the most likely tokens whose probabilities add up to this value (0 to 1). The CamelIBMWatsonxAiTopP header overrides it. | Double | |
camel.component.ibm-watsonx-ai.truncate-input-tokens | The maximum number of tokens of each input text of embedding: a longer input is truncated from the end, so that the request does not fail. | Integer | |
camel.component.ibm-watsonx-ai.verify-ssl | Whether the watsonx.ai SDK verifies the TLS certificates of watsonx.ai, IBM Cloud IAM and Cloud Object Storage. Set it to false only for testing, as the connections then accept any certificate. | true | Boolean |
camel.component.ibm-watsonx-ai.wx-url | The watsonx.ai platform (WX) API URL of the region, such as https://api.dataplatform.cloud.ibm.com/wx or https://api.eu-de.dataplatform.cloud.ibm.com/wx, which runTool and listTools call. Required for these two operations. | String |