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

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


The following commit(s) were added to refs/heads/camel-main by this push:
     new 9861a626e3 Fixed langchain4j (requires CAMEL-20863)
9861a626e3 is described below

commit 9861a626e3550f26a82920611f62ccb4f39b073a
Author: JiriOndrusek <ondrusek.j...@gmail.com>
AuthorDate: Tue Jun 11 14:05:27 2024 +0200

    Fixed langchain4j (requires CAMEL-20863)
---
 .../component/langchain/chat/it/OllamaRoute.java   | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git 
a/integration-tests/langchain4j-chat/src/main/java/org/apache/camel/quarkus/component/langchain/chat/it/OllamaRoute.java
 
b/integration-tests/langchain4j-chat/src/main/java/org/apache/camel/quarkus/component/langchain/chat/it/OllamaRoute.java
index c87d2cffe8..47d9c68c40 100644
--- 
a/integration-tests/langchain4j-chat/src/main/java/org/apache/camel/quarkus/component/langchain/chat/it/OllamaRoute.java
+++ 
b/integration-tests/langchain4j-chat/src/main/java/org/apache/camel/quarkus/component/langchain/chat/it/OllamaRoute.java
@@ -16,11 +16,22 @@
  */
 package org.apache.camel.quarkus.component.langchain.chat.it;
 
+import dev.langchain4j.model.chat.ChatLanguageModel;
+import io.quarkiverse.langchain4j.ollama.OllamaChatLanguageModel;
+import io.quarkiverse.langchain4j.ollama.Options;
 import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.enterprise.inject.Produces;
 import org.apache.camel.builder.RouteBuilder;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
+
+import static java.time.Duration.ofSeconds;
 
 @ApplicationScoped
 public class OllamaRoute extends RouteBuilder {
+
+    @ConfigProperty(name = "quarkus.langchain4j.ollama.base-url")
+    private String ollamaUrl;
+
     @Override
     public void configure() throws Exception {
         from("direct:send-simple-message?timeout=30000")
@@ -35,4 +46,15 @@ public class OllamaRoute extends RouteBuilder {
                 
.to("langchain4j-chat:test3?chatOperation=CHAT_MULTIPLE_MESSAGES")
                 .to("mock:multipleMessageResponse");
     }
+
+    //model reflects the values in wire-mocked response
+    @Produces
+    public ChatLanguageModel produceModel() {
+        return OllamaChatLanguageModel.builder()
+                
.options(Options.builder().temperature(0.3).topK(40).topP(0.9).build())
+                .model("orca-mini")
+                .baseUrl(ollamaUrl)
+                .timeout(ofSeconds(3000))
+                .build();
+    }
 }

Reply via email to