This is an automated email from the ASF dual-hosted git repository. jamesnetherton pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/main by this push: new 803e966451 Upgarde quarkus-langchain4j to 0.16.4 803e966451 is described below commit 803e96645110ac555bec08e96d6723521c5487bf Author: James Netherton <jamesnether...@gmail.com> AuthorDate: Mon Jul 22 10:34:10 2024 +0100 Upgarde quarkus-langchain4j to 0.16.4 Fixes #6278 --- .../component/langchain/chat/it/LangChain4jChatResource.java | 5 +++-- .../src/main/resources/application.properties | 5 +++++ .../src/test/resources/mappings/multipleMessages.json | 10 +++++----- .../src/test/resources/mappings/promptMessage.json | 12 ++++++------ .../src/test/resources/mappings/simpleMessage.json | 12 ++++++------ pom.xml | 2 +- poms/bom/src/main/generated/flattened-full-pom.xml | 4 ++-- poms/bom/src/main/generated/flattened-reduced-pom.xml | 4 ++-- .../bom/src/main/generated/flattened-reduced-verbose-pom.xml | 4 ++-- 9 files changed, 32 insertions(+), 26 deletions(-) diff --git a/integration-tests/langchain4j-chat/src/main/java/org/apache/camel/quarkus/component/langchain/chat/it/LangChain4jChatResource.java b/integration-tests/langchain4j-chat/src/main/java/org/apache/camel/quarkus/component/langchain/chat/it/LangChain4jChatResource.java index d62a03dd6c..f25eb31178 100644 --- a/integration-tests/langchain4j-chat/src/main/java/org/apache/camel/quarkus/component/langchain/chat/it/LangChain4jChatResource.java +++ b/integration-tests/langchain4j-chat/src/main/java/org/apache/camel/quarkus/component/langchain/chat/it/LangChain4jChatResource.java @@ -34,6 +34,7 @@ import org.apache.camel.CamelContext; import org.apache.camel.ProducerTemplate; import org.apache.camel.component.langchain4j.chat.LangChain4jChat; import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.util.ObjectHelper; @Path("/langchain4j-chat") @ApplicationScoped @@ -94,8 +95,8 @@ public class LangChain4jChatResource { MockEndpoint mockEndpoint = context.getEndpoint("mock:multipleMessageResponse", MockEndpoint.class); mockEndpoint.expectedMessageCount(1); mockEndpoint.expectedMessagesMatches(exchange -> { - String body = exchange.getMessage().getBody(String.class); - return body.trim().contains("I would recommend"); + String chatResponse = exchange.getMessage().getBody(String.class); + return ObjectHelper.isNotEmpty(chatResponse); }); List<ChatMessage> messages = new ArrayList<>(); diff --git a/integration-tests/langchain4j-chat/src/main/resources/application.properties b/integration-tests/langchain4j-chat/src/main/resources/application.properties index b73f854d92..c718738744 100644 --- a/integration-tests/langchain4j-chat/src/main/resources/application.properties +++ b/integration-tests/langchain4j-chat/src/main/resources/application.properties @@ -17,3 +17,8 @@ quarkus.langchain4j.ollama.chat-model.model-id=orca-mini quarkus.langchain4j.ollama.chat-model.temperature=0.3 quarkus.langchain4j.ollama.timeout=30s + +# Uncomment to log HTTP traffic between langchain4j & the LLM API +#quarkus.rest-client.logging.scope=request-response +#quarkus.rest-client.logging.body-limit=10000 +#quarkus.log.category."org.jboss.resteasy.reactive.client.logging".level=DEBUG diff --git a/integration-tests/langchain4j-chat/src/test/resources/mappings/multipleMessages.json b/integration-tests/langchain4j-chat/src/test/resources/mappings/multipleMessages.json index f18bf54a51..ae4155d28c 100644 --- a/integration-tests/langchain4j-chat/src/test/resources/mappings/multipleMessages.json +++ b/integration-tests/langchain4j-chat/src/test/resources/mappings/multipleMessages.json @@ -1,24 +1,24 @@ { - "id" : "5720afb6-10d1-4038-8f8f-f08d89180b14", + "id" : "dd4c47e5-d189-437f-b4fb-cdb3007d6271", "name" : "api_chat", "request" : { "url" : "/api/chat", "method" : "POST", "bodyPatterns" : [ { - "equalToJson" : "{\"model\":\"orca-mini\",\"messages\":[{\"role\":\"SYSTEM\",\"content\":\"You are asked to provide recommendations for a restaurant based on user reviews.\"},{\"role\":\"USER\",\"content\":\"Hello, my name is Karen.\"},{\"role\":\"ASSISTANT\",\"content\":\"Hello Karen, how can I help you?\"},{\"role\":\"USER\",\"content\":\"I\\u0027d like you to recommend a restaurant for me.\"},{\"role\":\"ASSISTANT\",\"content\":\"Sure, what type of cuisine are you interested in? [...] + "equalToJson" : "{\n \"model\" : \"orca-mini\",\n \"messages\" : [ {\n \"role\" : \"system\",\n \"content\" : \"You are asked to provide recommendations for a restaurant based on user reviews.\"\n }, {\n \"role\" : \"user\",\n \"content\" : \"Hello, my name is Karen.\"\n }, {\n \"role\" : \"assistant\",\n \"content\" : \"Hello Karen, how can I help you?\"\n }, {\n \"role\" : \"user\",\n \"content\" : \"I'd like you to recommend a restaurant for me.\"\n [...] "ignoreArrayOrder" : true, "ignoreExtraElements" : true } ] }, "response" : { "status" : 200, - "body" : "{\"model\":\"orca-mini\",\"created_at\":\"2024-05-02T08:23:51.41574263Z\",\"message\":{\"role\":\"assistant\",\"content\":\" Based on user reviews, I would recommend La Renaissance de la cuisine marocaine. It has received positive ratings for its delicious Moroccan food and friendly service. The restaurant is located at 35 rue Montorgueil, Paris, France. You can check out their menu and reviews on their website or social media pages.\"},\"done\":true,\"total_duration\":6541 [...] + "body" : "{\"model\":\"orca-mini\",\"created_at\":\"2024-07-22T09:22:54.577581434Z\",\"message\":{\"role\":\"assistant\",\"content\":\" Based on user reviews, I would recommend La Petite Farine. It has received excellent ratings for Moroccan cuisine and has a great atmosphere. Customers rave about the delicious food and the friendly service. Check it out at https://www.restaurant-la-petite-farine.com/\"},\"done\":true,\"total_duration\":3301943840,\"load_duration\":356730,\"prompt_ev [...] "headers" : { - "Date" : "Thu, 02 May 2024 08:23:51 GMT", + "Date" : "Mon, 22 Jul 2024 09:22:54 GMT", "Content-Type" : "application/json; charset=utf-8" } }, - "uuid" : "5720afb6-10d1-4038-8f8f-f08d89180b14", + "uuid" : "dd4c47e5-d189-437f-b4fb-cdb3007d6271", "persistent" : true, "insertionIndex" : 3 } \ No newline at end of file diff --git a/integration-tests/langchain4j-chat/src/test/resources/mappings/promptMessage.json b/integration-tests/langchain4j-chat/src/test/resources/mappings/promptMessage.json index 3971db1c21..94f7328ddb 100644 --- a/integration-tests/langchain4j-chat/src/test/resources/mappings/promptMessage.json +++ b/integration-tests/langchain4j-chat/src/test/resources/mappings/promptMessage.json @@ -1,24 +1,24 @@ { - "id" : "6d1d4506-a77f-46c6-81c5-068ab78b372d", + "id" : "7a17ef92-ee87-4291-a924-40289295573d", "name" : "api_chat", "request" : { "url" : "/api/chat", "method" : "POST", "bodyPatterns" : [ { - "equalToJson" : "{\"model\":\"orca-mini\",\"messages\":[{\"role\":\"USER\",\"content\":\"Create a recipe for a oven dish with the following ingredients: potato, tomato, feta, olive oil\"}],\"options\":{\"temperature\":0.3},\"stream\":false}", + "equalToJson" : "{\n \"model\" : \"orca-mini\",\n \"messages\" : [ {\n \"role\" : \"user\",\n \"content\" : \"Create a recipe for a oven dish with the following ingredients: potato, tomato, feta, olive oil\"\n } ],\n \"options\" : {\n \"temperature\" : 0.3,\n \"top_k\" : 40,\n \"top_p\" : 0.9\n },\n \"stream\" : false\n}", "ignoreArrayOrder" : true, "ignoreExtraElements" : true } ] }, "response" : { "status" : 200, - "body" : "{\"model\":\"orca-mini\",\"created_at\":\"2024-05-02T08:22:19.097855836Z\",\"message\":{\"role\":\"assistant\",\"content\":\" Sure, here's a simple recipe for an oven dish with potato, tomato, feta and olive oil:\\n\\nIngredients:\\n- 1 medium-sized potato\\n- 1 medium-sized tomato\\n- 1/2 cup crumbled feta cheese\\n- 2 tablespoons olive oil\\n\\nInstructions:\\n1. Preheat the oven to 375°F (190°C).\\n2. Cut the potato into small cubes and place them in a baking dish.\\n3. [...] + "body" : "{\"model\":\"orca-mini\",\"created_at\":\"2024-07-22T09:14:41.627539463Z\",\"message\":{\"role\":\"assistant\",\"content\":\" Here's a simple recipe for a delicious oven dish with potatoes, tomato, feta and olive oil:\\n\\nIngredients:\\n- 2 medium-sized potatoes, peeled and chopped into small pieces\\n- 1 medium-sized tomato, chopped\\n- 1/2 cup crumbled feta cheese\\n- 2 tablespoons olive oil\\n\\nInstructions:\\n\\n1. Preheat the oven to 375°F (190°C).\\n\\n2. In a bakin [...] "headers" : { - "Date" : "Thu, 02 May 2024 08:22:19 GMT", + "Date" : "Mon, 22 Jul 2024 09:14:41 GMT", "Content-Type" : "application/json; charset=utf-8" } }, - "uuid" : "6d1d4506-a77f-46c6-81c5-068ab78b372d", + "uuid" : "7a17ef92-ee87-4291-a924-40289295573d", "persistent" : true, - "insertionIndex" : 2 + "insertionIndex" : 3 } \ No newline at end of file diff --git a/integration-tests/langchain4j-chat/src/test/resources/mappings/simpleMessage.json b/integration-tests/langchain4j-chat/src/test/resources/mappings/simpleMessage.json index c258ed1e72..75231cd4b8 100644 --- a/integration-tests/langchain4j-chat/src/test/resources/mappings/simpleMessage.json +++ b/integration-tests/langchain4j-chat/src/test/resources/mappings/simpleMessage.json @@ -1,24 +1,24 @@ { - "id" : "27d02f6b-e565-48b5-a64e-2e91590ff224", + "id" : "4b34d025-3895-4bd9-80f9-dce99fad4012", "name" : "api_chat", "request" : { "url" : "/api/chat", "method" : "POST", "bodyPatterns" : [ { - "equalToJson" : "{\"model\":\"orca-mini\",\"messages\":[{\"role\":\"USER\",\"content\":\"Hello my name is Darth Vader!\"}],\"options\":{\"temperature\":0.3},\"stream\":false}", + "equalToJson" : "{\n \"model\" : \"orca-mini\",\n \"messages\" : [ {\n \"role\" : \"user\",\n \"content\" : \"Hello my name is Darth Vader!\"\n } ],\n \"options\" : {\n \"temperature\" : 0.3,\n \"top_k\" : 40,\n \"top_p\" : 0.9\n },\n \"stream\" : false\n}", "ignoreArrayOrder" : true, "ignoreExtraElements" : true } ] }, "response" : { "status" : 200, - "body" : "{\"model\":\"orca-mini\",\"created_at\":\"2024-05-02T08:21:13.635823801Z\",\"message\":{\"role\":\"assistant\",\"content\":\" Hello, I'm your friendly AI assistant. How may I assist you today?\"},\"done\":true,\"total_duration\":2371281081,\"load_duration\":577023282,\"prompt_eval_count\":49,\"prompt_eval_duration\":946565000,\"eval_count\":18,\"eval_duration\":847072000}", + "body" : "{\"model\":\"orca-mini\",\"created_at\":\"2024-07-22T09:15:12.778157441Z\",\"message\":{\"role\":\"assistant\",\"content\":\" Hello, I am your loyal AI assistant. Is there anything I can assist you with today?\"},\"done\":true,\"total_duration\":1277036396,\"load_duration\":576934,\"prompt_eval_count\":16,\"prompt_eval_duration\":324714000,\"eval_count\":20,\"eval_duration\":950928000}", "headers" : { - "Date" : "Thu, 02 May 2024 08:21:13 GMT", + "Date" : "Mon, 22 Jul 2024 09:15:12 GMT", "Content-Type" : "application/json; charset=utf-8" } }, - "uuid" : "27d02f6b-e565-48b5-a64e-2e91590ff224", + "uuid" : "4b34d025-3895-4bd9-80f9-dce99fad4012", "persistent" : true, - "insertionIndex" : 1 + "insertionIndex" : 3 } \ No newline at end of file diff --git a/pom.xml b/pom.xml index c414549b6f..ca4d718aec 100644 --- a/pom.xml +++ b/pom.xml @@ -56,7 +56,7 @@ <quarkiverse-jackson-jq.version>2.0.2</quarkiverse-jackson-jq.version><!-- https://repo1.maven.org/maven2/io/quarkiverse/jackson-jq/quarkus-jackson-jq-parent/ --> <quarkiverse-jgit.version>3.1.2</quarkiverse-jgit.version><!-- https://repo1.maven.org/maven2/io/quarkiverse/jgit/quarkus-jgit-parent/ --> <quarkiverse-jsch.version>3.0.8</quarkiverse-jsch.version><!-- https://repo1.maven.org/maven2/io/quarkiverse/jsch/quarkus-jsch-parent/ --> - <quarkiverse-langchain4j.version>0.16.2</quarkiverse-langchain4j.version><!-- https://repo1.maven.org/maven2/io/quarkiverse/langchain4j/quarkus-langchain4j-parent --> + <quarkiverse-langchain4j.version>0.16.4</quarkiverse-langchain4j.version><!-- https://repo1.maven.org/maven2/io/quarkiverse/langchain4j/quarkus-langchain4j-parent --> <quarkiverse-micrometer.version>3.2.4</quarkiverse-micrometer.version><!-- https://repo1.maven.org/maven2/io/quarkiverse/micrometer/registry/quarkus-micrometer-registry-jmx/ --> <quarkiverse-minio.version>3.7.5</quarkiverse-minio.version><!-- https://repo1.maven.org/maven2/io/quarkiverse/minio/quarkus-minio-parent/ --> <quarkiverse-mybatis.version>2.2.3</quarkiverse-mybatis.version><!-- https://repo1.maven.org/maven2/io/quarkiverse/mybatis/quarkus-mybatis-parent/ --> diff --git a/poms/bom/src/main/generated/flattened-full-pom.xml b/poms/bom/src/main/generated/flattened-full-pom.xml index 18559f1604..41924e0438 100644 --- a/poms/bom/src/main/generated/flattened-full-pom.xml +++ b/poms/bom/src/main/generated/flattened-full-pom.xml @@ -6723,12 +6723,12 @@ <dependency> <groupId>io.quarkiverse.langchain4j</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <artifactId>quarkus-langchain4j-core</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> - <version>0.16.2</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>0.16.4</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> </dependency> <dependency> <groupId>io.quarkiverse.langchain4j</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <artifactId>quarkus-langchain4j-core-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> - <version>0.16.2</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>0.16.4</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> </dependency> <dependency> <groupId>io.quarkiverse.messaginghub</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> diff --git a/poms/bom/src/main/generated/flattened-reduced-pom.xml b/poms/bom/src/main/generated/flattened-reduced-pom.xml index 6984a01a78..1818980850 100644 --- a/poms/bom/src/main/generated/flattened-reduced-pom.xml +++ b/poms/bom/src/main/generated/flattened-reduced-pom.xml @@ -6693,12 +6693,12 @@ <dependency> <groupId>io.quarkiverse.langchain4j</groupId> <artifactId>quarkus-langchain4j-core</artifactId> - <version>0.16.2</version> + <version>0.16.4</version> </dependency> <dependency> <groupId>io.quarkiverse.langchain4j</groupId> <artifactId>quarkus-langchain4j-core-deployment</artifactId> - <version>0.16.2</version> + <version>0.16.4</version> </dependency> <dependency> <groupId>io.quarkiverse.messaginghub</groupId> diff --git a/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml b/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml index 7a4f80b210..0257da1172 100644 --- a/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml +++ b/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml @@ -6693,12 +6693,12 @@ <dependency> <groupId>io.quarkiverse.langchain4j</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <artifactId>quarkus-langchain4j-core</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> - <version>0.16.2</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>0.16.4</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> </dependency> <dependency> <groupId>io.quarkiverse.langchain4j</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <artifactId>quarkus-langchain4j-core-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> - <version>0.16.2</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>0.16.4</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> </dependency> <dependency> <groupId>io.quarkiverse.messaginghub</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->