Skip to content

Commit 5622223

Browse files
authored
I0 2025 new models and capabilities (#769)
* Updating all notebooks to use the new Flash model * Adding a new Lyria RealTime guide about music generation * Adding a new Grounding guide including a URL context example * Adding a new Native Audio-out with Live API python script * Updating the Thinking notebook, adding the usage of thought summaries * Updating the Get started notebook with URL context * Updating Video understanding guide with new parameters (fps and offsets)
1 parent 49aee1d commit 5622223

File tree

113 files changed

+11077
-6308
lines changed

Some content is hidden

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

113 files changed

+11077
-6308
lines changed

.devcontainer/devcontainer.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
{
2-
"name": "Gemini Cookbook Dev Container",
3-
"image": "mcr.microsoft.com/devcontainers/universal:2",
4-
"waitFor": "onCreateCommand",
5-
"updateContentCommand": "python3 -m pip install ipywidgets",
6-
"customizations": {
7-
"vscode": {
8-
"extensions": [
9-
"ms-toolsai.jupyter",
10-
"ms-python.python",
11-
"eamodio.gitlens"
12-
]
13-
}
14-
},
15-
16-
"postCreateCommand": "sudo cp .devcontainer/welcome.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt"
17-
}
1+
{
2+
"name": "Gemini Cookbook Dev Container",
3+
"image": "mcr.microsoft.com/devcontainers/universal:2",
4+
"waitFor": "onCreateCommand",
5+
"updateContentCommand": "python3 -m pip install ipywidgets",
6+
"customizations": {
7+
"vscode": {
8+
"extensions": [
9+
"ms-toolsai.jupyter",
10+
"ms-python.python",
11+
"eamodio.gitlens"
12+
]
13+
}
14+
},
15+
16+
"postCreateCommand": "sudo cp .devcontainer/welcome.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt"
17+
}

.devcontainer/welcome.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
👋 Welcome to the Gemini API Cookbook! This repo is a collection of all the guides and examples for the Gemini API.
2-
- To get started, make sure you have an API Key from Google AI studio: https://goo.gle/aistudio-key
3-
- Note that the notebooks were written to run in Google Colab, so they may
4-
not always work in Codespaces
5-
- Check out the 'README.md' file to know more
1+
👋 Welcome to the Gemini API Cookbook! This repo is a collection of all the guides and examples for the Gemini API.
2+
- To get started, make sure you have an API Key from Google AI studio: https://goo.gle/aistudio-key
3+
- Note that the notebooks were written to run in Google Colab, so they may
4+
not always work in Codespaces
5+
- Check out the 'README.md' file to know more

.github/header-checker-lint.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# Lint check for license headers.
2-
# See: https://github.com/googleapis/repo-automation-bots/tree/main/packages/header-checker-lint
3-
allowedCopyrightHolders:
4-
- 'Google LLC'
5-
allowedLicenses:
6-
- 'Apache-2.0'
7-
sourceFileExtensions:
8-
- 'py'
9-
- 'sh'
10-
- 'ts'
11-
- 'js'
12-
- 'java'
13-
# Note that separate nblint checks will handle *.ipynb files.
1+
# Lint check for license headers.
2+
# See: https://github.com/googleapis/repo-automation-bots/tree/main/packages/header-checker-lint
3+
allowedCopyrightHolders:
4+
- 'Google LLC'
5+
allowedLicenses:
6+
- 'Apache-2.0'
7+
sourceFileExtensions:
8+
- 'py'
9+
- 'sh'
10+
- 'ts'
11+
- 'js'
12+
- 'java'
13+
# Note that separate nblint checks will handle *.ipynb files.

.github/labeler.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
'status:awaiting review':
2-
- '**/*'
3-
4-
'component:examples':
5-
- examples/**/*
6-
7-
'component:quickstarts':
1+
'status:awaiting review':
2+
- '**/*'
3+
4+
'component:examples':
5+
- examples/**/*
6+
7+
'component:quickstarts':
88
- quickstarts/**/*
Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
1-
name: Issue metrics
2-
on:
3-
workflow_dispatch:
4-
schedule:
5-
- cron: "0 0 1 * *" # First of the month, midnight UTC
6-
7-
permissions:
8-
contents: read
9-
10-
jobs:
11-
build:
12-
name: issue metrics
13-
runs-on: ubuntu-latest
14-
permissions:
15-
issues: write
16-
pull-requests: read
17-
steps:
18-
- name: Get dates for last month
19-
shell: bash
20-
run: |
21-
# Calculate the first day of the previous month
22-
first_day=$(date -d "last month" +%Y-%m-01)
23-
24-
# Calculate the last day of the previous month
25-
last_day=$(date -d "$first_day +1 month -1 day" +%Y-%m-%d)
26-
27-
# Set an environment variable with the date range
28-
echo "$first_day..$last_day"
29-
echo "last_month=$first_day..$last_day" >> "$GITHUB_ENV"
30-
31-
- name: Run issue-metrics tool
32-
uses: github/issue-metrics@4f29f34d9d831fe224cbc6c8a0d711415ebd01b1 # v3
33-
env:
34-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35-
SEARCH_QUERY: 'repo:google-gemini/cookbook is:issue created:${{ env.last_month }} -reason:"not planned"'
36-
LABELS_TO_MEASURE: "status:awaiting response,status:triaged,status:stale"
37-
38-
- name: Create issue
39-
uses: peter-evans/create-issue-from-file@e8ef132d6df98ed982188e460ebb3b5d4ef3a9cd # v5
40-
with:
41-
title: Monthly issue metrics report
42-
token: ${{ secrets.GITHUB_TOKEN }}
43-
content-filepath: ./issue_metrics.md
1+
name: Issue metrics
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: "0 0 1 * *" # First of the month, midnight UTC
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
build:
12+
name: issue metrics
13+
runs-on: ubuntu-latest
14+
permissions:
15+
issues: write
16+
pull-requests: read
17+
steps:
18+
- name: Get dates for last month
19+
shell: bash
20+
run: |
21+
# Calculate the first day of the previous month
22+
first_day=$(date -d "last month" +%Y-%m-01)
23+
24+
# Calculate the last day of the previous month
25+
last_day=$(date -d "$first_day +1 month -1 day" +%Y-%m-%d)
26+
27+
# Set an environment variable with the date range
28+
echo "$first_day..$last_day"
29+
echo "last_month=$first_day..$last_day" >> "$GITHUB_ENV"
30+
31+
- name: Run issue-metrics tool
32+
uses: github/issue-metrics@4f29f34d9d831fe224cbc6c8a0d711415ebd01b1 # v3
33+
env:
34+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
SEARCH_QUERY: 'repo:google-gemini/cookbook is:issue created:${{ env.last_month }} -reason:"not planned"'
36+
LABELS_TO_MEASURE: "status:awaiting response,status:triaged,status:stale"
37+
38+
- name: Create issue
39+
uses: peter-evans/create-issue-from-file@e8ef132d6df98ed982188e460ebb3b5d4ef3a9cd # v5
40+
with:
41+
title: Monthly issue metrics report
42+
token: ${{ secrets.GITHUB_TOKEN }}
43+
content-filepath: ./issue_metrics.md

.github/workflows/labeler.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
name: "PR Labeler"
2-
3-
on:
4-
pull_request_target:
5-
types: ["opened", "reopened", "ready_for_review"]
6-
7-
jobs:
8-
triage:
9-
permissions:
10-
contents: read
11-
pull-requests: write
12-
runs-on: ubuntu-latest
13-
steps:
14-
- uses: actions/labeler@ac9175f8a1f3625fd0d4fb234536d26811351594 # v4
1+
name: "PR Labeler"
2+
3+
on:
4+
pull_request_target:
5+
types: ["opened", "reopened", "ready_for_review"]
6+
7+
jobs:
8+
triage:
9+
permissions:
10+
contents: read
11+
pull-requests: write
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/labeler@ac9175f8a1f3625fd0d4fb234536d26811351594 # v4
1515
if: ${{ github.event.pull_request.draft == false }}
Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
1-
name: All new examples are linked in the README
2-
3-
on:
4-
pull_request:
5-
branches: [ main ]
6-
7-
jobs:
8-
new-example-links-in-examples-readme:
9-
runs-on: ubuntu-latest
10-
steps:
11-
- name: Checkout Code
12-
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
13-
- name: Get Changed Files
14-
id: changed-files
15-
uses: tj-actions/changed-files@48d8f15b2aaa3d255ca5af3eba4870f807ce6b3c # v45
16-
with:
17-
files: |
18-
examples/**/*.ipynb
19-
- name: Check README links
20-
env:
21-
# We only want the added file so that if we do an exception we dop not have to make an exception again each time qu're editing the file
22-
NEW_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
23-
README: examples/README.md
24-
run: |
25-
all_linked=true
26-
for file in ${NEW_FILES}; do
27-
echo "$file was added"
28-
# Get the directory of the new notebook file
29-
notebook_dir=$(dirname "$file")
30-
# Get the filename without the directory path
31-
filename=$(basename "$file")
32-
33-
# Check if link exists in $README
34-
if ! grep -q "$file" "$README" && ! grep -q "${file/examples\//](}" "$README"; then
35-
# Check if a README.md exists in the sub-folder, and if so, check for the link there
36-
if [[ -f "$notebook_dir/README.md" ]]; then
37-
if ! grep -q "$filename" "$notebook_dir/README.md"; then
38-
all_linked=false
39-
echo " Link to '$file' not found in "$README".md or $notebook_dir/README.md"
40-
echo "::warning file=$file::Link to '$file' not found in a README.md, please add one"
41-
else
42-
echo " Link to '$file' found in $notebook_dir/README.md"
43-
fi
44-
else
45-
all_linked=false
46-
echo " Link to '$file' not found in $README, and no README.md found in $notebook_dir"
47-
echo "::warning file=$file::Link to '$file' not found in $README, please add one (or create a README.md in the sub-folder)"
48-
fi
49-
else
50-
echo " Link to '$file' found in $README"
51-
fi
52-
done
53-
if ! $all_linked; then
54-
exit 1
55-
fi
1+
name: All new examples are linked in the README
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
7+
jobs:
8+
new-example-links-in-examples-readme:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout Code
12+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
13+
- name: Get Changed Files
14+
id: changed-files
15+
uses: tj-actions/changed-files@48d8f15b2aaa3d255ca5af3eba4870f807ce6b3c # v45
16+
with:
17+
files: |
18+
examples/**/*.ipynb
19+
- name: Check README links
20+
env:
21+
# We only want the added file so that if we do an exception we dop not have to make an exception again each time qu're editing the file
22+
NEW_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
23+
README: examples/README.md
24+
run: |
25+
all_linked=true
26+
for file in ${NEW_FILES}; do
27+
echo "$file was added"
28+
# Get the directory of the new notebook file
29+
notebook_dir=$(dirname "$file")
30+
# Get the filename without the directory path
31+
filename=$(basename "$file")
32+
33+
# Check if link exists in $README
34+
if ! grep -q "$file" "$README" && ! grep -q "${file/examples\//](}" "$README"; then
35+
# Check if a README.md exists in the sub-folder, and if so, check for the link there
36+
if [[ -f "$notebook_dir/README.md" ]]; then
37+
if ! grep -q "$filename" "$notebook_dir/README.md"; then
38+
all_linked=false
39+
echo " Link to '$file' not found in "$README".md or $notebook_dir/README.md"
40+
echo "::warning file=$file::Link to '$file' not found in a README.md, please add one"
41+
else
42+
echo " Link to '$file' found in $notebook_dir/README.md"
43+
fi
44+
else
45+
all_linked=false
46+
echo " Link to '$file' not found in $README, and no README.md found in $notebook_dir"
47+
echo "::warning file=$file::Link to '$file' not found in $README, please add one (or create a README.md in the sub-folder)"
48+
fi
49+
else
50+
echo " Link to '$file' found in $README"
51+
fi
52+
done
53+
if ! $all_linked; then
54+
exit 1
55+
fi

0 commit comments

Comments
 (0)