🤖 AI Summary
This post demonstrates multiple ways to integrate Groovy with modern LLM tooling—showcasing Ollama4j, LangChain4j (and its JVM AiServices abstraction), Spring AI, Embabel, and Quarkus/Micronaut adapters—using a simple chat example (asking for vacation activities). The author emphasizes running smaller open-source models locally (mistral:7b, and qwen3:8b for better tool use) via Ollama so you don’t need API keys or tokens, and provides Docker/GitHub Actions recipes. It’s presented with Groovy 5 and JDK 25 (but compatible with other JVM versions), demonstrating practical end-to-end patterns: client creation and ping, chat requests, conversational history, and conversation memory.
Technically, the post gives concrete snippets: Ollama4j usage (new Ollama(requestTimeoutSeconds:300), OllamaChatRequestBuilder, chat and chatHistory), LangChain4j’s OllamaChatModel builder (baseUrl http://localhost:11434, timeout, modelName), and AiServices with MessageWindowChatMemory for automatic conversational state. It also shows structured output using RESPONSE_FORMAT_JSON_SCHEMA mapped to Java/Groovy records (enabling typed List<Activity> returns). The takeaways for AI/ML and JVM developers are clear—rapid prototyping with local LLMs, easy provider swapping via config, built-in memory patterns, and schema-backed outputs that simplify building reliable, typed assistants on the JVM.
Loading comments...
login to comment
loading comments...
no comments yet