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 20530caa237cb5e9bd6b90173a7394d253507e9f Author: Alexandre Gallice <[email protected]> AuthorDate: Mon Jun 1 15:33:31 2026 +0200 data-extract: Upgrade to granite 4.1 and ollama 0.24.0 --- data-extract-langchain4j/README.adoc | 14 +++++++------- .../src/main/resources/application.properties | 2 +- .../test/java/org/acme/extraction/OllamaTestResource.java | 2 +- ... => api_chat-862490ff-9aa9-45d3-b4dc-1dc489ac6dda.json} | 10 +++++----- ... => api_chat-bc242ba3-eb22-4c60-9bab-22fabf382956.json} | 10 +++++----- ... => api_chat-d0e262d3-6c01-4f8e-a595-617dae7f3687.json} | 10 +++++----- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/data-extract-langchain4j/README.adoc b/data-extract-langchain4j/README.adoc index ca4bef1c..c1dfbe6d 100644 --- a/data-extract-langchain4j/README.adoc +++ b/data-extract-langchain4j/README.adoc @@ -15,7 +15,7 @@ In this example, we'll convert those text conversations into Java Objects that c image::schema.png[] In order to achieve this extraction, we'll need a https://en.wikipedia.org/wiki/Large_language_model[Large Language Model (LLM)] and related serving framework that natively supports https://ollama.com/blog/structured-outputs[JSON structured output]. -Here, we choose https://ollama.com/library/granite4:3b-h[granite4:3b-h] served through https://ollama.com/[ollama]. +Here, we choose https://ollama.com/library/granite4.1:3b[granite4.1:3b] served through https://ollama.com/[ollama]. In order to request inference to the served model, we'll use the high-level LangChain4j APIs like https://docs.langchain4j.dev/tutorials/ai-services[AiServices]. === Start the Large Language Model @@ -24,7 +24,7 @@ Let's start a container to serve the LLM with Ollama, in a first shell type: [source,shell] ---- -docker run --rm -it -v cqex-data-extract-ollama:/root/.ollama -p 11434:11434 --name cqex-data-extract-ollama ollama/ollama:0.19.0 +docker run --rm -it -v cqex-data-extract-ollama:/root/.ollama -p 11434:11434 --name cqex-data-extract-ollama ollama/ollama:0.24.0 ---- After a moment, a log like below should be output: @@ -34,11 +34,11 @@ After a moment, a log like below should be output: time=2026-01-07T14:28:19.092Z level=INFO source=types.go:60 msg="inference compute" id=cpu library=cpu compute="" name=cpu description=cpu libdirs=ollama driver="" pci_id="" type="" total="62.2 GiB" available="62.2 GiB" ---- -Then, download the granite4:3b-h model, in a second shell type: +Then, download the granite4.1:3b model, in a second shell type: [source,shell] ---- -docker exec -it cqex-data-extract-ollama ollama pull granite4:3b-h +docker exec -it cqex-data-extract-ollama ollama pull granite4.1:3b ---- After a moment, log like below should be output: @@ -99,12 +99,12 @@ At the end, we are provided with a Plain Old Java Object (POJO) handling the ext [source,shell] ---- -2026-01-06 15:24:56,889 INFO [org.acme.extraction.CustomPojoStore] (Camel (camel-1) thread #1 - file://target/transcripts) An extracted POJO has been added to the store: +2026-05-27 18:31:55,373 INFO [org.acme.extraction.CustomPojoStore] (Camel (camel-1) thread #1 - file://target/transcripts) An extracted POJO has been added to the store: { "customerSatisfied": "true", "customerName": "Sarah London", - "customerBirthday": "10 July 1986", - "summary": "The customer, Sarah London, is calling to declare an accident and seek reimbursement for related expenses." + "customerBirthday": "10 JULY 1986", + "summary": "The customer, Sarah London, called to declare an accident on her main vehicle. The operator confirmed that all expenses related to the accident will be reimbursed." } ---- diff --git a/data-extract-langchain4j/src/main/resources/application.properties b/data-extract-langchain4j/src/main/resources/application.properties index 0d258925..a673874b 100644 --- a/data-extract-langchain4j/src/main/resources/application.properties +++ b/data-extract-langchain4j/src/main/resources/application.properties @@ -20,4 +20,4 @@ quarkus.default-locale=en_US # Adjust as per your where your Ollama instance is running langchain4j.ollama.base-url=http://localhost:11434 # The chat model to use -langchain4j.ollama.chat-model.model-id=granite4:3b-h +langchain4j.ollama.chat-model.model-id=granite4.1:3b diff --git a/data-extract-langchain4j/src/test/java/org/acme/extraction/OllamaTestResource.java b/data-extract-langchain4j/src/test/java/org/acme/extraction/OllamaTestResource.java index 541904e7..8b9f809b 100644 --- a/data-extract-langchain4j/src/test/java/org/acme/extraction/OllamaTestResource.java +++ b/data-extract-langchain4j/src/test/java/org/acme/extraction/OllamaTestResource.java @@ -36,7 +36,7 @@ public class OllamaTestResource implements QuarkusTestResourceLifecycleManager { private static final Logger LOG = LoggerFactory.getLogger(OllamaTestResource.class); - private static final String OLLAMA_IMAGE = "ollama/ollama:0.17.7"; + private static final String OLLAMA_IMAGE = "ollama/ollama:0.24.0"; private static final int OLLAMA_SERVER_PORT = 11434; private static final String MODE_MOCK = "mock"; diff --git a/data-extract-langchain4j/src/test/resources/mappings/api_chat-4400676b-1fdd-4664-bfbd-80be34aae24b.json b/data-extract-langchain4j/src/test/resources/mappings/api_chat-862490ff-9aa9-45d3-b4dc-1dc489ac6dda.json similarity index 78% rename from data-extract-langchain4j/src/test/resources/mappings/api_chat-4400676b-1fdd-4664-bfbd-80be34aae24b.json rename to data-extract-langchain4j/src/test/resources/mappings/api_chat-862490ff-9aa9-45d3-b4dc-1dc489ac6dda.json index 705ff402..5fb0dfb3 100644 --- a/data-extract-langchain4j/src/test/resources/mappings/api_chat-4400676b-1fdd-4664-bfbd-80be34aae24b.json +++ b/data-extract-langchain4j/src/test/resources/mappings/api_chat-862490ff-9aa9-45d3-b4dc-1dc489ac6dda.json @@ -1,24 +1,24 @@ { - "id" : "4400676b-1fdd-4664-bfbd-80be34aae24b", + "id" : "862490ff-9aa9-45d3-b4dc-1dc489ac6dda", "name" : "api_chat", "request" : { "url" : "/api/chat", "method" : "POST", "bodyPatterns" : [ { - "equalToJson" : "{\n \"model\" : \"granite4:3b-h\",\n \"messages\" : [ {\n \"role\" : \"user\",\n \"content\" : \"Extract information about a customer from the transcript delimited by triple backticks: ```Operator: Hello, how may I help you ?\\nCustomer: Hello, I'm John. I need to share a problem with you. Actually, the insurance has reimbursed only half the money I have spent due to the accident.\\nOperator: Hello John, could you please give me your last name so that I can [...] + "equalToJson" : "{\n \"model\" : \"granite4.1:3b\",\n \"messages\" : [ {\n \"role\" : \"user\",\n \"content\" : \"Extract information about a customer from the transcript delimited by triple backticks: ```Operator: Hello, how may I help you ?\\nCustomer: Hello, I'm John. I need to share a problem with you. Actually, the insurance has reimbursed only half the money I have spent due to the accident.\\nOperator: Hello John, could you please give me your last name so that I can [...] "ignoreArrayOrder" : true, "ignoreExtraElements" : true } ] }, "response" : { "status" : 200, - "body" : "{\"model\":\"granite4:3b-h\",\"created_at\":\"2026-04-02T08:15:31.297936294Z\",\"message\":{\"role\":\"assistant\",\"content\":\"{\\n \\\"customerSatisfied\\\": false,\\n \\\"customerName\\\": \\\"John Doe\\\",\\n \\\"customerBirthday\\\": {\\\"year\\\": 2001, \\\"month\\\": 11, \\\"day\\\": 1},\\n \\\"summary\\\": \\\"John Doe, the customer, is dissatisfied with the insurance company as the full reimbursement option was cancelled automatically by their system and he wa [...] + "body" : "{\"model\":\"granite4.1:3b\",\"created_at\":\"2026-05-27T17:05:54.559691677Z\",\"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 upset because the insurance only reimbursed half of his expenses due to an accident. He claims he was never notified about the autom [...] "headers" : { - "Date" : "Thu, 02 Apr 2026 08:15:31 GMT", + "Date" : "Wed, 27 May 2026 17:05:54 GMT", "Content-Type" : "application/json; charset=utf-8" } }, - "uuid" : "4400676b-1fdd-4664-bfbd-80be34aae24b", + "uuid" : "862490ff-9aa9-45d3-b4dc-1dc489ac6dda", "persistent" : true, "insertionIndex" : 5 } \ No newline at end of file diff --git a/data-extract-langchain4j/src/test/resources/mappings/api_chat-173e3a1f-b194-46f7-a510-c1d497f98986.json b/data-extract-langchain4j/src/test/resources/mappings/api_chat-bc242ba3-eb22-4c60-9bab-22fabf382956.json similarity index 73% rename from data-extract-langchain4j/src/test/resources/mappings/api_chat-173e3a1f-b194-46f7-a510-c1d497f98986.json rename to data-extract-langchain4j/src/test/resources/mappings/api_chat-bc242ba3-eb22-4c60-9bab-22fabf382956.json index 27596a5b..0eb23c92 100644 --- a/data-extract-langchain4j/src/test/resources/mappings/api_chat-173e3a1f-b194-46f7-a510-c1d497f98986.json +++ b/data-extract-langchain4j/src/test/resources/mappings/api_chat-bc242ba3-eb22-4c60-9bab-22fabf382956.json @@ -1,24 +1,24 @@ { - "id" : "173e3a1f-b194-46f7-a510-c1d497f98986", + "id" : "bc242ba3-eb22-4c60-9bab-22fabf382956", "name" : "api_chat", "request" : { "url" : "/api/chat", "method" : "POST", "bodyPatterns" : [ { - "equalToJson" : "{\n \"model\" : \"granite4:3b-h\",\n \"messages\" : [ {\n \"role\" : \"user\",\n \"content\" : \"Extract information about a customer from the transcript 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 ?\\nC [...] + "equalToJson" : "{\n \"model\" : \"granite4.1:3b\",\n \"messages\" : [ {\n \"role\" : \"user\",\n \"content\" : \"Extract information about a customer from the transcript 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 ?\\nC [...] "ignoreArrayOrder" : true, "ignoreExtraElements" : true } ] }, "response" : { "status" : 200, - "body" : "{\"model\":\"granite4:3b-h\",\"created_at\":\"2026-04-02T08:15:17.527674637Z\",\"message\":{\"role\":\"assistant\",\"content\":\"{\\n \\\"customerSatisfied\\\": true,\\n \\\"customerName\\\": \\\"Sarah London\\\",\\n \\\"customerBirthday\\\": {\\n \\\"year\\\": 1986,\\n \\\"month\\\": 7,\\n \\\"day\\\": 10\\n },\\n \\\"summary\\\": \\\"The customer, Sarah London, needed to declare an accident on her main vehicle and was informed that all expenses linked to the [...] + "body" : "{\"model\":\"granite4.1:3b\",\"created_at\":\"2026-05-27T17:05:40.026864606Z\",\"message\":{\"role\":\"assistant\",\"content\":\"{\\n \\\"customerSatisfied\\\": true,\\n \\\"customerName\\\": \\\"Sarah London\\\",\\n \\\"customerBirthday\\\": {\\n \\\"year\\\": 1986,\\n \\\"month\\\": 7,\\n \\\"day\\\": 10\\n },\\n \\\"summary\\\": \\\"The customer, Sarah London, called to declare an accident on her main vehicle. The operator confirmed that all expenses related [...] "headers" : { - "Date" : "Thu, 02 Apr 2026 08:15:17 GMT", + "Date" : "Wed, 27 May 2026 17:05:40 GMT", "Content-Type" : "application/json; charset=utf-8" } }, - "uuid" : "173e3a1f-b194-46f7-a510-c1d497f98986", + "uuid" : "bc242ba3-eb22-4c60-9bab-22fabf382956", "persistent" : true, "insertionIndex" : 6 } \ No newline at end of file diff --git a/data-extract-langchain4j/src/test/resources/mappings/api_chat-f1bd1a9f-c9c9-465d-9328-84d80ca0d4d1.json b/data-extract-langchain4j/src/test/resources/mappings/api_chat-d0e262d3-6c01-4f8e-a595-617dae7f3687.json similarity index 76% rename from data-extract-langchain4j/src/test/resources/mappings/api_chat-f1bd1a9f-c9c9-465d-9328-84d80ca0d4d1.json rename to data-extract-langchain4j/src/test/resources/mappings/api_chat-d0e262d3-6c01-4f8e-a595-617dae7f3687.json index a2906d27..57825da3 100644 --- a/data-extract-langchain4j/src/test/resources/mappings/api_chat-f1bd1a9f-c9c9-465d-9328-84d80ca0d4d1.json +++ b/data-extract-langchain4j/src/test/resources/mappings/api_chat-d0e262d3-6c01-4f8e-a595-617dae7f3687.json @@ -1,24 +1,24 @@ { - "id" : "f1bd1a9f-c9c9-465d-9328-84d80ca0d4d1", + "id" : "d0e262d3-6c01-4f8e-a595-617dae7f3687", "name" : "api_chat", "request" : { "url" : "/api/chat", "method" : "POST", "bodyPatterns" : [ { - "equalToJson" : "{\n \"model\" : \"granite4:3b-h\",\n \"messages\" : [ {\n \"role\" : \"user\",\n \"content\" : \"Extract information about a customer from the transcript delimited by triple backticks: ```Operator: Hello, how may I help you?\\nCustomer: Hello, I am currently at the police station because I've got an accident. The police would need a proof that I have an insurance. Could you please help me?\\nOperator: Sure, could you please remind me your name and birth dat [...] + "equalToJson" : "{\n \"model\" : \"granite4.1:3b\",\n \"messages\" : [ {\n \"role\" : \"user\",\n \"content\" : \"Extract information about a customer from the transcript delimited by triple backticks: ```Operator: Hello, how may I help you?\\nCustomer: Hello, I am currently at the police station because I've got an accident. The police would need a proof that I have an insurance. Could you please help me?\\nOperator: Sure, could you please remind me your name and birth dat [...] "ignoreArrayOrder" : true, "ignoreExtraElements" : true } ] }, "response" : { "status" : 200, - "body" : "{\"model\":\"granite4:3b-h\",\"created_at\":\"2026-04-02T08:15:45.751056354Z\",\"message\":{\"role\":\"assistant\",\"content\":\"{\\n \\\"customerSatisfied\\\": true,\\n \\\"customerName\\\": \\\"Kate Boss\\\",\\n \\\"customerBirthday\\\": {\\n \\\"year\\\": 1999,\\n \\\"month\\\": 8,\\n \\\"day\\\": 13\\n },\\n \\\"summary\\\": \\\"Kate Boss contacted the operator to provide proof of insurance for an accident she was involved in at a police station. The opera [...] + "body" : "{\"model\":\"granite4.1:3b\",\"created_at\":\"2026-05-27T17:06:10.934259518Z\",\"message\":{\"role\":\"assistant\",\"content\":\"{\\n \\\"customerSatisfied\\\": true,\\n \\\"customerName\\\": \\\"Kate Boss\\\",\\n \\\"customerBirthday\\\": {\\n \\\"year\\\": 1999,\\n \\\"month\\\": 8,\\n \\\"day\\\": 13\\n },\\n \\\"summary\\\": \\\"The customer, Kate Boss, contacted the operator at a police station after an accident and needed proof of insurance for documenta [...] "headers" : { - "Date" : "Thu, 02 Apr 2026 08:15:45 GMT", + "Date" : "Wed, 27 May 2026 17:06:10 GMT", "Content-Type" : "application/json; charset=utf-8" } }, - "uuid" : "f1bd1a9f-c9c9-465d-9328-84d80ca0d4d1", + "uuid" : "d0e262d3-6c01-4f8e-a595-617dae7f3687", "persistent" : true, "insertionIndex" : 4 } \ No newline at end of file
