Claus Ibsen created CAMEL-26553:
-----------------------------------

             Summary: camel-spring-ai-embeddings and 
camel-langchain4j-embeddings - embed bodies that have a real converter to 
String, such as char[] and ByteBuf
                 Key: CAMEL-26553
                 URL: https://issues.apache.org/jira/browse/CAMEL-26553
             Project: Camel
          Issue Type: Improvement
            Reporter: Claus Ibsen


Found in the review of CAMEL-26512 (PR #29108).

camel-spring-ai-embeddings (with CAMEL-26512) and camel-langchain4j-embeddings 
({{LangChain4jEmbeddingsProducer.isReadableAsText}}) only embed a body of a 
fixed list of text types, and fail other bodies. Bodies that have a real 
converter to String fail too, while before CAMEL-26512 spring-ai embedded them:
* {{char[]}}
* a Netty {{ByteBuf}} (netty-http with {{disableStreamCache=true}})
* a custom type with its own converter to String
* a List with such an element

Asking the type converter does not tell them apart from a Map or POJO: after 
one fallback conversion, {{lookup(String.class, X.class)}} returns the promoted 
{{ToStringTypeConverter}}. {{BodyFacts.kindOf}} does not help either (ByteBuf 
is DATA, char[] is COLLECTION, Integer is PAYLOAD).

Today the workaround is {{convertBodyTo(String.class)}} before the endpoint (in 
the 4.24 upgrade guide). Proposed: widen the accepted types in both components 
the same way, e.g. CharSequence, char[], and bodies whose converter to String 
is not the toString fallback.

_Claude Code on behalf of Claus Ibsen (davsclaus)_



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

Reply via email to