This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 7745ca28102 CAMEL-22461 Use the embedding store factory to set an 
EmbeddingStore if the embedding store factory is set (#19339)
7745ca28102 is described below

commit 7745ca28102531b76dc829d1e57a451dfec31aa1
Author: Tom Cunningham <[email protected]>
AuthorDate: Mon Sep 29 01:07:54 2025 -0400

    CAMEL-22461 Use the embedding store factory to set an EmbeddingStore if the 
embedding store factory is set (#19339)
---
 .../embeddingstore/LangChain4jEmbeddingStoreProducer.java        | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git 
a/components/camel-ai/camel-langchain4j-embeddingstore/src/main/java/org/apache/camel/component/langchain4j/embeddingstore/LangChain4jEmbeddingStoreProducer.java
 
b/components/camel-ai/camel-langchain4j-embeddingstore/src/main/java/org/apache/camel/component/langchain4j/embeddingstore/LangChain4jEmbeddingStoreProducer.java
index c361e088808..c2727ec148c 100644
--- 
a/components/camel-ai/camel-langchain4j-embeddingstore/src/main/java/org/apache/camel/component/langchain4j/embeddingstore/LangChain4jEmbeddingStoreProducer.java
+++ 
b/components/camel-ai/camel-langchain4j-embeddingstore/src/main/java/org/apache/camel/component/langchain4j/embeddingstore/LangChain4jEmbeddingStoreProducer.java
@@ -66,6 +66,8 @@ public class LangChain4jEmbeddingStoreProducer extends 
DefaultProducer {
         embeddingStoreFactory = 
getEndpoint().getConfiguration().getEmbeddingStoreFactory();
         if (embeddingStoreFactory != null) {
             
embeddingStoreFactory.setCamelContext(getEndpoint().getCamelContext());
+            EmbeddingStore es = embeddingStoreFactory.createEmbeddingStore();
+            getEndpoint().getConfiguration().setEmbeddingStore(es);
         }
     }
 
@@ -73,13 +75,6 @@ public class LangChain4jEmbeddingStoreProducer extends 
DefaultProducer {
     public void process(Exchange exchange) throws Exception {
         final Message in = exchange.getMessage();
 
-        EmbeddingStore es;
-        if (embeddingStoreFactory != null) {
-            es = embeddingStoreFactory.createEmbeddingStore();
-        } else {
-            es = getEndpoint().getConfiguration().getEmbeddingStore();
-        }
-
         final LangChain4jEmbeddingStoreAction action
                 = in.getHeader(LangChain4jEmbeddingStoreHeaders.ACTION, 
LangChain4jEmbeddingStoreAction.class);
 

Reply via email to