-
Notifications
You must be signed in to change notification settings - Fork 6.6k
feat(genai): model and SDK updates for 2025 May #13381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
All genai samples are created only in 2025.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @msampathkumar, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
As gemini-code-assist, I've reviewed this pull request which focuses on updating the GenAI SDK samples. The primary changes involve upgrading the google-genai
Python library dependency to version 1.16.1
across various sample directories. Concurrently, the samples have been updated to use newer preview versions of the Gemini models, specifically changing most instances of gemini-2.0-flash-001
to gemini-2.5-flash-preview-05-20
and gemini-2.5-pro-preview-03-25
to gemini-2.5-pro-preview-05-06
. Additionally, copyright years in some files have been advanced to 2025, and the default GOOGLE_CLOUD_LOCATION
in several test files has been changed from us-central1
to global
.
Highlights
- Dependency Update: The
google-genai
Python SDK dependency has been updated to version1.16.1
in all samplerequirements.txt
files. - Model Version Updates: Samples using
gemini-2.0-flash-001
have been updated to usegemini-2.5-flash-preview-05-20
. Thethinking_textgen_with_txt.py
sample now usesgemini-2.5-pro-preview-05-06
instead ofgemini-2.5-pro-preview-03-25
. - Test Configuration Change: Several test files now set the
GOOGLE_CLOUD_LOCATION
environment variable toglobal
instead ofus-central1
. - Copyright Year Update: Copyright headers in some files have been updated from 2024 to 2025.
- Minor Sample Adjustments: Small code adjustments were made in
textgen_chat_stream_with_txt.py
(return type and variable removal) andtextgen_with_local_video.py
(added a text part to contents).
Changelog
Click here to see the changelog
- genai/batch_prediction/batchpredict_with_bq.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 29).
- Updated model from
- genai/batch_prediction/batchpredict_with_gcs.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 29).
- Updated model from
- genai/batch_prediction/requirements.txt
- Updated
google-genai
dependency from1.7.0
to1.16.1
(line 1).
- Updated
- genai/bounding_box/boundingbox_with_txt_img.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 97).
- Updated model from
- genai/bounding_box/requirements.txt
- Updated
google-genai
dependency from1.7.0
to1.16.1
(line 1).
- Updated
- genai/bounding_box/test_bounding_box_examples.py
- Changed
GOOGLE_CLOUD_LOCATION
fromus-central1
toglobal
(line 24).
- Changed
- genai/content_cache/contentcache_create_with_txt_gcs_pdf.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 45).
- Updated model from
- genai/content_cache/contentcache_use_with_txt.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 26).
- Updated model from
- genai/content_cache/requirements.txt
- Updated
google-genai
dependency from1.7.0
to1.16.1
(line 1).
- Updated
- genai/controlled_generation/ctrlgen_with_class_schema.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 29).
- Updated model from
- genai/controlled_generation/ctrlgen_with_enum_class_schema.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 32).
- Updated model from
- genai/controlled_generation/ctrlgen_with_enum_schema.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 23).
- Updated model from
- genai/controlled_generation/ctrlgen_with_nested_class_schema.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 39).
- Updated model from
- genai/controlled_generation/ctrlgen_with_nullable_schema.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 54).
- Updated model from
- genai/controlled_generation/ctrlgen_with_resp_schema.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 39).
- Updated model from
- genai/controlled_generation/requirements.txt
- Updated
google-genai
dependency from1.7.0
to1.16.1
(line 1).
- Updated
- genai/controlled_generation/test_controlled_generation_examples.py
- Changed
GOOGLE_CLOUD_LOCATION
fromus-central1
toglobal
(line 29).
- Changed
- genai/count_tokens/counttoken_compute_with_txt.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 23).
- Updated model from
- genai/count_tokens/counttoken_resp_with_txt.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 27).
- Updated model from
- genai/count_tokens/counttoken_with_txt.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 23).
- Updated model from
- genai/count_tokens/counttoken_with_txt_vid.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 32).
- Updated model from
- genai/count_tokens/requirements.txt
- Updated
google-genai
dependency from1.7.0
to1.16.1
(line 1).
- Updated
- genai/count_tokens/test_count_tokens_examples.py
- Changed
GOOGLE_CLOUD_LOCATION
fromus-central1
toglobal
(line 27).
- Changed
- genai/embeddings/requirements.txt
- Updated
google-genai
dependency from1.7.0
to1.16.1
(line 1).
- Updated
- genai/express_mode/api_key_example.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 26).
- Updated model from
- genai/express_mode/requirements.txt
- Updated
google-genai
dependency from1.7.0
to1.16.1
(line 1).
- Updated
- genai/express_mode/test_express_mode_examples.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
in mock call (line 43).
- Updated model from
- genai/image_generation/requirements.txt
- Updated
google-genai
dependency from1.11.0
to1.16.1
(line 1).
- Updated
- genai/live/requirements.txt
- Updated
google-genai
dependency from1.10.0
to1.16.1
(line 1).
- Updated
- genai/provisioned_throughput/provisionedthroughput_with_txt.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 34).
- Updated model from
- genai/provisioned_throughput/requirements.txt
- Updated
google-genai
dependency from1.7.0
to1.16.1
(line 1).
- Updated
- genai/safety/requirements.txt
- Updated
google-genai
dependency from1.7.0
to1.16.1
(line 1).
- Updated
- genai/safety/safety_with_txt.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 57).
- Updated model from
- genai/safety/test_safety_examples.py
- Changed
GOOGLE_CLOUD_LOCATION
fromus-central1
toglobal
(line 25).
- Changed
- genai/template_folder/requirements.txt
- Updated
google-genai
dependency from1.7.0
to1.16.1
(line 1).
- Updated
- genai/template_folder/templatefolder_with_txt.py
- Updated copyright year from 2024 to 2025 (line 1).
- genai/template_folder/test_templatefolder_examples.py
- Updated copyright year from 2024 to 2025 (line 1).
- Changed
GOOGLE_CLOUD_LOCATION
fromus-central1
toglobal
(line 19).
- genai/text_generation/requirements.txt
- Updated
google-genai
dependency from1.12.1
to1.16.1
(line 1).
- Updated
- genai/text_generation/test_text_generation_examples.py
- Changed
GOOGLE_CLOUD_LOCATION
fromus-central1
toglobal
(line 42).
- Changed
- genai/text_generation/textgen_async_with_txt.py
- Updated copyright year from 2024 to 2025 (line 1).
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 24).
- genai/text_generation/textgen_chat_stream_with_txt.py
- Changed function return type from
str
tobool
(line 16). - Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 22). - Removed
response_text
variable and related concatenation (lines 23, 27, 34).
- Changed function return type from
- genai/text_generation/textgen_chat_with_txt.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 23).
- Updated model from
- genai/text_generation/textgen_config_with_txt.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 23). - Updated documentation link comment (lines 25-26).
- Updated model from
- genai/text_generation/textgen_sys_instr_with_txt.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 23).
- Updated model from
- genai/text_generation/textgen_transcript_with_gcs_audio.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 27).
- Updated model from
- genai/text_generation/textgen_with_gcs_audio.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 26).
- Updated model from
- genai/text_generation/textgen_with_local_video.py
- Updated copyright year from 2024 to 2025 (line 1).
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 22). - Added
Part.from_text(text="hello-world")
to thecontents
list (line 32).
- genai/text_generation/textgen_with_multi_img.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 31).
- Updated model from
- genai/text_generation/textgen_with_multi_local_img.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 31).
- Updated model from
- genai/text_generation/textgen_with_mute_video.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 23).
- Updated model from
- genai/text_generation/textgen_with_pdf.py
- Updated copyright year from 2024 to 2025 (line 1).
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 24).
- genai/text_generation/textgen_with_txt.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 23).
- Updated model from
- genai/text_generation/textgen_with_txt_img.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 23).
- Updated model from
- genai/text_generation/textgen_with_txt_stream.py
- Changed function return type from
str
tobool
(line 16). - Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 24). - Removed
response_text
variable and related concatenation (lines 22, 28, 35).
- Changed function return type from
- genai/text_generation/textgen_with_video.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 28).
- Updated model from
- genai/text_generation/textgen_with_youtube_video.py
- Updated copyright year from 2024 to 2025 (line 1).
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 24).
- genai/thinking/requirements.txt
- Updated
google-genai
dependency from1.13.0
to1.16.1
(line 1).
- Updated
- genai/thinking/test_thinking_examples.py
- Updated copyright year from 2024 to 2025 (line 1).
- Changed
GOOGLE_CLOUD_LOCATION
fromus-central1
toglobal
(line 21).
- genai/thinking/thinking_budget_with_txt.py
- Updated model from
gemini-2.5-flash-preview-04-17
togemini-2.5-flash-preview-05-20
(line 24).
- Updated model from
- genai/thinking/thinking_with_txt.py
- Updated copyright year from 2024 to 2025 (line 1).
- Updated model from
gemini-2.5-pro-preview-03-25
togemini-2.5-pro-preview-05-06
(line 23).
- genai/tools/requirements.txt
- Updated
google-genai
dependency from1.7.0
to1.16.1
(line 1).
- Updated
- genai/tools/tools_code_exec_with_txt.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 27).
- Updated model from
- genai/tools/tools_code_exec_with_txt_local_img.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 49).
- Updated model from
- genai/tools/tools_func_def_with_txt.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 37).
- Updated model from
- genai/tools/tools_func_desc_with_txt.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 27).
- Updated model from
- genai/tools/tools_google_search_with_txt.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 29).
- Updated model from
- genai/tools/tools_vais_with_txt.py
- Updated model from
gemini-2.0-flash-001
togemini-2.5-flash-preview-05-20
(line 33).
- Updated model from
- genai/tuning/requirements.txt
- Updated
google-genai
dependency from1.15.0
to1.16.1
(line 1).
- Updated
- genai/tuning/tuning_textgen_with_txt.py
- Updated copyright year from 2024 to 2025 (line 1).
- genai/video_generation/requirements.txt
- Updated
google-genai
dependency from1.7.0
to1.16.1
(line 1).
- Updated
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Models change, code must too,
New versions, fresh and new.
Update the samples,
Pass all the examples,
Green checks for me and you.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request effectively updates the GenAI SDK samples, primarily by upgrading model versions and dependencies. The changes are largely straightforward and help keep the examples current.
I've identified a few areas that might warrant a second look to ensure the samples remain clear and functional as intended:
- Behavioral Change in Streaming Samples: Two streaming examples have changed their return type from the accumulated string to a boolean. This might be an intentional simplification, but it alters the function's utility.
- Potentially Extraneous Code: One sample involving video processing has an added text part that seems unrelated to the main task.
Details are in the specific comments below.
Summary of Findings
- Behavioral Change in Streaming Samples: In
genai/text_generation/textgen_chat_stream_with_txt.py
andgenai/text_generation/textgen_with_txt_stream.py
, the functions now returnbool
instead of the accumulatedstr
from the stream. This changes their utility for programmatic access to the full response. - Potentially Extraneous Code in Video Sample: In
genai/text_generation/textgen_with_local_video.py
, aPart.from_text(text="hello-world")
was added. Its purpose in the context of generating content from a video is unclear and might be an accidental addition. - Unused Import (Low Severity): In
genai/text_generation/textgen_chat_stream_with_txt.py
,GenerateContentConfig
is imported but not used. (Not commented inline due to review severity settings).
Merge Readiness
The pull request primarily consists of version updates, which are beneficial. However, there are a few medium-severity issues regarding changes in sample behavior and potentially extraneous code that should be reviewed and addressed to ensure the samples are clear and function as intended. I recommend addressing these points before merging. As an AI, I am not authorized to approve pull requests; please ensure further review and approval by authorized team members.
Description
PR has Multiple changes
global
endpoint location, for faster testing--