gnodet opened a new pull request, #25273:
URL: https://github.com/apache/camel/pull/25273

   ## Summary
   
   _Claude Code on behalf of gnodet_
   
   Add batch operation support to `camel-langchain4j-embeddings` and 
`camel-langchain4j-embeddingstore` components, wiring the upstream langchain4j 
`embedAll`, `addAll`, and `removeAll` API variants that were previously 
unreachable.
   
   ### Changes
   
   **`camel-langchain4j-embeddings`:**
   - `LangChain4jEmbeddingsProducer`: detect `List` body and dispatch to 
`EmbeddingModel.embedAll(List<TextSegment>)` — returns `List<Embedding>` as 
body and via `CamelLangChain4jEmbeddingsEmbeddings` header
   - New `EMBEDDINGS` header constant for batch results
   - Backward compatible: single `String`/`TextSegment` body continues to work 
exactly as before
   
   **`camel-langchain4j-embeddingstore`:**
   - **ADD batch**: when `CamelLangChain4jEmbeddingsEmbeddings` header contains 
`List<Embedding>`, calls `addAll()` variants (with optional text segments and 
caller-supplied IDs)
   - **ADD with caller-supplied ID**: new 
`CamelLangchain4jEmbeddingStoreEmbeddingId` header for `add(id, embedding)`
   - **REMOVE by ID list**: `Collection<String>` body calls 
`removeAll(Collection<String>)`
   - **REMOVE by filter**: reuses existing 
`CamelLangchain4jEmbeddingStoreFilter` header for `removeAll(Filter)`
   - **REMOVE all (clear store)**: null/empty body with no filter calls 
`removeAll()`
   - Backward compatible: single embedding ADD and single ID REMOVE still work 
as before
   
   **Tests:** 11 new unit tests covering all batch paths + all existing tests 
continue to pass
   
   **Documentation:** Updated both component `.adoc` docs with examples for 
batch operations
   
   ### Motivation
   
   RAG ingestion pipelines that process many text segments were forced to call 
the component once per segment, making ingestion needlessly slow and chatty. 
The upstream langchain4j API has supported batch operations (`embedAll`, 
`addAll`, `removeAll`) but they were not exposed through the Camel component.
   
   Resolves: [CAMEL-23953](https://issues.apache.org/jira/browse/CAMEL-23953)
   
   ## Test plan
   
   - [x] `LangChain4jEmbeddingsBatchTest` — 3 tests: batch embedAll with string 
list, single body backward compat, token usage headers
   - [x] `LangChain4jEmbeddingStoreBatchOperationsTest` — 8 tests: 
caller-supplied ID, batch addAll (3 variants), removeAll by IDs, removeAll by 
filter, removeAll clear, single remove backward compat
   - [x] Existing tests pass: `LangChain4jEmbeddingsComponentTest` (1 test), 
`LangChain4jEmbeddingStoreMissingEmbeddingHeaderTest` (7 tests)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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]

Reply via email to