Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Merged
merged 9 commits into from
May 20, 2025

Conversation

msampathkumar
Copy link
Member

@msampathkumar msampathkumar commented May 20, 2025

Description

PR has Multiple changes

  • Fix copyright year
  • Update SDK version
  • Update Model name
  • Use global endpoint location, for faster testing

--

  • Please merge this PR for me once it is approved

@msampathkumar msampathkumar requested review from a team as code owners May 20, 2025 17:48
@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label May 20, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 version 1.16.1 in all sample requirements.txt files.
  • Model Version Updates: Samples using gemini-2.0-flash-001 have been updated to use gemini-2.5-flash-preview-05-20. The thinking_textgen_with_txt.py sample now uses gemini-2.5-pro-preview-05-06 instead of gemini-2.5-pro-preview-03-25.
  • Test Configuration Change: Several test files now set the GOOGLE_CLOUD_LOCATION environment variable to global instead of us-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) and textgen_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 to gemini-2.5-flash-preview-05-20 (line 29).
  • genai/batch_prediction/batchpredict_with_gcs.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 29).
  • genai/batch_prediction/requirements.txt
    • Updated google-genai dependency from 1.7.0 to 1.16.1 (line 1).
  • genai/bounding_box/boundingbox_with_txt_img.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 97).
  • genai/bounding_box/requirements.txt
    • Updated google-genai dependency from 1.7.0 to 1.16.1 (line 1).
  • genai/bounding_box/test_bounding_box_examples.py
    • Changed GOOGLE_CLOUD_LOCATION from us-central1 to global (line 24).
  • genai/content_cache/contentcache_create_with_txt_gcs_pdf.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 45).
  • genai/content_cache/contentcache_use_with_txt.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 26).
  • genai/content_cache/requirements.txt
    • Updated google-genai dependency from 1.7.0 to 1.16.1 (line 1).
  • genai/controlled_generation/ctrlgen_with_class_schema.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 29).
  • genai/controlled_generation/ctrlgen_with_enum_class_schema.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 32).
  • genai/controlled_generation/ctrlgen_with_enum_schema.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 23).
  • genai/controlled_generation/ctrlgen_with_nested_class_schema.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 39).
  • genai/controlled_generation/ctrlgen_with_nullable_schema.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 54).
  • genai/controlled_generation/ctrlgen_with_resp_schema.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 39).
  • genai/controlled_generation/requirements.txt
    • Updated google-genai dependency from 1.7.0 to 1.16.1 (line 1).
  • genai/controlled_generation/test_controlled_generation_examples.py
    • Changed GOOGLE_CLOUD_LOCATION from us-central1 to global (line 29).
  • genai/count_tokens/counttoken_compute_with_txt.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 23).
  • genai/count_tokens/counttoken_resp_with_txt.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 27).
  • genai/count_tokens/counttoken_with_txt.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 23).
  • genai/count_tokens/counttoken_with_txt_vid.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 32).
  • genai/count_tokens/requirements.txt
    • Updated google-genai dependency from 1.7.0 to 1.16.1 (line 1).
  • genai/count_tokens/test_count_tokens_examples.py
    • Changed GOOGLE_CLOUD_LOCATION from us-central1 to global (line 27).
  • genai/embeddings/requirements.txt
    • Updated google-genai dependency from 1.7.0 to 1.16.1 (line 1).
  • genai/express_mode/api_key_example.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 26).
  • genai/express_mode/requirements.txt
    • Updated google-genai dependency from 1.7.0 to 1.16.1 (line 1).
  • genai/express_mode/test_express_mode_examples.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 in mock call (line 43).
  • genai/image_generation/requirements.txt
    • Updated google-genai dependency from 1.11.0 to 1.16.1 (line 1).
  • genai/live/requirements.txt
    • Updated google-genai dependency from 1.10.0 to 1.16.1 (line 1).
  • genai/provisioned_throughput/provisionedthroughput_with_txt.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 34).
  • genai/provisioned_throughput/requirements.txt
    • Updated google-genai dependency from 1.7.0 to 1.16.1 (line 1).
  • genai/safety/requirements.txt
    • Updated google-genai dependency from 1.7.0 to 1.16.1 (line 1).
  • genai/safety/safety_with_txt.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 57).
  • genai/safety/test_safety_examples.py
    • Changed GOOGLE_CLOUD_LOCATION from us-central1 to global (line 25).
  • genai/template_folder/requirements.txt
    • Updated google-genai dependency from 1.7.0 to 1.16.1 (line 1).
  • 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 from us-central1 to global (line 19).
  • genai/text_generation/requirements.txt
    • Updated google-genai dependency from 1.12.1 to 1.16.1 (line 1).
  • genai/text_generation/test_text_generation_examples.py
    • Changed GOOGLE_CLOUD_LOCATION from us-central1 to global (line 42).
  • 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 to gemini-2.5-flash-preview-05-20 (line 24).
  • genai/text_generation/textgen_chat_stream_with_txt.py
    • Changed function return type from str to bool (line 16).
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 22).
    • Removed response_text variable and related concatenation (lines 23, 27, 34).
  • genai/text_generation/textgen_chat_with_txt.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 23).
  • genai/text_generation/textgen_config_with_txt.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 23).
    • Updated documentation link comment (lines 25-26).
  • genai/text_generation/textgen_sys_instr_with_txt.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 23).
  • genai/text_generation/textgen_transcript_with_gcs_audio.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 27).
  • genai/text_generation/textgen_with_gcs_audio.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 26).
  • 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 to gemini-2.5-flash-preview-05-20 (line 22).
    • Added Part.from_text(text="hello-world") to the contents list (line 32).
  • genai/text_generation/textgen_with_multi_img.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 31).
  • genai/text_generation/textgen_with_multi_local_img.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 31).
  • genai/text_generation/textgen_with_mute_video.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 23).
  • genai/text_generation/textgen_with_pdf.py
    • Updated copyright year from 2024 to 2025 (line 1).
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 24).
  • genai/text_generation/textgen_with_txt.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 23).
  • genai/text_generation/textgen_with_txt_img.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 23).
  • genai/text_generation/textgen_with_txt_stream.py
    • Changed function return type from str to bool (line 16).
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 24).
    • Removed response_text variable and related concatenation (lines 22, 28, 35).
  • genai/text_generation/textgen_with_video.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 28).
  • 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 to gemini-2.5-flash-preview-05-20 (line 24).
  • genai/thinking/requirements.txt
    • Updated google-genai dependency from 1.13.0 to 1.16.1 (line 1).
  • genai/thinking/test_thinking_examples.py
    • Updated copyright year from 2024 to 2025 (line 1).
    • Changed GOOGLE_CLOUD_LOCATION from us-central1 to global (line 21).
  • genai/thinking/thinking_budget_with_txt.py
    • Updated model from gemini-2.5-flash-preview-04-17 to gemini-2.5-flash-preview-05-20 (line 24).
  • 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 to gemini-2.5-pro-preview-05-06 (line 23).
  • genai/tools/requirements.txt
    • Updated google-genai dependency from 1.7.0 to 1.16.1 (line 1).
  • genai/tools/tools_code_exec_with_txt.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 27).
  • genai/tools/tools_code_exec_with_txt_local_img.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 49).
  • genai/tools/tools_func_def_with_txt.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 37).
  • genai/tools/tools_func_desc_with_txt.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 27).
  • genai/tools/tools_google_search_with_txt.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 29).
  • genai/tools/tools_vais_with_txt.py
    • Updated model from gemini-2.0-flash-001 to gemini-2.5-flash-preview-05-20 (line 33).
  • genai/tuning/requirements.txt
    • Updated google-genai dependency from 1.15.0 to 1.16.1 (line 1).
  • 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 from 1.7.0 to 1.16.1 (line 1).
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

  1. 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.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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:

  1. 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.
  2. 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 and genai/text_generation/textgen_with_txt_stream.py, the functions now return bool instead of the accumulated str 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, a Part.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.

genai/text_generation/textgen_chat_stream_with_txt.py Outdated Show resolved Hide resolved
@msampathkumar msampathkumar changed the title feat: GenAI SDK May 2025 updates feat(genai): model and SDK updates for 2025 May May 20, 2025
@msampathkumar msampathkumar added the automerge Merge the pull request once unit tests and other checks pass. label May 20, 2025
@msampathkumar msampathkumar merged commit 16ebde7 into main May 20, 2025
14 checks passed
@msampathkumar msampathkumar deleted the genaisdk_may2025_updates branch May 20, 2025 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge the pull request once unit tests and other checks pass. samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.