k-krawczyk commented on PR #30766: URL: https://github.com/apache/camel/pull/30766#issuecomment-7197368596
@davsclaus @oscerd thanks for the reviews. - The rule is now `BodyFacts.isOnlyToString(Object value, String text)` in camel-support, with a test in `BodyFactsTest`. The two embeddings producers call it, and so do watsonx-ai and alibaba-kms: all four private copies are gone. With `ByteArrayOutputStream` counted as a payload (#30773), the special case is gone too. - `LangChain4jEmbeddingsProducer`: a null element of a List body now fails with "the element at index N of the List body is null", without the marshal advice. Test: `batchWithANullElementFails`. - `LangChain4jEmbeddingsBodyTest#numberBodyAndNumberElementAreEmbeddedAsText` covers a number body and a number element. - The `JsonNode` case is noted: the javadoc of `isOnlyToString` says that a real converter whose text equals `toString()` counts as only a `toString()`, and that the way out is `convertBodyTo(String.class)`. - @oscerd, right: a value with no conversion to String at all surfaces `NoTypeConversionAvailableException`. That only happens when even the `toString()` fallback does not apply, so I left it as is. This PR now builds on #30773 (the `BodyFacts.isPayload` change), so please merge that one first; until then the diff here includes its commit. Both branches are rebased on main. Unit tests pass with `-Psourcecheck`: camel-support, the BodyFacts tests of camel-core, spring-ai-embeddings (24), langchain4j-embeddings (30), alibaba-kms (26) and watsonx-ai (49). _Reported by Claude Code on behalf of Karol Krawczyk_ -- 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]
