Slide 1

Slide 1 text

Gemini — Google’s Large Multimodal Model (for the Java developer) Guillaume Laforge Developer Advocate @[email protected]

Slide 2

Slide 2 text

Google Cloud 2 ♊ https://pixabay.com/illustr ations/constellation-const ellation-map-3301774/

Slide 3

Slide 3 text

https://en.wikipedia.org/wiki/Gemini_12#/ media/File:S66-63536.jpg

Slide 4

Slide 4 text

Google Research & DeepMind innovations

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

Available in 3 sizes

Slide 7

Slide 7 text

Natively multimodal Advanced Coding Sophisticated reasoning

Slide 8

Slide 8 text

Google Cloud 8 Gemini Gemini everywhere

Slide 9

Slide 9 text

Multimodal

Slide 10

Slide 10 text

Gemini 1.5 model

Slide 11

Slide 11 text

Large context window in action: “One small step for a man…”

Slide 12

Slide 12 text

Large context window in action: videos!

Slide 13

Slide 13 text

Open model derived from Gemini

Slide 14

Slide 14 text

Google Cloud Gemma at a glance SOTA Excellent benchmark results Base & Instruction Tuned models 2B & 7B parameters Run it on Vertex AI, GKE, your laptop! Gemma is a family of lightweight, state-of-the art open models built from the same research and technology used to create Gemini 14

Slide 15

Slide 15 text

Google Cloud Gemma performance benchmark 15

Slide 16

Slide 16 text

Google Cloud 16 Gemini Gemma Type Closed, proprietary Open Size Very large Smaller (2B & 7B versions) Modality Text, image, video, speech Only text Languages 39 languages English-only Function calling ✅ ❌ Context window 32K for 1.0 Pro (8K out max) 1M+ for 1.5 Pro 8K tokens (in + out) Performance State-of-the-art in large models, high quality out-of-the-box State-of-the-art in its class, but can require fine-tuning Use cases Enterprise, scale, SLOs, model updates, etc. Experimentation, research, education Can run locally, privacy Pricing & Management Fully managed API Pay per character/token Manage yourself Pay for your own hardware & hosting Customization Through managed tuning: supervised, RLHF, distillation Programmatically modify underlying weights

Slide 17

Slide 17 text

Time for some 🥤Java!

Slide 18

Slide 18 text

Google Cloud 18 Python is all the rage in AI… What’s in it for us, Java developers? https://pixabay.com/photos/snake-repti le-python-boa-anaconda-7386684/

Slide 19

Slide 19 text

Google Cloud 19 Option 1⃣ → Gemini SDK ● https://github.com/googleapis/google-cloud-java/tree/main/java-vertexai ● https://github.com/GoogleCloudPlatform/java-docs-samples/ tree/main/vertexai/snippets/src/main/java/vertexai/gemini ● https://cloud.google.com/java/docs/reference/google-cloud-vertexai/

Slide 20

Slide 20 text

Google Cloud 20 Option 2⃣ → LangChain4j

Slide 21

Slide 21 text

Google Cloud More advanced use cases! What we’ll see ● Simple question / answer (streaming and non-streaming) ● Analyzing images with text prompts (multimodality) ● Maintain chat conversations ● Text classification with few-shot prompting ● Extract structured data from unstructured text ● Chat with your docs with Retrieval Augmented Generation ● Extend with Function Calling to access external APIs ● Gemma via Ollama, and TestContainers

Slide 22

Slide 22 text

From RAGs to riches

Slide 23

Slide 23 text

Google Cloud 23 Searching the Apache Groovy documentation Apply the RAG pattern: Retrieval Augmented Generation

Slide 24

Slide 24 text

LLM Vector DB vector embeddings chunks DOCS calculate split store vector + chunk ❶ INGESTION RAG

Slide 25

Slide 25 text

Chatbot app LLM Vector DB vector embeddings chunks DOCS calculate prompt vector embedding split calculate find similar answer context + prompt + chunks store vector + chunk ❶ INGESTION ❷ QUERYING RAG

Slide 26

Slide 26 text

Function calling “Don’t call me, I’ll call you!”

Slide 27

Slide 27 text

Chatbot app Gemini What’s the weather like in Paris? It’s sunny in Paris! External API or service user prompt + getWeather(String) function contract call getWeather(“Paris”) for me please 󰚦 getWeather(“Paris”) {“forecast”:”sunny”} function response is {“forecast”:”sunny”} Answer: “It’s sunny in Paris!” Function calling

Slide 28

Slide 28 text

Running Gemma via Ollama & Jlama https://github.com/tjake/Jlama https://ollama.com/ via

Slide 29

Slide 29 text

Gemma via Ollama in TestContainers Why is the sky blue? Chatbot app Ollama container Gemma Rayleigh scattering

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

Thanks! Guillaume Laforge Developer Advocate @[email protected]