You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by al...@apache.org on 2025/07/01 13:32:09 UTC

(camel-quarkus-examples) branch camel-quarkus-main updated: data-extract: upgrade to granite 3.3

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

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


The following commit(s) were added to refs/heads/camel-quarkus-main by this push:
     new f2db3ae  data-extract: upgrade to granite 3.3
f2db3ae is described below

commit f2db3ae58acdaed2a1a041e0489ce9d878183d99
Author: aldettinger <al...@gmail.com>
AuthorDate: Mon Jun 30 15:12:05 2025 +0200

    data-extract: upgrade to granite 3.3
---
 data-extract-langchain4j/README.adoc               |  6 +++---
 .../src/main/resources/application.properties      |  2 +-
 .../org/acme/extraction/OllamaTestResource.java    |  2 +-
 ..._chat-2d69eec9-693a-4f8d-ba28-0c7acac45fac.json | 24 ++++++++++++++++++++++
 ...chat-302d1529-355e-4638-a605-a976c07c30df.json} | 10 ++++-----
 ..._chat-7aae2c51-f61d-45bb-a2d7-ca47efeb6888.json | 24 ++++++++++++++++++++++
 ..._chat-c3c87953-6b35-4fd9-bdb2-b7cc4d7bc13d.json | 24 ----------------------
 ..._chat-e2dbcf66-5f06-4c87-a137-bb3a7781fefa.json | 24 ----------------------
 8 files changed, 58 insertions(+), 58 deletions(-)

diff --git a/data-extract-langchain4j/README.adoc b/data-extract-langchain4j/README.adoc
index 8e94f9d..c21b29f 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/granite3.2:2b[granite3.2:2b] served through https://ollama.com/[ollama] as it seems compute friendly and under Apache V2 license.
+Here, we choose https://ollama.com/library/granite3.3:2b[granite3.3:2b] served through https://ollama.com/[ollama] as it seems compute friendly and under Apache V2 license.
 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].
 More precisely, we'll setup the https://docs.quarkiverse.io/quarkus-langchain4j/dev/index.html[Quarkus LangChain4j extension] to register an AiService bean.
 Finally, we'll invoke the AiService extraction method via the https://camel.apache.org/camel-quarkus/latest/reference/extensions/bean.html[Camel Quarkus bean extension].
@@ -26,7 +26,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.5.13
+docker run --rm -it -v cqex-data-extract-ollama:/root/.ollama -p 11434:11434 --name cqex-data-extract-ollama ollama/ollama:0.9.3
 ----
 
 After a moment, a log like below should be output:
@@ -40,7 +40,7 @@ Then, download the codellama model, in a second shell type:
 
 [source,shell]
 ----
-docker exec -it cqex-data-extract-ollama ollama pull granite3.2:2b
+docker exec -it cqex-data-extract-ollama ollama pull granite3.3:2b
 ----
 
 After a moment, log like below should be output:
diff --git a/data-extract-langchain4j/src/main/resources/application.properties b/data-extract-langchain4j/src/main/resources/application.properties
index af6311e..c7ef726 100644
--- a/data-extract-langchain4j/src/main/resources/application.properties
+++ b/data-extract-langchain4j/src/main/resources/application.properties
@@ -21,7 +21,7 @@ quarkus.banner.enabled = false
 # Configure Quarkus LangChain4j that handle interactions with the Large Language Model
 quarkus.langchain4j.ollama.base-url = http://localhost:11434
 quarkus.langchain4j.ollama.timeout = 3m
-quarkus.langchain4j.ollama.chat-model.model-id = granite3.2:2b
+quarkus.langchain4j.ollama.chat-model.model-id = granite3.3:2b
 quarkus.langchain4j.ollama.chat-model.temperature = 0
 # Uncomment lines below to log Ollama client requests and responses
 #quarkus.langchain4j.ollama.log-requests=true
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 d4e4773..4b4728e 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.5.13";
+    private static final String OLLAMA_IMAGE = "ollama/ollama:0.9.3";
     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-2d69eec9-693a-4f8d-ba28-0c7acac45fac.json b/data-extract-langchain4j/src/test/resources/mappings/api_chat-2d69eec9-693a-4f8d-ba28-0c7acac45fac.json
