Andrea Cosentino created CAMEL-26521:
----------------------------------------

             Summary: camel-ibm-watsonx-ai - the text operations send a Map or 
a POJO body to the model as its toString()
                 Key: CAMEL-26521
                 URL: https://issues.apache.org/jira/browse/CAMEL-26521
             Project: Camel
          Issue Type: Improvement
          Components: camel-ai
            Reporter: Andrea Cosentino


Follow-up of CAMEL-26222 ([PR 
#28971|https://github.com/apache/camel/pull/28971]).

The operations that read the message body as text (textGeneration, 
textGenerationStreaming, chat, chatStreaming, deploymentGenerate, 
deploymentChat, tokenize, detect, embedding, rerank) convert a body that is not 
text with {{getBody(String.class)}}, so a Map or a POJO reaches the model as 
its {{toString()}}, for example {{\{a=b\}}}. The catalog body types document 
this.

Proposed: fail with a clear {{IllegalArgumentException}} for a Map or a POJO 
body, saying to marshal it first (for example with {{marshal().json()}}) or to 
give the text. Keep text, bytes, streams and files, the List bodies of chat, 
embedding and rerank, and a {{ChatMessage}} body for chat as they are. This 
needs an upgrade-guide entry, since such a body now fails where it used to be 
sent.

_Claude Code on behalf of Andrea Cosentino (oscerd)_



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

Reply via email to