[ 
https://issues.apache.org/jira/browse/CAMEL-26204?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-26204.
---------------------------------
    Resolution: Fixed

Fixed by https://github.com/apache/camel/pull/29029 (merged to main as 
ffc272852e6ffe508c3e82b0f44328a1b1a77910).

_Claude Code on behalf of Claus Ibsen (davsclaus)_

> camel-langchain4j-embeddingstore - auto-embedding stores the TextSegment 
> toString and embeds a List as one text, and REMOVE accepts any body as an id
> -----------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-26204
>                 URL: https://issues.apache.org/jira/browse/CAMEL-26204
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-langchain4j
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.24.0
>
>
> Found while adding the catalog body types of langchain4j-embeddingstore 
> (CAMEL-24961, PR #28401).
> h4. 1. Auto-embedding a TextSegment body stores its toString
> With an {{embeddingModel}} and no embedding header, 
> {{LangChain4jEmbeddingStoreProducer.resolveEmbedding}} (main 2a465aa4814c, 
> line 353) reads the body with {{getBody(String.class)}}. A {{TextSegment}} 
> body becomes its {{toString()}} (it starts with {{TextSegment \{ text =}}), 
> and that text is embedded and stored instead of the segment text and 
> metadata. Checked on 4.24.0-SNAPSHOT with AllMiniLmL6V2 and an 
> {{InMemoryEmbeddingStore}}.
> Proposed: when the body is a {{TextSegment}}, embed and store it as is.
> h4. 2. A List of Strings is embedded as one text
> The same code (line 353) turns a {{List<String>}} body into one text such as 
> {{\[a, b\]}}, which is embedded and stored as a single entry. Checked on 
> 4.24.0-SNAPSHOT with AllMiniLmL6V2 and an {{InMemoryEmbeddingStore}}.
> Proposed: embed a List of Strings or TextSegments as a batch (as with the 
> EMBEDDINGS header in {{addBatch}}), or fail with a clear message.
> h4. 3. REMOVE with a Map or an Integer body silently removes a made-up id
> {{remove}} (line 266) converts any body that is not a Collection with 
> {{getBody(String.class)}}, so a Map body removes the id made of the Map's 
> {{toString()}} and an Integer {{42}} removes the id {{"42"}}; nothing fails 
> and nothing is removed. Checked on 4.24.0-SNAPSHOT with an 
> {{InMemoryEmbeddingStore}}.
> Proposed: accept only a String (or a Collection of Strings) as the id and 
> fail for other body types.
> _Claude Code on behalf of davsclaus_



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

Reply via email to