new file mode 100644
index 0000000..66639ca
--- /dev/null
+++ b/data-extract-langchain4j/src/test/resources/mappings/api_chat-2d69eec9-693a-4f8d-ba28-0c7acac45fac.json
@@ -0,0 +1,24 @@
+{
+  "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-06cec226-1f5d-4cb4-8e01-5df16f809497.json b/data-extract-langchain4j/src/test/resources/mappings/api_chat-302d1529-355e-4638-a605-a976c07c30df.json
similarity index 67%
rename from data-extract-langchain4j/src/test/resources/mappings/api_chat-06cec226-1f5d-4cb4-8e01-5df16f809497.json
rename to data-extract-langchain4j/src/test/resources/mappings/api_chat-302d1529-355e-4638-a605-a976c07c30df.json
index e75411b..4f31221 100644
--- a/data-extract-langchain4j/src/test/resources/mappings/api_chat-06cec226-1f5d-4cb4-8e01-5df16f809497.json
+++ b/data-extract-langchain4j/src/test/resources/mappings/api_chat-302d1529-355e-4638-a605-a976c07c30df.json
@@ -1,24 +1,24 @@
 {
-  "id" : "06cec226-1f5d-4cb4-8e01-5df16f809497",
+  "id" : "302d1529-355e-4638-a605-a976c07c30df",
   "name" : "api_chat",
   "request" : {
     "url" : "/api/chat",
     "method" : "POST",
     "bodyPatterns" : [ {
-      "equalToJson" : "{\n  \"model\" : \"granite3.2: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.2:2b\",\"created_at\":\"2025-03-14T09:02:50.38627784Z\",\"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, called to declare an accident on her main vehicle. The operator confirmed they would reimburse all expenses related to the  [...]
+    "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\ [...]
     "headers" : {
-      "Date" : "Fri, 14 Mar 2025 09:02:50 GMT",
+      "Date" : "Mon, 30 Jun 2025 13:10:15 GMT",
       "Content-Type" : "application/json; charset=utf-8"
     }
   },
-  "uuid" : "06cec226-1f5d-4cb4-8e01-5df16f809497",
+  "uuid" : "302d1529-355e-4638-a605-a976c07c30df",
   "persistent" : true,
   "insertionIndex" : 6
 }
\ 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
new file mode 100644
index 0000000..8df44d4
--- /dev/null
+++ b/data-extract-langchain4j/src/test/resources/mappings/api_chat-7aae2c51-f61d-45bb-a2d7-ca47efeb6888.json
@@ -0,0 +1,24 @@
+{
+  "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
diff --git a/data-extract-langchain4j/src/test/resources/mappings/api_chat-c3c87953-6b35-4fd9-bdb2-b7cc4d7bc13d.json b/data-extract-langchain4j/src/test/resources/mappings/api_chat-c3c87953-6b35-4fd9-bdb2-b7cc4d7bc13d.json
deleted file mode 100644
index 51cc551..0000000
--- a/data-extract-langchain4j/src/test/resources/mappings/api_chat-c3c87953-6b35-4fd9-bdb2-b7cc4d7bc13d.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
-  "id" : "c3c87953-6b35-4fd9-bdb2-b7cc4d7bc13d",
-  "name" : "api_chat",
-  "request" : {
-    "url" : "/api/chat",
-    "method" : "POST",
-    "bodyPatterns" : [ {
-      "equalToJson" : "{\n  \"model\" : \"granite3.2: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 expressed dissatisfaction with the insurance company's automatic cancellation of a full reimbursement option for his vehicle accident claim. He f [...]
-      "ignoreArrayOrder" : true,
-      "ignoreExtraElements" : true
-    } ]
-  },
-  "response" : {
-    "status" : 200,
-    "body" : "{\"model\":\"granite3.2:2b\",\"created_at\":\"2025-03-14T09:03:17.771401633Z\",\"message\":{\"role\":\"assistant\",\"content\":\"{\\n  \\\"customerSatisfied\\\": true,\\n  \\\"customerName\\\": \\\"Kate Boss\\\",\\n  \\\"customerBirthday\\\": {\\\"year\\\": 1999, \\\"month\\\": 8, \\\"day\\\": 13},\\n  \\\"summary\\\": \\\"Customer Kate Boss requested assistance from the operator to provide proof of insurance for an accident at a police station. She initially provided incor [...]
-    "headers" : {
-      "Date" : "Fri, 14 Mar 2025 09:03:17 GMT",
-      "Content-Type" : "application/json; charset=utf-8"
-    }
-  },
-  "uuid" : "c3c87953-6b35-4fd9-bdb2-b7cc4d7bc13d",
-  "persistent" : true,
-  "insertionIndex" : 4
-}
\ No newline at end of file
diff --git a/data-extract-langchain4j/src/test/resources/mappings/api_chat-e2dbcf66-5f06-4c87-a137-bb3a7781fefa.json b/data-extract-langchain4j/src/test/resources/mappings/api_chat-e2dbcf66-5f06-4c87-a137-bb3a7781fefa.json
deleted file mode 100644
index d795e64..0000000
--- a/data-extract-langchain4j/src/test/resources/mappings/api_chat-e2dbcf66-5f06-4c87-a137-bb3a7781fefa.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
-  "id" : "e2dbcf66-5f06-4c87-a137-bb3a7781fefa",
-  "name" : "api_chat",
-  "request" : {
-    "url" : "/api/chat",
-    "method" : "POST",
-    "bodyPatterns" : [ {
-      "equalToJson" : "{\n  \"model\" : \"granite3.2: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, called to declare an accident on her main vehicle. The operator confirmed they would reimburse all expenses related to the incident. [...]
-      "ignoreArrayOrder" : true,
-      "ignoreExtraElements" : true
-    } ]
-  },
-  "response" : {
-    "status" : 200,
-    "body" : "{\"model\":\"granite3.2:2b\",\"created_at\":\"2025-03-14T09:03:02.662428274Z\",\"message\":{\"role\":\"assistant\",\"content\":\"{\\n  \\\"customerSatisfied\\\": false,\\n  \\\"customerName\\\": \\\"John Doe\\\",\\n  \\\"customerBirthday\\\": {\\\"year\\\": 2001, \\\"month\\\": 11, \\\"day\\\": 1},\\n  \\\"summary\\\": \\\"Customer John Doe expressed dissatisfaction with the insurance company's automatic cancellation of a full reimbursement option for his vehicle accident c [...]
-    "headers" : {
-      "Date" : "Fri, 14 Mar 2025 09:03:02 GMT",
-      "Content-Type" : "application/json; charset=utf-8"
-    }
-  },
-  "uuid" : "e2dbcf66-5f06-4c87-a137-bb3a7781fefa",
-  "persistent" : true,
-  "insertionIndex" : 5
-}
\ No newline at end of file