Skip to content

Commit de43f20

Browse files
authored
Gemini 3 (#1037)
Updating the Get started and the thinking guides for Gemini 3 Pro
1 parent 3af5866 commit de43f20

File tree

102 files changed

+3980
-2487
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+3980
-2487
lines changed

.gemini/styleguide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Most of the cookbook content is Colab notebooks, which are stored as Json.
7070
* Only use helper function when you don't have a choice. If it's only a couple of lines, it's usually better to write them
7171
everytime so that the readers don't have to check the function definition all the time.
7272
* When selecting a model, use a colab selector for easier maintainability:
73-
`MODEL_ID="gemini-2.5-flash" # @param ["gemini-2.5-flash-lite","gemini-2.5-flash","gemini-2.5-pro"] {"allow-input":true, isTemplate: true}`
73+
`MODEL_ID="gemini-2.5-flash" # @param ["gemini-2.5-flash-lite","gemini-2.5-flash","gemini-2.5-pro","gemini-3-pro-preview"] {"allow-input":true, isTemplate: true}`
7474
* Some notebooks can also benefit from having a form to update the prompt:
7575
`prompt = "Detect the 2d bounding boxes of the cupcakes (with “label” as topping description”)" # @param {type:"string"}`
7676
or a list of prompts they can choose from:

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ If you have authored a new guide from scratch, you are welcome to include a byli
147147
* If you *must* use extra parameters, explain *why* they are needed and the reasoning behind the specific value the first time you use them.
148148
* When selecting a model, use a Colab form selector for easier maintainability:
149149
```python
150-
MODEL_ID="gemini-2.5-flash" # @param ["gemini-2.5-flash-lite", "gemini-2.5-flash", "gemini-2.5-pro"] {"allow-input":true, isTemplate: true}
150+
MODEL_ID="gemini-2.5-flash" # @param ["gemini-2.5-flash-lite", "gemini-2.5-flash", "gemini-2.5-pro", "gemini-3-pro-preview"] {"allow-input":true, isTemplate: true}
151151
```
152152
* Some notebooks can benefit from having a form to update the prompt:
153153
```python
@@ -158,7 +158,7 @@ If you have authored a new guide from scratch, you are welcome to include a byli
158158
prompt = "Draw a square around the fox' shadow" # @param ["Find the two origami animals.", "Where are the origamis' shadows?","Draw a square around the fox' shadow"] {"allow-input":true}
159159
```
160160
* To ensure notebook text remains accurate, present model metadata (like context window size) by executing code, not by hardcoding it in Markdown.
161-
* Example: Instead of writing "This model has a 1M token context window", display the output of `client.models.get('models/gemini-2.5-pro').input_token_limit`.
161+
* Example: Instead of writing "This model has a 1M token context window", display the output of `client.models.get('models/gemini-2.5-flash').input_token_limit`.
162162

163163
## Naming Conventions
164164

README.md

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ This cookbook provides a structured learning path for using the Gemini API, focu
55
**For comprehensive API documentation, visit [ai.google.dev](https://ai.google.dev/gemini-api/docs).**
66
<br><br>
77

8+
---
9+
> <font color="#1a73e8">**Gemini 3 Pro**: For the latest on our new model, please check the [Get Started](./quickstarts/Get_started.ipynb) [![Colab](https://storage.googleapis.com/generativeai-downloads/images/colab_icon16.png)](https://colab.research.google.com/github/google-gemini/cookbook/blob/main/quickstarts/Get_started.ipynb#gemini3) and the [thinking](./quickstarts/Get_started_thinking.ipynb) [![Colab](https://storage.googleapis.com/generativeai-downloads/images/colab_icon16.png)](https://colab.research.google.com/github/google-gemini/cookbook/blob/main/quickstarts/Get_started_thinking.ipynb#gemini3) guides who include [migration guides](https://colab.research.google.com/github/google-gemini/cookbook/blob/main/quickstarts/Get_started.ipynb#gemini3migration).</font>
10+
---
11+
812
## Navigating the Cookbook
913

1014
This cookbook is organized into two main categories:
@@ -74,8 +78,10 @@ These examples demonstrate how to combine multiple Gemini API features or 3rd-pa
7478

7579
These fully functional, end-to-end applications showcase the power of Gemini in real-world scenarios.
7680

81+
* [Gemini CLI](https://github.com/google-gemini/gemini-cli): Open-source AI agent that brings the power of Gemini directly into your terminal
7782
* [Gemini API quickstart](https://github.com/google-gemini/gemini-api-quickstart): Python Flask App running with the Google AI Gemini API, designed to get you started building with Gemini's multi-modal capabilities
7883
* [Multimodal Live API Web Console](https://github.com/google-gemini/multimodal-live-api-web-console): React-based starter app for using the Multimodal Live API over a websocket
84+
* [Fullstack Langgraph Quickstart](https://github.com/google-gemini/gemini-fullstack-langgraph-quickstart): A fullstack application using a React frontend and a LangGraph-powered backend agent
7985
* [Google AI Studio Starter Applets](https://github.com/google-gemini/starter-applets): A collection of small apps that demonstrate how Gemini can be used to create interactive experiences
8086
<br><br>
8187

@@ -91,31 +97,6 @@ The Gemini API is a REST API. You can call it directly using tools like `curl` (
9197
* [Swift](https://github.com/google/generative-ai-swift)
9298
<br><br>
9399

94-
95-
## Important: Migration
96-
97-
With Gemini 2 we are offering a [new SDK](https://github.com/googleapis/python-genai)
98-
(<code>[google-genai](https://pypi.org/project/google-genai/)</code>,
99-
<code>v1.0</code>). The updated SDK is fully compatible with all Gemini API
100-
models and features, including recent additions like the
101-
[live API](https://aistudio.google.com/live) (audio + video streaming),
102-
improved tool usage (
103-
[code execution](https://ai.google.dev/gemini-api/docs/code-execution?lang=python),
104-
[function calling](https://ai.google.dev/gemini-api/docs/function-calling/tutorial?lang=python) and integrated
105-
[Google search grounding](https://ai.google.dev/gemini-api/docs/grounding?lang=python)),
106-
and media generation ([Imagen](https://ai.google.dev/gemini-api/docs/imagen) and [Veo](https://ai.google.dev/gemini-api/docs/video)).
107-
This SDK allows you to connect to the Gemini API through either
108-
[Google AI Studio](https://aistudio.google.com/prompts/new_chat?model=gemini-2.5-flash) or
109-
[Vertex AI](https://cloud.google.com/vertex-ai/generative-ai/docs/gemini-v2).
110-
111-
The <code>[google-generativeai](https://pypi.org/project/google-generativeai)</code>
112-
package will continue to support the original Gemini models.
113-
It <em>can</em> also be used with Gemini 2 models, just with a limited feature
114-
set. All new features will be developed in the new Google GenAI SDK.
115-
116-
See the [migration guide](https://ai.google.dev/gemini-api/docs/migrate) for details.
117-
<br><br>
118-
119100
## Get Help
120101

121102
Ask a question on the [Google AI Developer Forum](https://discuss.ai.google.dev/).

examples/Agents_Function_Calling_Barista_Bot.ipynb

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"id": "zFjRBXVrAdYB"
7171
},
7272
"source": [
73-
"To run this notebook, your API key must be stored it in a Colab Secret named `GOOGLE_API_KEY`. If you are running in a different environment, you can store your key in an environment variable. See [Authentication](../quickstarts/Authentication.ipynb) to learn more."
73+
"To run this notebook, your API key must be stored it in a Colab Secret named `GOOGLE_API_KEY`. If you are running in a different environment, you can store your key in an environment variable. See [Authentication ![image](https://storage.googleapis.com/generativeai-downloads/images/colab_icon16.png)](../quickstarts/Authentication.ipynb) to learn more."
7474
]
7575
},
7676
{
@@ -342,7 +342,7 @@
342342
" confirm_order,\n",
343343
" place_order,\n",
344344
"]\n",
345-
"model_name = \"gemini-2.5-flash\" # @param [\"gemini-2.5-flash-lite\", \"gemini-2.5-flash-lite-preview-09-2025\", \"gemini-2.5-flash\", \"gemini-2.5-flash-preview-09-2025\", \"gemini-2.5-pro\"] {\"allow-input\":true}\n",
345+
"model_name = \"gemini-2.5-flash\" # @param [\"gemini-2.5-flash-lite\", \"gemini-2.5-flash\",\"gemini-2.5-pro\",\"gemini-3-pro-preview\"] {\"allow-input\":true}\n",
346346
"\n",
347347
"chat = client.chats.create(\n",
348348
" model=model_name,\n",
@@ -390,7 +390,9 @@
390390
},
391391
{
392392
"data": {
393-
"text/markdown": "Ok, I've added a Cappuccino with Almond Milk to your order. Anything else?\n",
393+
"text/markdown": [
394+
"Ok, I've added a Cappuccino with Almond Milk to your order. Anything else?\n"
395+
],
394396
"text/plain": [
395397
"<IPython.core.display.Markdown object>"
396398
]
@@ -407,7 +409,9 @@
407409
},
408410
{
409411
"data": {
410-
"text/markdown": "I'm sorry, I do not have stone milk. We only have Whole, 2%, Oat, Almond, and 2% Lactose Free milk options.\n",
412+
"text/markdown": [
413+
"I'm sorry, I do not have stone milk. We only have Whole, 2%, Oat, Almond, and 2% Lactose Free milk options.\n"
414+
],
411415
"text/plain": [
412416
"<IPython.core.display.Markdown object>"
413417
]
@@ -424,7 +428,9 @@
424428
},
425429
{
426430
"data": {
427-
"text/markdown": "I am sorry, I do not have Long Black. Would you like to order an Americano instead?\n",
431+
"text/markdown": [
432+
"I am sorry, I do not have Long Black. Would you like to order an Americano instead?\n"
433+
],
428434
"text/plain": [
429435
"<IPython.core.display.Markdown object>"
430436
]
@@ -445,7 +451,9 @@
445451
},
446452
{
447453
"data": {
448-
"text/markdown": "Okay, just to confirm, you would like to order: 1 Cappuccino with Almond Milk. Is that correct?\n",
454+
"text/markdown": [
455+
"Okay, just to confirm, you would like to order: 1 Cappuccino with Almond Milk. Is that correct?\n"
456+
],
449457
"text/plain": [
450458
"<IPython.core.display.Markdown object>"
451459
]
@@ -462,7 +470,9 @@
462470
},
463471
{
464472
"data": {
465-
"text/markdown": "Okay, I've placed your order. It will be ready in approximately 8 minutes.\n",
473+
"text/markdown": [
474+
"Okay, I've placed your order. It will be ready in approximately 8 minutes.\n"
475+
],
466476
"text/plain": [
467477
"<IPython.core.display.Markdown object>"
468478
]

examples/Analyze_a_Video_Classification.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@
271271
"source": [
272272
"from google.genai import types\n",
273273
"\n",
274-
"MODEL_ID=\"gemini-2.5-flash\" # @param [\"gemini-2.5-flash-lite\", \"gemini-2.5-flash-lite-preview-09-2025\", \"gemini-2.5-flash\", \"gemini-2.5-flash-preview-09-2025\", \"gemini-2.5-pro\"] {\"allow-input\":true, isTemplate: true}\n",
274+
"MODEL_ID=\"gemini-2.5-flash\" # @param [\"gemini-2.5-flash-lite\", \"gemini-2.5-flash\", \"gemini-2.5-pro\",\"gemini-3-pro-preview\"] {\"allow-input\":true, isTemplate: true}\n",
275275
"response = client.models.generate_content(\n",
276276
" model=f\"models/{MODEL_ID}\",\n",
277277
" contents=[\n",

examples/Analyze_a_Video_Historic_Event_Recognition.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@
270270
"source": [
271271
"from google.genai import types\n",
272272
"\n",
273-
"MODEL_ID=\"gemini-2.5-flash\" # @param [\"gemini-2.5-flash-lite\", \"gemini-2.5-flash-lite-preview-09-2025\", \"gemini-2.5-flash\", \"gemini-2.5-flash-preview-09-2025\", \"gemini-2.5-pro\"] {\"allow-input\":true, isTemplate: true}\n",
273+
"MODEL_ID=\"gemini-2.5-flash\" # @param [\"gemini-2.5-flash-lite\", \"gemini-2.5-flash\", \"gemini-2.5-pro\",\"gemini-3-pro-preview\"] {\"allow-input\":true, isTemplate: true}\n",
274274
"response = client.models.generate_content(\n",
275275
" model=f\"models/{MODEL_ID}\",\n",
276276
" contents=[\n",

examples/Analyze_a_Video_Summarization.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@
248248
"source": [
249249
"from google.genai import types\n",
250250
"\n",
251-
"MODEL_ID=\"gemini-2.5-flash\" # @param [\"gemini-2.5-flash-lite\", \"gemini-2.5-flash-lite-preview-09-2025\", \"gemini-2.5-flash\", \"gemini-2.5-flash-preview-09-2025\", \"gemini-2.5-pro\"] {\"allow-input\":true, isTemplate: true}\n",
251+
"MODEL_ID=\"gemini-2.5-flash\" # @param [\"gemini-2.5-flash-lite\", \"gemini-2.5-flash\", \"gemini-2.5-pro\",\"gemini-3-pro-preview\"] {\"allow-input\":true, isTemplate: true}\n",
252252
"response = client.models.generate_content(\n",
253253
" model=f\"models/{MODEL_ID}\",\n",
254254
" contents=[\n",

examples/Apollo_11.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@
214214
"source": [
215215
"prompt = \"Find four lighthearted moments in this text file.\"\n",
216216
"\n",
217-
"MODEL_ID = \"gemini-2.5-flash\" # @param [\"gemini-2.5-flash-lite\", \"gemini-2.5-flash-lite-preview-09-2025\", \"gemini-2.5-flash\", \"gemini-2.5-flash-preview-09-2025\", \"gemini-2.5-pro\"] {\"allow-input\":true, isTemplate: true}\n",
217+
"MODEL_ID = \"gemini-2.5-flash\" # @param [\"gemini-2.5-flash-lite\", \"gemini-2.5-flash\", \"gemini-2.5-pro\",\"gemini-3-pro-preview\"] {\"allow-input\":true, isTemplate: true}\n",
218218
"\n",
219219
"response = client.models.generate_content(\n",
220220
" model=f\"models/{MODEL_ID}\",\n",

examples/Book_illustration.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
"source": [
138138
"### Setup your API key\n",
139139
"\n",
140-
"To run the following cell, your API key must be stored it in a Colab Secret named `GOOGLE_API_KEY`. If you don't already have an API key, or you're not sure how to create a Colab Secret, see [Authentication](../quickstarts/Authentication.ipynb) for an example."
140+
"To run the following cell, your API key must be stored it in a Colab Secret named `GOOGLE_API_KEY`. If you don't already have an API key, or you're not sure how to create a Colab Secret, see [Authentication ![image](https://storage.googleapis.com/generativeai-downloads/images/colab_icon16.png)](../quickstarts/Authentication.ipynb) for an example."
141141
]
142142
},
143143
{
@@ -220,7 +220,7 @@
220220
"outputs": [],
221221
"source": [
222222
"image_model_name = \"gemini-2.5-flash-image\" # @param [\"gemini-2.5-flash-image\"] {\"allow-input\":true, isTemplate: true}\n",
223-
"gemini_model_name = \"gemini-2.5-flash\" # @param [\"gemini-2.5-flash-lite\", \"gemini-2.5-flash-lite-preview-09-2025\", \"gemini-2.5-flash\", \"gemini-2.5-flash-preview-09-2025\", \"gemini-2.5-pro\"] {\"allow-input\":true, isTemplate: true}"
223+
"gemini_model_name = \"gemini-2.5-flash\" # @param [\"gemini-2.5-flash-lite\", \"gemini-2.5-flash\", \"gemini-2.5-pro\",\"gemini-3-pro-preview\"] {\"allow-input\":true, isTemplate: true}"
224224
]
225225
},
226226
{

examples/Browser_as_a_tool.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"name": "stdout",
8282
"output_type": "stream",
8383
"text": [
84-
"\u001b[?25l \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.0/130.7 kB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r",
84+
"\u001b[?25l \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.0/130.7 kB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r\n",
8585
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m130.7/130.7 kB\u001b[0m \u001b[31m5.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
8686
"\u001b[?25h"
8787
]
@@ -115,7 +115,7 @@
115115
"source": [
116116
"### Set up your API key\n",
117117
"\n",
118-
"To run the following cell, your API key must be stored it in a Colab Secret named `GOOGLE_API_KEY`. If you don't already have an API key, or you're not sure how to create a Colab Secret, see the [Authentication](https://github.com/google-gemini/gemini-api-cookbook/blob/main/quickstarts/Authentication.ipynb) quickstart for an example."
118+
"To run the following cell, your API key must be stored it in a Colab Secret named `GOOGLE_API_KEY`. If you don't already have an API key, or you're not sure how to create a Colab Secret, see the [Authentication ![image](https://storage.googleapis.com/generativeai-downloads/images/colab_icon16.png)](../quickstarts/Authentication.ipynb) quickstart for an example."
119119
]
120120
},
121121
{
@@ -155,7 +155,7 @@
155155
"\n",
156156
"client = genai.Client(api_key=GOOGLE_API_KEY)\n",
157157
"\n",
158-
"LIVE_MODEL = 'gemini-2.0-flash-live-001' # @param ['gemini-2.0-flash-live-001', 'gemini-live-2.5-flash-preview', 'gemini-2.5-flash-preview-native-audio-dialog', 'gemini-2.5-flash-exp-native-audio-thinking-dialog'] {allow-input: true, isTemplate: true}\n",
158+
"LIVE_MODEL = 'gemini-2.5-flash-native-audio-preview-09-2025' # @param ['gemini-2.0-flash-live-001', 'gemini-live-2.5-flash-preview', 'gemini-2.5-flash-native-audio-preview-09-2025'] {allow-input: true, isTemplate: true}\n",
159159
"MODEL = 'gemini-2.5-flash' # @param ['gemini-2.5-flash'] {allow-input: true, isTemplate: true}"
160160
]
161161
},

0 commit comments

Comments
 (0)