You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "JiriOndrusek (via GitHub)" <gi...@apache.org> on 2026/06/05 12:09:31 UTC

[PR] Fixes #8690: Move langchain4j-agent-ql4j to native mode support [camel-quarkus]

JiriOndrusek opened a new pull request, #8735:
URL: https://github.com/apache/camel-quarkus/pull/8735

     Fixes #8690
   
   Once merged, create a ticket about removal of temporary workaround of **OllamaStreamingSubstitutions**!
   
     **Requires:** https://github.com/quarkiverse/quarkus-langchain4j/issues/2538 (fix for native mode `AiServices.builder()` substitution bypassing CDI context lookup)
     
     Move `langchain4j-agent-ql4j` integration test from JVM-only to native mode support, enabling testing of Camel LangChain4j Agent with Quarkus LangChain4j (QL4J) on the classpath in both JVM and native modes.
     
     ### Changes
   
     **Test module promotion:**
     - Moved `langchain4j-agent-ql4j` from `integration-tests-jvm/` to `integration-tests/`
     - Added `@QuarkusIntegrationTest` class (`Langchain4jAgentQl4jIT`) for native mode
     - Added to `tooling/scripts/test-categories.yaml`
   
     **QL4J coexistence support (`SupportQuarkusLangchain4jProcessor`):**
     - Replaced `markAiServicesAsUnremovable` with `registerQuarkusLangchain4jNativeSupport` — registers
     `QuarkusJsonCodecFactory` inner classes for native reflection
     - Added log message to `enforceJaxRsHttpClient` build step
   
     **Bean scoping (`AgentProducers`):**
     - Changed `RetrievalAugmentor` from `@LookupUnlessProperty` to `@Identifier("ragAugmentor")` to prevent
     QL4J auto-discovery conflicts (same pattern as other producers)
     
     **Native build workaround (`OllamaStreamingSubstitutions`):**
     - Temporary GraalVM substitution for `OllamaStreamingChatLanguageModel.doChat()` to work around a binary   incompatibility between `quarkus-langchain4j-ollama` 1.10.0 (compiled against Mutiny 3.1.x `Context.put(String, Object)`) and Mutiny 3.2.x (`Context.put(Object, Object)`) shipped with Quarkus
     3.36.1
     - Remove once `quarkiverse-langchain4j.version` is updated to a version built with Quarkus 3.36+
    
   
   
   <!-- Uncomment and fill this section if your PR is not trivial
   [ ] An issue should be filed for the change unless this is a trivial change (fixing a typo or similar). One issue should ideally be fixed by not more than one commit and the other way round, each commit should fix just one issue, without pulling in other changes.
   [ ] Each commit in the pull request should have a meaningful and properly spelled subject line and body. Copying the title of the associated issue is typically enough. Please include the issue number in the commit message prefixed by #.
   [ ] The pull request description should explain what the pull request does, how, and why. If the info is available in the associated issue or some other external document, a link is enough.
   [ ] Phrases like Fix #<issueNumber> or Fixes #<issueNumber> will auto-close the named issue upon merging the pull request. Using them is typically a good idea.
   [ ] Please run mvn process-resources -Pformat (and amend the changes if necessary) before sending the pull request.
   [ ] Contributor guide is your good friend: https://camel.apache.org/camel-quarkus/latest/contributor-guide.html
   -->


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fixes #8690: Move langchain4j-agent-ql4j to native mode support [camel-quarkus]

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on code in PR #8735:
URL: https://github.com/apache/camel-quarkus/pull/8735#discussion_r3491698688


