❯ Guillaume Laforge

Hands on Codelabs to dabble with Large Language Models in Java

Hot on the heels of the release of Gemini, I’d like to share a couple of resources I created to get your hands on large language models, using LangChain4J, and the PaLM 2 model. Later on, I’ll also share with you articles and codelabs that take advantage of Gemini, of course.

The PaLM 2 model supports 2 modes:

  • text generation,
  • and chat.

In the 2 codelabs, you’ll need to have created an account on Google Cloud, and created a project. The codelabs will guide you through the steps to setup the environment, and show you how to use the Google Cloud built-in shell and code editor, to develop in the cloud.

You should be a Java developer, as the examples are in Java, use the LangChain4J project, and Maven for building the code.

Generative AI text generation in Java with PaLM and LangChain4J

In the first codelab you can explore:

  • how to make your first call to PaLM for simple question/answer scenarios
  • how to extract structured data out of unstructured text
  • how to use prompts and prompt templates
  • how to classify text, with an example on sentiment analysis

Generative AI powered chat with users and docs in Java with PaLM and LangChain4J

In the second codelab you’ll use the chat model to learn:

  • how to create your first chat with the PaLM model
  • how to give your chatbot a personality, with an example with a chess player
  • how to extract structured data out of unstructured text using LangChain4J’s AiServices and its annotations
  • how to implement Retrieval Augmented Generation (RAG) to answer questions about your own documentation

Going further with Generative AI

If you’re interested in going further with Generative AI, and learn more, feel free to join the Google Cloud Innovators program.

Google Cloud Innovators is free and includes:

  • live discussions, AMAs, and roadmap sessions to learn the latest directly from Googlers,
  • the latest Google Cloud news right in your inbox,
  • digital badge and video conference background,
  • and more.

Go check what the program offers!