❯ Guillaume Laforge

Machine-Learning

Let's think with Gemini Flash 2.0's experimental thinking mode and LangChain4j

Yesterday, Google released yet another cool Gemini model update, with Gemini 2.0 Flash thinking mode. Integrating natively and transparently some chain of thought techniques, the model is able to take some more thinking time, and automatically decomposes a complex task into smaller steps, and explores various paths in its thinking process. Thanks to this approach, Gemini 2.0 Flash is able to solve more complex problems than Gemini 1.5 Pro or the recent Gemini 2. Read more...

Detecting objects with Gemini 2.0 and LangChain4j

Hot on the heels of the announcement of Gemini 2.0, I played with the new experimental model both from within Google AI Studio, and with LangChain4j. Google released Gemini 2.0 Flash, with new modalities, including interleaving images, audio, text, video, both in input and output. Even a live bidirectional speech-to-speech mode, which is really exciting! When experimenting with AI Studio, what attracted my attention was AI Studio’s new starter apps section. Read more...

Semantic code search for Programming Idioms with LangChain4j and Vertex AI embedding models

By Guillaume Laforge & Valentin Deleplace The Programming Idioms community website created by Valentin lets developers share typical implementations in various programming languages for usual tasks like printing the famous β€œHello World!” message, counting the characters in a string, sorting collections, or formatting dates, to name a few. And many more: there are currently 350 idioms, covering 32 programming languages. It’s a nice way to discover how various languages implement such common tasks! Read more...

Redacting sensitive information when using Generative AI models

As we are making our apps smarter with the help of Large Language Models, we must keep in mind that we are often dealing with potentially sensitive information coming from our users. In particular, in the context of chatbots, our application users have the ability to input any text in the conversation. Personally Identifiable Information (PII) should be dealt with the highest level of attention, because we care about our users, we don’t want to leak their personal details, and we must comply with all sorts of laws or regulations. Read more...

Data extraction: The many ways to get LLMs to spit JSON content

Data extraction from unstructured text is a very important task where LLMs shine, as they understand human languages well. Rumor has it that 80% of the worldwide knowledge and data comes in the form of unstructured text (vs 20% for data stored in databases, spreadsheets, JSON/XML, etc.) Let’s see how we can get access to that trove of information thanks to LLMs. In this article, we’ll have a look at different techniques to make LLMs generate JSON output and extract data from text. Read more...

A Gemini and Gemma tokenizer in Java

It’s always interesting to know how the sausage is made, don’t you think? That’s why, a while ago, I looked at embedding model tokenization, and I implemented a little visualization to see the tokens in a colorful manner. Yet, I was still curious to see how Gemini would tokenize text… Both LangChain4j Gemini modules (from Vertex AI and from Google AI Labs) can count the tokens included in a piece of text. Read more...

AI Inktober β€” Generating ink drawings with Imagen 3

Every year, in October, takes place the Inktober challenge: every day of the month, you have to do a drawing representing the word of the day. The list of prompts this year is the following: I participated to some of the daily challenges the past few years, but I never did all of them. But this year, for the fun, I thought I could ask Google’s Imagen 3 image model to draw for me! Read more...

Some advice and good practices when integrating an LLM in your application

When integrating an LLM into your applicaton to extend it and make it smarter, it’s important to be aware of the pitfalls and best practices you need to follow to avoid some common problems and integrate them successfully. This article will guide you through some key best practices that I’ve come across. Understanding the Challenges of Implementing LLMs in Real-World Applications One of the first challenges is that LLMs are constantly being improved. Read more...

The power of embeddings: How numbers unlock the meaning of data

Prelude As I’m focusing a lot on Generative AI, I’m curious about how things work under the hood, to better understand what I’m using in my gen-ai powered projects. A topic I’d like to focus on more is: vector embeddings, to explain more clearly what they are, how they are calculated, and what you can do with them. A colleague of mine, AndrΓ©, was showing me a cool experiment he’s been working on, to help people prepare an interview, with the help of an AI, to shape the structure of the resulting final article to write. Read more...

Image generation with Imagen and LangChain4j

This week LangChain4j, the LLM orchestration framework for Java developers, released version 0.26.1, which contains my first significant contribution to the open source project: support for the Imagen image generation model. Imagen is a text-to-image diffusion model that was announced last year. And it recently upgraded to Imagen v2, with even higher quality graphics generation. As I was curious to integrate it in some of my generative AI projects, I thought that would be a great first contribution to LangChain4j. Read more...