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

paulk pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/groovy-website.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new 109f427  minor changes and publish
109f427 is described below

commit 109f427637e6190161f18fc14529d1b2476f1813
Author: Paul King <[email protected]>
AuthorDate: Wed Oct 15 06:27:04 2025 +1000

    minor changes and publish
---
 site/src/site/blog/groovy-ai.adoc | 31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/site/src/site/blog/groovy-ai.adoc 
b/site/src/site/blog/groovy-ai.adoc
index eab549d..86d1ba1 100644
--- a/site/src/site/blog/groovy-ai.adoc
+++ b/site/src/site/blog/groovy-ai.adoc
@@ -1,31 +1,34 @@
 = Exploring AI with Groovy&trade;
 Paul King <paulk-asert|PMC_Member>
-:revdate: 2025-10-14T19:27:25+00:00
+:revdate: 2025-10-15T07:06:20+00:00
 :keywords: groovy, ai, ollama4j, langchain4j, spring-ai, embabel
 :description: A tour of using Groovy with modern AI libraries including 
ollama4j, LangChain4j, Spring AI, and Embabel.
-:draft: true
 
 == Introduction
 
 > [blue]#In this post, we’ll look at several ways to integrate Groovy with AI 
 > tools, including `ollama4j`, `langchain4j`, `Spring AI`, and `Embabel`.#
 
-image:img/bulcock_beach_sunset.jpg[Bulcock Beach, 350, float="right"]
+image:img/bulcock_beach_sunset.jpg[Bulcock Beach at Sunset looking towards 
Pumicestone Passage, 320, float="right"]
 
 We'll use a simple chat example, perhaps similar to what you might have done 
yourself when trying out your favourite LLM.
 We'll ask for activities to do while on vacation.
 
 To make the examples as accessible as possible, we'll use Ollama's open-source 
models,
-which can be run locally. The libraries we use here can also connect to remote 
models and services.
+which can be run locally. So, no need to get keys, or use up your token limits.
+The libraries we use here can also connect to remote models and services.
+
 The examples mostly use the `mistral:7b` model, which you'll need to download 
to run the examples
 unchanged, but feel free to try other models and see what results you get.
 We also used Groovy 5 and JDK 25, but the examples should work on other Groovy 
and Java versions.
 
 == Using ollama4j
 
+Since we are using Ollama, we'll start with a library aimed directly at that 
tool.
 https://github.com/ollama/ollama4j[_Ollama4j_] provides a client for 
interacting with local or remote https://ollama.com/[Ollama] models.
 
 We first create an instance of the `Ollama` class.
-We set a generous timeout to allow for longer-running models.
+We set a generous timeout to allow for longer-running models
+but otherwise leave the defaults as is.
 While not strictly necessary, we can call the `ping` method to verify that the 
Ollama server is reachable.
 
 [source,groovy]
@@ -92,7 +95,8 @@ Best thing:
 
 == Using LangChain4j
 
-https://github.com/langchain4j/langchain4j[_LangChain4j_] brings LangChain’s 
composable AI approach to the JVM.
+https://github.com/langchain4j/langchain4j[_LangChain4j_] brings LangChain’s 
composable AI approach to the JVM. Its unified API might be a good option if 
you want to experiment with different models and providers later.
+
 Here’s the same initial prompt using its `OllamaChatModel` interface:
 
 [source,groovy]
@@ -122,8 +126,11 @@ Response:
 
 == Using Spring AI
 
-https://docs.spring.io/spring-ai/reference/[_Spring AI_] provides first-class 
integration with the Spring ecosystem.
-In Groovy, this makes it simple to embed AI capabilities into a Spring Boot 
app.
+https://docs.spring.io/spring-ai/reference/[_Spring AI_] provides first-class 
integration with the Spring ecosystem. This would be a good option if you are 
already using Spring Boot or need
+its integration and deployment capabilities.
+
+In Groovy, it's simple to embed AI capabilities into a Spring Boot app.
+Our entire script is shown below:
 
 [source,groovy]
 ----
@@ -139,6 +146,9 @@ void main() {
 }
 ----
 
+We also need to set up a few properties, e.g. in `application.properties`,
+to tell Spring AI to use Ollama and our chosen model.
+
 The output might look something like:
 
 ----
@@ -290,7 +300,7 @@ Activity(Explore the Eumundi Markets, Eumundi Markets, 
Eumundi, Day 4, Morning t
 
 As a final example, let's look at how Embabel can orchestrate multiple AI 
calls using its agent model.
 
-Let's first extend our domain model to be able to have a bunch of alternative 
itineraries
+Let's first extend our domain model to be able to support a set of alternative 
itineraries
 and allow them to be rated.
 
 [source,groovy]
@@ -347,6 +357,9 @@ void main() {
 }
 ----
 
+Here we are using two different models for different tasks — `mistral:7b` for 
generating itineraries and `qwen3:8b` for rating them. Embabel provides richer 
ways to control and configure the models, but this simple approach works well 
for our example.
+The `@AchievesGoal` annotation makes use of Embabel's goal oriented action 
planning (GOAP) capabilities.
+
 The output might look something like (slightly formatted here for readability):
 
 ----

Reply via email to