1 of 34

Going hands-on with Gemini 2.0 Flash and Google Unified SDK

Singapore

2 of 34

Let’s Get Started!

3 of 34

Before Workshop - Setting up

Build

with AI

4 of 34

Setting up

1. Go to trygcp.dev/e/bwai-sg-mar22

5 of 34

Setting up

2. Sign in

(with the right Google Account)

trygcp.dev/e/bwai-sg-mar22

6 of 34

Setting up

3. Validate Details

Correct Google Account?

(Don’t redeem to company or inactive email account!)

Email address double check

Don’t share!

trygcp.dev/e/bwai-sg-mar22

7 of 34

Setting up

4. Accept and continue

(If you accept terms and conditions 😬)

trygcp.dev/e/bwai-sg-mar22

8 of 34

Setting up

5. Go to console.cloud.google.com/billing

trygcp.dev/e/bwai-sg-mar22

9 of 34

Setting up

6. Check for the Google Cloud Platform Trial Billing Account

trygcp.dev/e/bwai-sg-mar22

10 of 34

Setting up

7. Go to console.cloud.google.com/projectcreate

trygcp.dev/e/bwai-sg-mar22

11 of 34

Setting up

8. Create new project, with billing account as “Google Cloud Platform Trial Billing Account”

trygcp.dev/e/bwai-sg-mar22

12 of 34

Setting up

In case you cannot select a billing account earlier

Check console.cloud.google.com/billing/projects and make sure your project is tied to the right project

13 of 34

Setting up

9. To to the home page console.cloud.google.com , and search for “Vertex AI API

10. Double check if right project, and then click “ENABLE

14 of 34

Workshop Part 0 - TL;DR

Build

with AI

15 of 34

Learning outcomes

Workshop

  • Try out Colab
  • Use Gemini 2.0 Flash ⚡
  • Learn from simple, multimodal, grounding, code execution use cases

16 of 34

Tip #1 - “Shift”+”Enter” to progress through the cells in Colab / Jupyter Notebook

Workshop

17 of 34

Tip #2 - Opps I accidentally clicked a markdown cell? “Ctrl”+”Enter” to restore!

Workshop

18 of 34

Workshop

(If you want to self-run) Scan the following QR code

I’ll also be running through this slidedeck and explaining along the way, so follow along my pace if you want an in-depth learning experience.

19 of 34

Workshop 1 - Intro to Gemini 2.0 Flash

Build

with AI

20 of 34

Accessing Workshop 1 - “Intro to Gemini 2.0 Flash

Workshop

1. Go to URL: bit.ly/bwai-gemini-2-intro-lab

2. Select “Open in Colab

3. Select “Copy to Drive

21 of 34

Get your Project Id from “console.cloud.google.com

Workshop

22 of 34

What the “async” (and coroutines)?

Workshop

https://www.jetify.com/blog/python-coroutines-and-the-cloud/

https://docs.python.org/3/library/asyncio-task.html#coroutine

23 of 34

Testing parameters like temperature - can use Google AI Studio

Workshop

https://aistudio.google.com/

24 of 34

Threshold values enum values

Workshop

https://cloud.google.com/python/docs/reference/aiplatform/latest/google.cloud.aiplatform_v1.types.SafetySetting.HarmBlockThreshold

Name

Description

HARM_BLOCK_THRESHOLD_UNSPECIFIED

Unspecified harm block threshold.

BLOCK_LOW_AND_ABOVE

Block low threshold and above (i.e. block more).

BLOCK_MEDIUM_AND_ABOVE

Block medium threshold and above.

BLOCK_ONLY_HIGH

Block only high threshold (i.e. block less).

BLOCK_NONE

Block none.

OFF

Turn off the safety filter.

25 of 34

Function Calling

Workshop

https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling

26 of 34

Code Execution

Workshop

https://ai.google.dev/gemini-api/docs/code-execution

https://github.com/googleapis/python-genai/blob/fe444a5a06b747df06ab94846eed19f784fb4584/google/genai/types.py

27 of 34

(Self-drive) Workshop 2 - Getting started with Google Generative AI using the Gen AI SDK

Build

with AI

28 of 34

Accessing Workshop 2 - “Getting started … using the Gen AI SDK

Workshop

1. Go to URL: bit.ly/bwai-gemini-2-sdk-lab

2. Select “Open in Colab

3. Select “Copy to Drive

29 of 34

Get your Project Id from “console.cloud.google.com

Workshop

30 of 34

Skip to “Use context caching

Workshop

31 of 34

Context caching files

Workshop

  • File 1: https://storage.googleapis.com/cloud-samples-data/generative-ai/pdf/2312.11805v3.pdf
  • File 2: https://storage.googleapis.com/cloud-samples-data/generative-ai/pdf/2403.05530.pdf

32 of 34

Batch requests file

Workshop

  • File: https://storage.googleapis.com/cloud-samples-data/generative-ai/batch/batch_requests_for_multimodal_input_2.jsonl

33 of 34

Build

with AI

34 of 34

Thank you!

Resources

Liu Weiyuan

big-on.dev/-/weiyuan

bit.ly/weiyuan-linkedin