Claus Ibsen created CAMEL-26222:
-----------------------------------
Summary: camel-ibm-watsonx-ai - chat uses a List body as
List<ChatMessage> unchecked, and chat, embedding and rerank reject bytes and
streams
Key: CAMEL-26222
URL: https://issues.apache.org/jira/browse/CAMEL-26222
Project: Camel
Issue Type: Bug
Components: camel-ai
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while adding the catalog body types of ibm-watsonx-ai (CAMEL-24961, PR
#28402).
h4. 1. chat, chatStreaming and deploymentChat use a List body as
List<ChatMessage> unchecked
{{AbstractWatsonxAiHandler.getMessages}} (main 2a465aa4814c, line 125) returns
any {{List}} body as {{List<ChatMessage>}}; a {{List<String>}} fails later with
a raw {{ClassCastException}}. Checked on 4.24.0-SNAPSHOT with a JDK HttpServer
stub.
Proposed: check the elements, and convert Strings to user messages or fail with
a clear message.
h4. 2. chat, embedding and rerank accept only a String body, not bytes or
streams
{{getMessages}} (line 121) and {{getInputs}} (line 89) check {{instanceof
String}} without conversion, so a {{byte[]}} or {{InputStream}} body (for
example from platform-http) is not used and the call fails, while
textGeneration ({{getInput}}, line 63) converts with {{getBody(String.class)}}
and accepts them. Checked on 4.24.0-SNAPSHOT with a JDK HttpServer stub.
Proposed: convert a non-List body with {{getBody(String.class)}} as
textGeneration does.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)