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-examples.git
commit 716aac268be608876c16ea292d1310e9a8eeb611 Author: Alexandre Gallice <[email protected]> AuthorDate: Fri Jul 25 09:26:32 2025 +0200 data-extract: upgrade to quarkus-langchain4j 1.1.0 --- data-extract-langchain4j/pom.xml | 2 +- .../extraction/CustomPojoExtractionService.java | 5 ++ .../langchain4j-ollama/reflect-config.json | 56 ++++++++++++++++++++++ ..._chat-19930290-5d0d-4c09-b256-73adbbf23475.json | 24 ++++++++++ ..._chat-2d69eec9-693a-4f8d-ba28-0c7acac45fac.json | 24 ---------- ...chat-46e7b6b7-f983-471d-b7bf-7fd271067c10.json} | 10 ++-- ..._chat-69af07bd-686f-439f-92c9-7424d9506270.json | 24 ++++++++++ ..._chat-7aae2c51-f61d-45bb-a2d7-ca47efeb6888.json | 24 ---------- 8 files changed, 115 insertions(+), 54 deletions(-) diff --git a/data-extract-langchain4j/pom.xml b/data-extract-langchain4j/pom.xml index f954770..0255380 100644 --- a/data-extract-langchain4j/pom.xml +++ b/data-extract-langchain4j/pom.xml @@ -55,7 +55,7 @@ <maven-resources-plugin.version>3.3.1</maven-resources-plugin.version> <maven-surefire-plugin.version>3.5.2</maven-surefire-plugin.version> - <quarkus-langchain4j.version>0.25.0</quarkus-langchain4j.version> + <quarkus-langchain4j.version>1.1.0</quarkus-langchain4j.version> <wiremock.version>3.12.1</wiremock.version> </properties> diff --git a/data-extract-langchain4j/src/main/java/org/acme/extraction/CustomPojoExtractionService.java b/data-extract-langchain4j/src/main/java/org/acme/extraction/CustomPojoExtractionService.java index 8a6923e..7db927e 100644 --- a/data-extract-langchain4j/src/main/java/org/acme/extraction/CustomPojoExtractionService.java +++ b/data-extract-langchain4j/src/main/java/org/acme/extraction/CustomPojoExtractionService.java @@ -19,6 +19,7 @@ package org.acme.extraction; import java.time.LocalDate; import java.util.Locale; +import com.fasterxml.jackson.annotation.JsonProperty; import dev.langchain4j.service.UserMessage; import io.quarkiverse.langchain4j.RegisterAiService; import io.quarkus.runtime.annotations.RegisterForReflection; @@ -33,9 +34,13 @@ public interface CustomPojoExtractionService { @RegisterForReflection static class CustomPojo { + @JsonProperty(required = true) public boolean customerSatisfied; + @JsonProperty(required = true) public String customerName; + @JsonProperty(required = true) public LocalDate customerBirthday; + @JsonProperty(required = true) public String summary; private final static String FORMAT = "\n{\n" diff --git a/data-extract-langchain4j/src/main/resources/META-INF/native-image/dev.langchain4j/langchain4j-ollama/reflect-config.json b/data-extract-langchain4j/src/main/resources/META-INF/native-image/dev.langchain4j/langchain4j-ollama/reflect-config.json new file mode 100644 index 0000000..06e9e8b --- /dev/null +++ b/data-extract-langchain4j/src/main/resources/META-INF/native-image/dev.langchain4j/langchain4j-ollama/reflect-config.json @@ -0,0 +1,56 @@ +[ + { + "name" : "dev.langchain4j.model.ollama.OllamaChatRequest", + "allDeclaredConstructors" : true, + "allPublicConstructors" : true, + "allDeclaredMethods" : true, + "allPublicMethods" : true, + "allDeclaredFields" : true, + "allPublicFields" : true + }, + { + "name" : "dev.langchain4j.model.ollama.Message", + "allDeclaredConstructors" : true, + "allPublicConstructors" : true, + "allDeclaredMethods" : true, + "allPublicMethods" : true, + "allDeclaredFields" : true, + "allPublicFields" : true + }, + { + "name" : "dev.langchain4j.model.ollama.Role", + "allDeclaredConstructors" : true, + "allPublicConstructors" : true, + "allDeclaredMethods" : true, + "allPublicMethods" : true, + "allDeclaredFields" : true, + "allPublicFields" : true + }, + { + "name" : "dev.langchain4j.model.ollama.FormatSerializer", + "allDeclaredConstructors" : true, + "allPublicConstructors" : true, + "allDeclaredMethods" : true, + "allPublicMethods" : true, + "allDeclaredFields" : true, + "allPublicFields" : true + }, + { + "name" : "dev.langchain4j.model.ollama.OllamaChatResponse", + "allDeclaredConstructors" : true, + "allPublicConstructors" : true, + "allDeclaredMethods" : true, + "allPublicMethods" : true, + "allDeclaredFields" : true, + "allPublicFields" : true + }, + { + "name" : "dev.langchain4j.model.ollama.Options", + "allDeclaredConstructors" : true, + "allPublicConstructors" : true, + "allDeclaredMethods" : true, + "allPublicMethods" : true, + "allDeclaredFields" : true, + "allPublicFields" : true + } +] \ No newline at end of file diff --git a/data-extract-langchain4j/src/test/resources/mappings/api_chat-19930290-5d0d-4c09-b256-73adbbf23475.json b/data-extract-langchain4j/src/test/resources/mappings/api_chat-19930290-5d0d-4c09-b256-73adbbf23475.json new file mode 100644 index 0000000..6bb2a80 --- /dev/null +++ b/data-extract-langchain4j/src/test/resources/mappings/api_chat-19930290-5d0d-4c09-b256-73adbbf23475.json @@ -0,0 +1,24 @@ +{ + "id" : "19930290-5d0d-4c09-b256-73adbbf23475", + "name" : "api_chat", + "request" : { + "url" : "/api/chat", + "method" : "POST", + "bodyPatterns" : [ { + "equalToJson" : "{\n \"model\" : \"granite3.3:2b\",\n \"messages\" : [ {\n \"role\" : \"assistant\",\n \"content\" : \"{\\n \\\"customerSatisfied\\\": true,\\n \\\"customerName\\\": \\\"Sarah London\\\",\\n \\\"customerBirthday\\\": {\\\"year\\\": 1986, \\\"month\\\": 7, \\\"day\\\": 10},\\n \\\"summary\\\": \\\"The customer, Sarah London, is calling to declare an accident and seek reimbursement for related expenses.\\\"\\n}\",\n \"tool_calls\" : [ ]\n }, {\n \"r [...] + "ignoreArrayOrder" : true, + "ignoreExtraElements" : true + } ] + }, + "response" : { + "status" : 200, + "body" : "{\"model\":\"granite3.3:2b\",\"created_at\":\"2025-07-24T09:35:47.141867421Z\",\"message\":{\"role\":\"assistant\",\"content\":\"{\\n \\\"customerSatisfied\\\": false,\\n \\\"customerName\\\": \\\"John Doe\\\",\\n \\\"customerBirthday\\\": {\\\"year\\\": 2001, \\\"month\\\": 11, \\\"day\\\": 1},\\n \\\"summary\\\": \\\"Customer John Doe is dissatisfied with the insurance company's automatic cancellation of full reimbursement option from his contract. He was not informed [...] + "headers" : { + "Date" : "Thu, 24 Jul 2025 09:35:47 GMT", + "Content-Type" : "application/json; charset=utf-8" + } + }, + "uuid" : "19930290-5d0d-4c09-b256-73adbbf23475", + "persistent" : true, + "insertionIndex" : 5 +} \ No newline at end of file diff --git a/data-extract-langchain4j/src/test/resources/mappings/api_chat-2d69eec9-693a-4f8d-ba28-0c7acac45fac.json b/data-extract-langchain4j/src/test/resources/mappings/api_chat-2d69eec9-693a-4f8d-ba28-0c7acac45fac.json deleted file mode 100644 index 66639ca..0000000 --- a/data-extract-langchain4j/src/test/resources/mappings/api_chat-2d69eec9-693a-4f8d-ba28-0c7acac45fac.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "id" : "2d69eec9-693a-4f8d-ba28-0c7acac45fac", - "name" : "api_chat", - "request" : { - "url" : "/api/chat", - "method" : "POST", - "bodyPatterns" : [ { - "equalToJson" : "{\n \"model\" : \"granite3.3:2b\",\n \"messages\" : [ {\n \"role\" : \"assistant\",\n \"content\" : \"{\\n \\\"customerSatisfied\\\": true,\\n \\\"customerName\\\": \\\"Sarah London\\\",\\n \\\"customerBirthday\\\": {\\\"year\\\": 1986, \\\"month\\\": 7, \\\"day\\\": 10},\\n \\\"summary\\\": \\\"The customer, Sarah London, is calling to declare an accident and seek reimbursement for related expenses.\\\"\\n}\"\n }, {\n \"role\" : \"user\",\n \"co [...] - "ignoreArrayOrder" : true, - "ignoreExtraElements" : true - } ] - }, - "response" : { - "status" : 200, - "body" : "{\"model\":\"granite3.3:2b\",\"created_at\":\"2025-06-30T13:10:26.961768193Z\",\"message\":{\"role\":\"assistant\",\"content\":\"{\\n \\\"customerSatisfied\\\": false,\\n \\\"customerName\\\": \\\"John Doe\\\",\\n \\\"customerBirthday\\\": {\\\"year\\\": 2001, \\\"month\\\": 11, \\\"day\\\": 1},\\n \\\"summary\\\": \\\"Customer John Doe is dissatisfied with the insurance company's automatic cancellation of full reimbursement option from his contract. He was not informed [...] - "headers" : { - "Date" : "Mon, 30 Jun 2025 13:10:26 GMT", - "Content-Type" : "application/json; charset=utf-8" - } - }, - "uuid" : "2d69eec9-693a-4f8d-ba28-0c7acac45fac", - "persistent" : true, - "insertionIndex" : 5 -} \ No newline at end of file diff --git a/data-extract-langchain4j/src/test/resources/mappings/api_chat-302d1529-355e-4638-a605-a976c07c30df.json b/data-extract-langchain4j/src/test/resources/mappings/api_chat-46e7b6b7-f983-471d-b7bf-7fd271067c10.json similarity index 59% rename from data-extract-langchain4j/src/test/resources/mappings/api_chat-302d1529-355e-4638-a605-a976c07c30df.json rename to data-extract-langchain4j/src/test/resources/mappings/api_chat-46e7b6b7-f983-471d-b7bf-7fd271067c10.json index 4f31221..191086c 100644 --- a/data-extract-langchain4j/src/test/resources/mappings/api_chat-302d1529-355e-4638-a605-a976c07c30df.json +++ b/data-extract-langchain4j/src/test/resources/mappings/api_chat-46e7b6b7-f983-471d-b7bf-7fd271067c10.json @@ -1,24 +1,24 @@ { - "id" : "302d1529-355e-4638-a605-a976c07c30df", + "id" : "46e7b6b7-f983-471d-b7bf-7fd271067c10", "name" : "api_chat", "request" : { "url" : "/api/chat", "method" : "POST", "bodyPatterns" : [ { - "equalToJson" : "{\n \"model\" : \"granite3.3:2b\",\n \"messages\" : [ {\n \"role\" : \"user\",\n \"content\" : \"Extract information about a customer from the text delimited by triple backticks: ```Operator: Hello, how may I help you ?\\nCustomer: Hello, I'm calling because I need to declare an accident on my main vehicle.\\nOperator: Ok, can you please give me your name ?\\nCustomer: My name is Sarah London.\\nOperator: Could you please give me your birth date ?\\nCustome [...] + "equalToJson" : "{\n \"model\" : \"granite3.3:2b\",\n \"messages\" : [ {\n \"role\" : \"user\",\n \"content\" : \"Extract information about a customer from the text delimited by triple backticks: ```Operator: Hello, how may I help you ?\\nCustomer: Hello, I'm calling because I need to declare an accident on my main vehicle.\\nOperator: Ok, can you please give me your name ?\\nCustomer: My name is Sarah London.\\nOperator: Could you please give me your birth date ?\\nCustome [...] "ignoreArrayOrder" : true, "ignoreExtraElements" : true } ] }, "response" : { "status" : 200, - "body" : "{\"model\":\"granite3.3:2b\",\"created_at\":\"2025-06-30T13:10:15.253520732Z\",\"message\":{\"role\":\"assistant\",\"content\":\"{\\n \\\"customerSatisfied\\\": true,\\n \\\"customerName\\\": \\\"Sarah London\\\",\\n \\\"customerBirthday\\\": {\\\"year\\\": 1986, \\\"month\\\": 7, \\\"day\\\": 10},\\n \\\"summary\\\": \\\"The customer, Sarah London, is calling to declare an accident and seek reimbursement for related expenses.\\\"\\n}\"},\"done_reason\":\"stop\",\"done\ [...] + "body" : "{\"model\":\"granite3.3:2b\",\"created_at\":\"2025-07-24T09:35:35.362459065Z\",\"message\":{\"role\":\"assistant\",\"content\":\"{\\n \\\"customerSatisfied\\\": true,\\n \\\"customerName\\\": \\\"Sarah London\\\",\\n \\\"customerBirthday\\\": {\\\"year\\\": 1986, \\\"month\\\": 7, \\\"day\\\": 10},\\n \\\"summary\\\": \\\"The customer, Sarah London, is calling to declare an accident and seek reimbursement for related expenses.\\\"\\n}\"},\"done_reason\":\"stop\",\"done\ [...] "headers" : { - "Date" : "Mon, 30 Jun 2025 13:10:15 GMT", + "Date" : "Thu, 24 Jul 2025 09:35:35 GMT", "Content-Type" : "application/json; charset=utf-8" } }, - "uuid" : "302d1529-355e-4638-a605-a976c07c30df", + "uuid" : "46e7b6b7-f983-471d-b7bf-7fd271067c10", "persistent" : true, "insertionIndex" : 6 } \ No newline at end of file diff --git a/data-extract-langchain4j/src/test/resources/mappings/api_chat-69af07bd-686f-439f-92c9-7424d9506270.json b/data-extract-langchain4j/src/test/resources/mappings/api_chat-69af07bd-686f-439f-92c9-7424d9506270.json new file mode 100644 index 0000000..959b7ec --- /dev/null +++ b/data-extract-langchain4j/src/test/resources/mappings/api_chat-69af07bd-686f-439f-92c9-7424d9506270.json @@ -0,0 +1,24 @@ +{ + "id" : "69af07bd-686f-439f-92c9-7424d9506270", + "name" : "api_chat", + "request" : { + "url" : "/api/chat", + "method" : "POST", + "bodyPatterns" : [ { + "equalToJson" : "{\n \"model\" : \"granite3.3:2b\",\n \"messages\" : [ {\n \"role\" : \"assistant\",\n \"content\" : \"{\\n \\\"customerSatisfied\\\": false,\\n \\\"customerName\\\": \\\"John Doe\\\",\\n \\\"customerBirthday\\\": {\\\"year\\\": 2001, \\\"month\\\": 11, \\\"day\\\": 1},\\n \\\"summary\\\": \\\"Customer John Doe is dissatisfied with the insurance company's automatic cancellation of full reimbursement option from his contract. He was not informed about thi [...] + "ignoreArrayOrder" : true, + "ignoreExtraElements" : true + } ] + }, + "response" : { + "status" : 200, + "body" : "{\"model\":\"granite3.3:2b\",\"created_at\":\"2025-07-24T09:36:00.605912393Z\",\"message\":{\"role\":\"assistant\",\"content\":\"{\\n \\\"customerSatisfied\\\": true,\\n \\\"customerName\\\": \\\"Kate Boss\\\",\\n \\\"customerBirthday\\\": {\\\"year\\\": 1999, \\\"month\\\": 8, \\\"day\\\": 13},\\n \\\"summary\\\": \\\"Customer Kate Boss sought assistance from the insurance operator regarding a car accident. She initially provided incorrect information about her last na [...] + "headers" : { + "Date" : "Thu, 24 Jul 2025 09:36:00 GMT", + "Content-Type" : "application/json; charset=utf-8" + } + }, + "uuid" : "69af07bd-686f-439f-92c9-7424d9506270", + "persistent" : true, + "insertionIndex" : 4 +} \ No newline at end of file diff --git a/data-extract-langchain4j/src/test/resources/mappings/api_chat-7aae2c51-f61d-45bb-a2d7-ca47efeb6888.json b/data-extract-langchain4j/src/test/resources/mappings/api_chat-7aae2c51-f61d-45bb-a2d7-ca47efeb6888.json deleted file mode 100644 index 8df44d4..0000000 --- a/data-extract-langchain4j/src/test/resources/mappings/api_chat-7aae2c51-f61d-45bb-a2d7-ca47efeb6888.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "id" : "7aae2c51-f61d-45bb-a2d7-ca47efeb6888", - "name" : "api_chat", - "request" : { - "url" : "/api/chat", - "method" : "POST", - "bodyPatterns" : [ { - "equalToJson" : "{\n \"model\" : \"granite3.3:2b\",\n \"messages\" : [ {\n \"role\" : \"assistant\",\n \"content\" : \"{\\n \\\"customerSatisfied\\\": false,\\n \\\"customerName\\\": \\\"John Doe\\\",\\n \\\"customerBirthday\\\": {\\\"year\\\": 2001, \\\"month\\\": 11, \\\"day\\\": 1},\\n \\\"summary\\\": \\\"Customer John Doe is dissatisfied with the insurance company's automatic cancellation of full reimbursement option from his contract. He was not informed about thi [...] - "ignoreArrayOrder" : true, - "ignoreExtraElements" : true - } ] - }, - "response" : { - "status" : 200, - "body" : "{\"model\":\"granite3.3:2b\",\"created_at\":\"2025-06-30T13:10:40.346190215Z\",\"message\":{\"role\":\"assistant\",\"content\":\"{\\n \\\"customerSatisfied\\\": true,\\n \\\"customerName\\\": \\\"Kate Boss\\\",\\n \\\"customerBirthday\\\": {\\\"year\\\": 1999, \\\"month\\\": 8, \\\"day\\\": 13},\\n \\\"summary\\\": \\\"Customer Kate Boss sought assistance from the insurance operator regarding a car accident. She initially provided incorrect information about her last na [...] - "headers" : { - "Date" : "Mon, 30 Jun 2025 13:10:40 GMT", - "Content-Type" : "application/json; charset=utf-8" - } - }, - "uuid" : "7aae2c51-f61d-45bb-a2d7-ca47efeb6888", - "persistent" : true, - "insertionIndex" : 4 -} \ No newline at end of file
