Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ See [`.gemini/styleguide.md`](./.gemini/styleguide.md) for the full list and res
* If you *must* use extra parameters, explain *why* they are needed and the reasoning behind the specific value the first time you use them.
* When selecting a model, use a Colab form selector for easier maintainability:
```python
MODEL_ID="gemini-3.7-flash" # @param ["gemini-3.7-flash", "gemini-2.5-pro", "gemini-3.1-pro-preview"] {"allow-input":true, isTemplate: true}
MODEL_ID = "gemini-3.7-flash" # @param ["gemini-3.1-pro-preview", "gemini-3.7-flash", "gemini-3.5-flash-lite", "gemini-2.5-pro"] {"allow-input": true, "isTemplate": true}
```
* Some notebooks can benefit from having a form to update the prompt:
```python
Expand Down
76 changes: 38 additions & 38 deletions examples/Agent_Module_EU_AI_Act_Compliance.ipynb

Large diffs are not rendered by default.

42 changes: 21 additions & 21 deletions examples/Agents_Function_Calling_Barista_Bot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"source": [
"# Gemini API: Agents and Automatic Function Calling with Barista Bot\n",
"\n",
"<a target=\"_blank\" href=\"https://colab.research.google.com/github/google-gemini/cookbook/blob/main/examples/Agents_Function_Calling_Barista_Bot.ipynb\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" height=30/></a>"
"\u003ca target=\"_blank\" href=\"https://colab.research.google.com/github/google-gemini/cookbook/blob/main/examples/Agents_Function_Calling_Barista_Bot.ipynb\"\u003e\u003cimg src=\"https://colab.research.google.com/assets/colab-badge.svg\" height=30/\u003e\u003c/a\u003e"
]
},
{
Expand All @@ -61,7 +61,7 @@
},
"outputs": [],
"source": [
"%pip install -qU \"google-genai>=2.9.0\""
"%pip install -qU \"google-genai\u003e=2.9.0\""
]
},
{
Expand Down Expand Up @@ -117,19 +117,19 @@
"placed_order = [] # The confirmed, completed order.\n",
"\n",
"\n",
"def add_to_order(drink: str, modifiers: Optional[list[str]] = None) -> None:\n",
"def add_to_order(drink: str, modifiers: Optional[list[str]] = None) -\u003e None:\n",
" \"\"\"Adds the specified drink to the customer's order, including any modifiers.\"\"\"\n",
" if modifiers is None: # Ensures safe handling of None\n",
" modifiers = []\n",
" order.append((drink, modifiers))\n",
"\n",
"\n",
"def get_order() -> list[tuple[str, list[str]]]:\n",
"def get_order() -\u003e list[tuple[str, list[str]]]:\n",
" \"\"\"Returns the customer's order.\"\"\"\n",
" return order\n",
"\n",
"\n",
"def remove_item(n: int) -> str:\n",
"def remove_item(n: int) -\u003e str:\n",
" \"\"\"Removes the nth (one-based) item from the order.\n",
"\n",
" Returns:\n",
Expand All @@ -139,12 +139,12 @@
" return item\n",
"\n",
"\n",
"def clear_order() -> None:\n",
"def clear_order() -\u003e None:\n",
" \"\"\"Removes all items from the customer's order.\"\"\"\n",
" order.clear()\n",
"\n",
"\n",
"def confirm_order() -> str:\n",
"def confirm_order() -\u003e str:\n",
" \"\"\"Asks the customer if the order is correct.\n",
"\n",
" Returns:\n",
Expand All @@ -162,7 +162,7 @@
" return input(\"Is this correct? \")\n",
"\n",
"\n",
"def place_order() -> int:\n",
"def place_order() -\u003e int:\n",
" \"\"\"Submit the order to the kitchen.\n",
"\n",
" Returns:\n",
Expand Down Expand Up @@ -342,7 +342,7 @@
" confirm_order,\n",
" place_order,\n",
"]\n",
"model_name = \"gemini-3.7-flash\" # @param [\"gemini-3.7-flash\", \"gemini-2.5-pro\", \"gemini-3.1-pro-preview\"] {\"allow-input\":true, isTemplate: true}\n",
"model_name = \"gemini-3.7-flash\" # @param [\"gemini-3.1-pro-preview\", \"gemini-3.7-flash\", \"gemini-3.5-flash-lite\", \"gemini-2.5-pro\"] {\"allow-input\":true, isTemplate: true}",
"\n",
"chat = client.chats.create(\n",
" model=model_name,\n",
Expand All @@ -366,7 +366,7 @@
"\n",
"With the model defined and chat created, all that's left is to connect the user input to the model and display the output, in a loop. This loop continues until an order is placed.\n",
"\n",
"When run in Colab, any fixed-width text originates from your Python code (e.g. `print` calls in the ordering system), regular text comes the Gemini API, and the outlined boxes allow for user input that is rendered with a leading `>`.\n",
"When run in Colab, any fixed-width text originates from your Python code (e.g. `print` calls in the ordering system), regular text comes the Gemini API, and the outlined boxes allow for user input that is rendered with a leading `\u003e`.\n",
"\n",
"Try it out!"
]
Expand All @@ -385,7 +385,7 @@
"Welcome to Barista bot!\n",
"\n",
"\n",
"> i would like to have a cuppacino with almond milk\n"
"\u003e i would like to have a cuppacino with almond milk\n"
]
},
{
Expand All @@ -394,7 +394,7 @@
"Ok, I've added a Cappuccino with Almond Milk to your order. Anything else?\n"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
"\u003cIPython.core.display.Markdown object\u003e"
]
},
"metadata": {},
Expand All @@ -404,7 +404,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"> do you have stone milk?\n"
"\u003e do you have stone milk?\n"
]
},
{
Expand All @@ -413,7 +413,7 @@
"I'm sorry, I do not have stone milk. We only have Whole, 2%, Oat, Almond, and 2% Lactose Free milk options.\n"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
"\u003cIPython.core.display.Markdown object\u003e"
]
},
"metadata": {},
Expand All @@ -423,7 +423,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"> do you have long black\n"
"\u003e do you have long black\n"
]
},
{
Expand All @@ -432,7 +432,7 @@
"I am sorry, I do not have Long Black. Would you like to order an Americano instead?\n"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
"\u003cIPython.core.display.Markdown object\u003e"
]
},
"metadata": {},
Expand All @@ -442,7 +442,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"> no, that's all\n",
"\u003e no, that's all\n",
"Your order:\n",
" Cappuccino\n",
" - Almond Milk\n",
Expand All @@ -455,7 +455,7 @@
"Okay, just to confirm, you would like to order: 1 Cappuccino with Almond Milk. Is that correct?\n"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
"\u003cIPython.core.display.Markdown object\u003e"
]
},
"metadata": {},
Expand All @@ -465,7 +465,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"> yes\n"
"\u003e yes\n"
]
},
{
Expand All @@ -474,7 +474,7 @@
"Okay, I've placed your order. It will be ready in approximately 8 minutes.\n"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
"\u003cIPython.core.display.Markdown object\u003e"
]
},
"metadata": {},
Expand Down Expand Up @@ -502,7 +502,7 @@
"print(\"Welcome to Barista bot!\\n\\n\")\n",
"\n",
"while not placed_order:\n",
" response = chat.send_message(input(\"> \"))\n",
" response = chat.send_message(input(\"\u003e \"))\n",
" display(Markdown(response.text))\n",
"\n",
"\n",
Expand Down
10 changes: 5 additions & 5 deletions examples/Analyze_a_Video_Classification.ipynb

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions examples/Analyze_a_Video_Historic_Event_Recognition.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"id": "dJY5C59gPf-m"
},
"source": [
"<a target=\"_blank\" href=\"https://colab.research.google.com/github/google-gemini/cookbook/blob/main/examples/Analyze_a_Video_Historic_Event_Recognition.ipynb\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" height=30/></a>"
"\u003ca target=\"_blank\" href=\"https://colab.research.google.com/github/google-gemini/cookbook/blob/main/examples/Analyze_a_Video_Historic_Event_Recognition.ipynb\"\u003e\u003cimg src=\"https://colab.research.google.com/assets/colab-badge.svg\" height=30/\u003e\u003c/a\u003e"
]
},
{
Expand All @@ -70,7 +70,7 @@
}
],
"source": [
"%pip install -U -q \"google-genai>=2.9.0\""
"%pip install -U -q \"google-genai\u003e=2.9.0\""
]
},
{
Expand Down Expand Up @@ -128,7 +128,7 @@
"Length: 628645171 (600M) [video/mp4]\n",
"Saving to: ‘berlin.mp4’\n",
"\n",
"berlin.mp4 100%[===================>] 599.52M 41.0MB/s in 12s \n",
"berlin.mp4 100%[===================\u003e] 599.52M 41.0MB/s in 12s \n",
"\n",
"2025-03-04 14:05:07 (48.2 MB/s) - ‘berlin.mp4’ saved [628645171/628645171]\n",
"\n"
Expand Down Expand Up @@ -270,7 +270,7 @@
"source": [
"from google.genai import types\n",
"\n",
"MODEL_ID = \"gemini-3.7-flash\" # @param [\"gemini-3.7-flash\", \"gemini-2.5-pro\", \"gemini-3.1-pro-preview\"] {\"allow-input\":true, isTemplate: true}\n",
"MODEL_ID = \"gemini-3.7-flash\" # @param [\"gemini-3.1-pro-preview\", \"gemini-3.7-flash\", \"gemini-3.5-flash-lite\", \"gemini-2.5-pro\"] {\"allow-input\":true, isTemplate: true}",
"response = client.models.generate_content(\n",
" model=f\"models/{MODEL_ID}\",\n",
" contents=[\n",
Expand Down
10 changes: 5 additions & 5 deletions examples/Analyze_a_Video_Summarization.ipynb

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions examples/Animated_Story_Video_Generation_gemini.ipynb

Large diffs are not rendered by default.

Loading
Loading