Claus Ibsen created CAMEL-26512:
-----------------------------------

             Summary: camel-spring-ai-embeddings - a Map or POJO body is 
embedded as its toString() instead of failing
                 Key: CAMEL-26512
                 URL: https://issues.apache.org/jira/browse/CAMEL-26512
             Project: Camel
          Issue Type: Bug
          Components: camel-spring-ai
            Reporter: Claus Ibsen
             Fix For: 4.24.0


camel-spring-ai-embeddings embeds a Map or POJO body (and a Map or POJO element 
of a List batch body, after CAMEL-26208) as its {{toString()}}, e.g. {{\{a=1, 
b=2\}}}. The vector is then computed from text nobody meant to embed, and the 
result goes silently into a vector store.

The langchain4j components (camel-langchain4j-ingest, 
camel-langchain4j-embeddings and camel-langchain4j-embeddingstore, CAMEL-26206 
/ CAMEL-26205 / CAMEL-26204) now accept only text carriers (text, bytes, 
stream, reader, file, and the langchain4j TextSegment/Document) and fail any 
other body with an {{InvalidPayloadException}} that hints to convert the body 
to text first ({{convertBodyTo(String)}} or marshal to JSON).

Apply the same rule to camel-spring-ai-embeddings, for a single body and for 
each element of a List batch: a body that is not text (or a Spring AI Document) 
fails instead of being embedded as its toString(). Update the @BodyTypes and 
add an upgrade-guide entry, since a Map/POJO body that was embedded before now 
fails.

_Claude Code on behalf of Claus Ibsen (davsclaus)_



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

Reply via email to