Claus Ibsen created CAMEL-26208:
-----------------------------------

             Summary: camel-spring-ai-embeddings - a List of one text returns a 
float[] instead of a List, and a List of non-Strings is not checked
                 Key: CAMEL-26208
                 URL: https://issues.apache.org/jira/browse/CAMEL-26208
             Project: Camel
          Issue Type: Bug
          Components: camel-spring-ai
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while adding the catalog body types of spring-ai-embeddings (CAMEL-24961, 
PR #28401).

h4. 1. A List of one text returns float[] instead of a List

{{SpringAiEmbeddingsProducer}} (main 2a465aa4814c, lines 68-70) sets the body 
to a single {{float[]}} whenever there is one input text, also when the body 
was a {{List}} of one element; a List of two texts gives a {{List<float[]>}} 
(line 83). The output shape depends on the list size, so a split or aggregate 
route breaks on lists of one. Checked on 4.24.0-SNAPSHOT with a fake 
{{EmbeddingModel}}.

Proposed: return a {{List<float[]>}} whenever the body was a List.

h4. 2. A List of non-Strings is passed on unchecked

Line 51 casts a {{List}} body to {{List<String>}} without checking the 
elements, so a List of POJOs or Maps fails later with a {{ClassCastException}} 
inside Spring AI. Checked on 4.24.0-SNAPSHOT with a fake {{EmbeddingModel}}.

Proposed: convert each element to String (or fail with a clear message).

_Claude Code on behalf of davsclaus_



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

Reply via email to