❯ Guillaume Laforge

Groovy

Let's make Gemini Groovy!

The happy users of Gemini Advanced, the powerful AI web assistant powered by the Gemini model, can execute some Python code, thanks to a built-in Python interpreter. So, for math, logic, calculation questions, the assistant can let Gemini invent a Python script, and execute it, to let users get a more accurate answer to their queries. But wearing my Apache Groovy hat on, I wondered if I could get Gemini to invoke some Groovy scripts as well, for advanced math questions! Read more...

Discovering LangChain4J, the Generative AI orchestration library for Java developers

As I started my journey with Generative AI and Large Language Models, I’ve been overwhelmed with the omnipresence of Python. Tons of resources are available with Python front and center. However, I’m a Java developer (with a penchant for Apache Groovy, of course). So what is there for me to create cool new Generative AI projects? When I built my first experiment with the PaLM API, using the integration within the Google Cloud’s Vertex AI offering, I called the available REST API, from my Micronaut application. Read more...

Creating kids stories with Generative AI

Last week, I wrote about how to get started with the PaLM API in the Java ecosystem, and particularly, how to overcome the lack of Java client libraries (at least for now) for the PaLM API, and how to properly authenticate. However, what I didn’t explain was what I was building! Let’s fix that today, by telling you a story, a kid story! Yes, I was using the trendy Generative AI approach to generate bedtime stories for kids. Read more...

Getting started with the PaLM API in the Java ecosystem

Large Language Models (LLMs for short) are taking the world by storm, and things like ChatGPT have become very popular and used by millions of users daily. Google came up with its own chatbot called Bard, which is powered by its ground-breaking PaLM 2 model and API. You can also find and use the PaLM API from withing Google Cloud as well (as part of Vertex AI Generative AI products) and thus create your own applications based on that API. Read more...

Exploring Open Location Code

When using Google Maps, you might have seen those strange little codes, as in the screenshot above. This is a plus code, or to use the more official name, an Open Location Code. It’s a way to encode a location in a short and (somewhat) memorable form. In countries like France, every house has an official address, so you can easily receive letters or get some parcel delivered. But there are countries where no such location system exists, so you have to resort to describing where you live (take this road, turn right after the red house, etc. Read more...

Tip: Visualize output in the Groovy Console

For some scripting tasks, my favorite go-to tool is the Groovy Console, and writing code with Apache Groovy. Usually, you just spill some println calls all over the place to display some textual information. But there’s a little known secret. Not really secret though, as it’s properly documented. It’s possible to display images (like BufferedImage or its parent java.awt.Image) or all sorts of rich components (from the Swing UI toolkit, like JPanel, JLabel, etc. Read more...

New blog location

I started blogging 20 years ago, in April 2003. My first blog engine was a PHP CMS, called Nucleus. I was hosting it on my ISP, at free.fr. Then in 2011, I wrote my own blog engine, called Bloogaey, which was written in Groovy, using my little Gaelyk web framework, and running on App Engine. As it became a bit painful to properly format my blog posts, and evolve my blog engine, I decided I should move to something that is more static, with a static site generator that eats Markdown files: I chose the Hugo static site generator that I used in some previous projects. Read more...

Sip a Cup of Java 11 for Your Cloud Functions

With the beta of the new Java 11 runtime for Google Cloud Functions, Java developers can now write their functions using the Java programming language (a language often used in enterprises) in addition to Node.js, Go, or Python. Cloud Functions allow you to run bits of code locally or in the cloud, without provisioning or managing servers: Deploy your code, and let the platform handle scaling up and down for you. Read more...

Deploying serverless functions in Groovy on the new Java 11 runtime for Google Cloud Functions

Java celebrates its 25th anniversary! Earlier this year, the Apache Groovy team released the big 3.0 version of the programming language. GMavenPlus was published in version 1.9 (the Maven plugin for compiling Groovy code) which works with Java 14. And today, Google Cloud opens up the beta of the Java 11 runtime for Cloud Functions. What about combining them all? I’ve been working for a bit on the Java 11 runtime for Google Cloud Functions (that’s the Function-as-a-Service platform of Google Cloud, pay-as-you-go, hassle-free / transparent scaling), and in this article, I’d like to highlight that you can also write and deploy functions with alternative JVM languages like Apache Groovy. Read more...

Getting started with Micronaut on Google App Engine Java 11

A new Java runtime was announced for Google App Engine standard: with Java 11. It’s currently in beta, but anybody can already try it out. Another interesting announcement was the fact that the instances running your apps now get double the memory! So with this double dose of great news, I decided to craft a little tutorial to show how to deploy a Micronaut application on App Engine Java 11. And because Apache Groovy is, well, groovy, I’ll go ahead and use Groovy for my programming language, but of course, the same steps apply to Java workloads as well. Read more...