jiriOndrusek-agent commented on code in PR #9229:
URL: https://github.com/apache/camel-quarkus/pull/9229#discussion_r4083928748


##########
extensions/langchain4j-embeddingstore/runtime/src/main/java/org/apache/camel/quarkus/component/langchain4j/embeddingstore/Langchain4jEmbeddingstoreRecorder.java:
##########
@@ -83,4 +84,24 @@ public Supplier<RetrievalAugmentor> 
createRetrievalAugmentorSupplier(
             String embeddingStoreName, String embeddingModelName, String 
augmentorName) {
         return new DefaultRetrievalAugmentorSupplier(embeddingStoreName, 
embeddingModelName, augmentorName);
     }
+
+    /**
+     * The auto-produced default augmentor resolves the {@code @Default} store 
and model on first use. The
+     * build detected at least one bean of each type, but a bean it detected 
may be named rather than default,
+     * which would fail that late; so the beans are verified at startup, once 
the synthetic ones exist.
+     */
+    public void verifyDefaultRetrievalAugmentorBeans() {
+        boolean store = 
Arc.container().instance(EMBEDDING_STORE_TYPE).isAvailable();
+        boolean model = 
Arc.container().instance(EmbeddingModel.class).isAvailable();
+        if (store && model) {
+            return;
+        }
+        throw new IllegalStateException("The default RetrievalAugmentor was 
produced because an EmbeddingStore and"

Review Comment:
   Fixed in f2a3bd1 along the lines you suggested, both options:
   
   - The discovered-bean census now counts only beans carrying `@Default`, like 
the announced side already did, so a class-based `@EmbeddingStoreName`-only 
store no longer registers the default augmentor. `@Named` beans keep their 
implicit `@Default`, so the rag-bridge IT's named default store still counts.
   - The startup check warns instead of throwing, since a Quarkus LangChain4j 
named-only store cannot be told apart at build time and an application that 
never uses the augmentor must keep starting. The warning names the 
`quarkus.camel.langchain4j.rag.augmentors.<name>.embedding-store-name` 
configuration.
   
   The migration guide now covers the class-based `@EmbeddingStoreName` case as 
well. Verified locally with two throwaway deployment tests (class-based 
named-only store: no augmentor; pgvector-style named-only store: starts, 
warning logged once), the rag-bridge IT and the `langchain4j-ingest-rag` 
example.
   
   _Claude Code on behalf of @JiriOndrusek_
   



##########
extensions/langchain4j-embeddingstore/runtime/src/main/java/org/apache/camel/quarkus/component/langchain4j/embeddingstore/Langchain4jEmbeddingstoreRecorder.java:
##########
@@ -83,4 +84,24 @@ public Supplier<RetrievalAugmentor> 
createRetrievalAugmentorSupplier(
             String embeddingStoreName, String embeddingModelName, String 
augmentorName) {
         return new DefaultRetrievalAugmentorSupplier(embeddingStoreName, 
embeddingModelName, augmentorName);
     }
+
+    /**
+     * The auto-produced default augmentor resolves the {@code @Default} store 
and model on first use. The
+     * build detected at least one bean of each type, but a bean it detected 
may be named rather than default,
+     * which would fail that late; so the beans are verified at startup, once 
the synthetic ones exist.
+     */
+    public void verifyDefaultRetrievalAugmentorBeans() {

Review Comment:
   Right, thanks. Fixed in f2a3bd1: the check resolves through 
`Arc.container().select(...).isResolvable()`, which does not create the bean, 
so `@Singleton` stores and models are no longer built at startup and no 
`@Dependent` instance or handle is left behind.
   
   _Claude Code on behalf of @JiriOndrusek_
   



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