##########
integration-tests/langchain4j-agent-ql4j/src/test/java/org/apache/camel/quarkus/component/langchain4j/agent/it/Langchain4jAgentQl4jTestResource.java:
##########
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.langchain4j.agent.it;
+
+public class Langchain4jAgentQl4jTestResource extends Langchain4jAgentTestResource {

Review Comment:
   Nitpick - I wonder if we should just use `Langchain4jAgentTestResource` instead of an empty subclass?



##########
extensions-support/langchain4j/deployment/src/main/java/org/apache/camel/quarkus/component/support/langchain4j/deployment/QuarkusLangchain4jPresent.java:
##########
@@ -21,6 +21,7 @@
 import static org.apache.camel.quarkus.component.support.langchain4j.deployment.SupportQuarkusLangchain4jProcessor.REGISTER_AI_SERVICES_DOTNAME;
 
 public class QuarkusLangchain4jPresent implements BooleanSupplier {
+

Review Comment:
   Remove empty line:
   
   ```suggestion
   ```



##########
extensions-support/langchain4j/deployment/src/main/java/org/apache/camel/quarkus/component/support/langchain4j/deployment/SupportQuarkusLangchain4jProcessor.java:
##########
@@ -24,13 +25,12 @@
 import dev.langchain4j.guardrail.OutputGuardrail;
 import io.quarkus.arc.deployment.SyntheticBeanBuildItem;
 import io.quarkus.arc.deployment.UnremovableBeanBuildItem;
-import io.quarkus.deployment.annotations.BuildProducer;
-import io.quarkus.deployment.annotations.BuildStep;
-import io.quarkus.deployment.annotations.BuildSteps;
-import io.quarkus.deployment.annotations.ExecutionTime;
+import io.quarkus.deployment.annotations.*;

Review Comment:
   Nitpick - can we try to avoid wildcard imports. I think the IntelliJ default is max 5 imports from a package before it gets transformed to '*'. But the setting can be tweaked.



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fixes #8690: Move langchain4j-agent-ql4j to native mode support [camel-quarkus]

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton merged PR #8735:
URL: https://github.com/apache/camel-quarkus/pull/8735


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fixes #8690: Move langchain4j-agent-ql4j to native mode support [camel-quarkus]

Posted by "JiriOndrusek (via GitHub)" <gi...@apache.org>.
JiriOndrusek commented on code in PR #8735:
URL: https://github.com/apache/camel-quarkus/pull/8735#discussion_r3492171775


##########
integration-tests/langchain4j-agent-ql4j/src/test/java/org/apache/camel/quarkus/component/langchain4j/agent/it/Langchain4jAgentQl4jTestResource.java:
##########
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.langchain4j.agent.it;
+
+public class Langchain4jAgentQl4jTestResource extends Langchain4jAgentTestResource {

Review Comment:
   fixed



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fixes #8690: Move langchain4j-agent-ql4j to native mode support [camel-quarkus]

Posted by "JiriOndrusek (via GitHub)" <gi...@apache.org>.
JiriOndrusek commented on code in PR #8735:
URL: https://github.com/apache/camel-quarkus/pull/8735#discussion_r3492170637


##########
extensions-support/langchain4j/deployment/src/main/java/org/apache/camel/quarkus/component/support/langchain4j/deployment/QuarkusLangchain4jPresent.java:
##########
@@ -21,6 +21,7 @@
 import static org.apache.camel.quarkus.component.support.langchain4j.deployment.SupportQuarkusLangchain4jProcessor.REGISTER_AI_SERVICES_DOTNAME;
 
 public class QuarkusLangchain4jPresent implements BooleanSupplier {
+

Review Comment:
   fixed



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fixes #8690: Move langchain4j-agent-ql4j to native mode support [camel-quarkus]

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on PR #8735:
URL: https://github.com/apache/camel-quarkus/pull/8735#issuecomment-4650342024

   This looks to be a good step. But I think we still have a fundamental issue where QL4J augments the Camel AI services with its own memory, rag augmentor etc. That can cause confusion because if you configure a stateless service (`AgentWithoutMemory`), QL4J will silently wire in its own memory impl.
   
   I am thinking to propose adding a new build item to QL4J, which we could use to exclude the `camel-langchain4j-agent` AI services from QL4J build time discovery. That way, they should be able to function as intended.
   


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fixes #8690: Move langchain4j-agent-ql4j to native mode support [camel-quarkus]

Posted by "JiriOndrusek (via GitHub)" <gi...@apache.org>.
JiriOndrusek commented on code in PR #8735:
URL: https://github.com/apache/camel-quarkus/pull/8735#discussion_r3492169418


##########
extensions-support/langchain4j/deployment/src/main/java/org/apache/camel/quarkus/component/support/langchain4j/deployment/SupportQuarkusLangchain4jProcessor.java:
##########
@@ -24,13 +25,12 @@
 import dev.langchain4j.guardrail.OutputGuardrail;
 import io.quarkus.arc.deployment.SyntheticBeanBuildItem;
 import io.quarkus.arc.deployment.UnremovableBeanBuildItem;
-import io.quarkus.deployment.annotations.BuildProducer;
-import io.quarkus.deployment.annotations.BuildStep;
-import io.quarkus.deployment.annotations.BuildSteps;
-import io.quarkus.deployment.annotations.ExecutionTime;
+import io.quarkus.deployment.annotations.*;

Review Comment:
   fixed



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fixes #8690: Move langchain4j-agent-ql4j to native mode support [camel-quarkus]

Posted by "JiriOndrusek (via GitHub)" <gi...@apache.org>.
JiriOndrusek commented on PR #8735:
URL: https://github.com/apache/camel-quarkus/pull/8735#issuecomment-4830728209

   OllamaStreamingSubstitutions is already removed


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org