gnodet-bot commented on code in PR #30256:
URL: https://github.com/apache/camel/pull/30256#discussion_r4596516382


##########
components/camel-ibm/camel-ibm-watsonx-ai/src/main/docs/ibm-watsonx-ai-component.adoc:
##########
@@ -208,6 +208,22 @@ NOTE: Document processing operations require Cloud Object 
Storage (COS) configur
 
 If you don't specify an operation explicitly, you must set it via the 
`operation` parameter.
 
+=== Message body read as text
+
+Many operations read the message body as text: the prompt of `textGeneration`, 
`tokenize`, `detect` and
+`deploymentGenerate`, the user message of the chat operations, the texts of 
`embedding` and `rerank`, and the file

Review Comment:
   nit: `textGenerationStreaming` is listed in the upgrade guide as one of the 
operations that reads the body as text, but it's missing here.
   
   ```suggestion
   Many operations read the message body as text: the prompt of 
`textGeneration`, `textGenerationStreaming`, `tokenize`, `detect` and
   `deploymentGenerate`, the user message of the chat operations, the texts of 
`embedding` and `rerank`, and the file
   ```



##########
components/camel-ibm/camel-ibm-watsonx-ai/src/main/java/org/apache/camel/component/ibm/watsonx/ai/handler/AbstractWatsonxAiHandler.java:
##########
@@ -184,6 +192,52 @@ private static List<ChatMessage> toChatMessages(List<?> 
list, String source) {
         return messages;
     }
 
+    /**
+     * The body as the text an operation reads, whether it sends it to the 
model or uses it as a file path or a request
+     * id: text, bytes, a stream or a file is read as it is, and so is any 
other body Camel converts to its text, such
+     * as a {@code char[]} or a {@code ByteBuffer}. A Map or a POJO fails 
instead, since Camel has no conversion for it
+     * other than its {@code toString()}, so the model would be asked about a 
map written in Java notation, or the
+     * request would name such a map as its file (CAMEL-26521).
+     *
+     * @param what the input in the words of the operation, such as "the 
prompt", for the error message of a body that
+     *             is not text
+     */

Review Comment:
   nit: Javadoc covers `@param what` but omits `@param in` and `@return`.
   
   ```suggestion
        * @param in   the inbound message whose body to read
        * @param what the input in the words of the operation, such as "the 
prompt", for the error message of a body that
        *             is not text
        * @return the body as text, or {@code null} when the body is null or 
Camel has no conversion to text
        */
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to