Claus Ibsen created CAMEL-27733:
-----------------------------------

             Summary: camel-ibm-watsonx-ai: embedding's model ID header 
redirects chat, startup checks, metadata
                 Key: CAMEL-27733
                 URL: https://issues.apache.org/jira/browse/CAMEL-27733
             Project: Camel
          Issue Type: Bug
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while improving the option descriptions of camel-ibm-watsonx-ai for 
CAMEL-23832 (commit 
https://github.com/apache/camel/commit/e2ed564832423dbc5372bc9328432379271590c9).
These are separate problems of the component; the descriptions commit only 
documents the current behavior.

h4. 1. The model ID that embedding returns redirects a later chat
{{EmbeddingHandler}}, {{RerankHandler}}, {{TokenizationHandler}}, 
{{ForecastHandler}} and {{DeploymentHandler.processDeploymentForecast()}} set 
the {{CamelIBMWatsonxAiModelId}} header to the model that answered. 
{{ChatHandler.buildChatRequest()}} reads the same header as the model override 
of chat and chatStreaming.
So a route that calls embedding (or rerank) and then chat on the same exchange, 
the usual RAG flow, sends the chat request to the embedding model, and 
watsonx.ai rejects it or answers with the wrong model.
Proposed change: report the model that answered in a separate header, or have 
the chat operations read the override from a header that no operation sets.

h4. 2. The endpoint checks the baseUrl and the credentials for the operation 
option only
{{WatsonxAiEndpoint.validateConfiguration()}} (called from {{doStart()}}) skips 
the checks for processToolCalls and the baseUrl check for runTool and listTools 
only when the {{operation}} option names them.
An endpoint without the {{operation}} option, whose messages select runTool, 
listTools or processToolCalls with the {{CamelIBMWatsonxAiOperation}} header, 
does not start without a {{baseUrl}} and credentials, although runTool and 
listTools do not use the {{baseUrl}} and processToolCalls uses neither.
Proposed change: check the baseUrl and the credentials when the operation is 
run, or only when the {{operation}} option is set to an operation that needs 
them.

h4. 3. Metadata: timeout has no Duration type, and few headers have a label
The {{timeout}} option is a {{Long}} in milliseconds without {{javaType = 
"java.time.Duration"}}, while {{processingTimeout}} has it; both accept values 
such as {{5s}}.
In {{WatsonxAiConstants}}, 5 headers have {{label = "producer"}} and the other 
75 have none.
Proposed change: add the Duration javaType to {{timeout}}, and give the headers 
the same label (or none).

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to