Skip to content

refactor(sdk): migrate Providing_base_cases.ipynb to unified google-genai SDK#1082

Open
bhasinagam wants to merge 6 commits intogoogle-gemini:mainfrom
bhasinagam:main
Open

refactor(sdk): migrate Providing_base_cases.ipynb to unified google-genai SDK#1082
bhasinagam wants to merge 6 commits intogoogle-gemini:mainfrom
bhasinagam:main

Conversation

@bhasinagam
Copy link

Summary

Migrates examples/prompting/Providing_base_cases.ipynb from the legacy
google-generativeai SDK to the modern google-genai Unified SDK, with
full compliance to .gemini/styleguide.md.

Changes

SDK Migration

  • %pip install 'google-genai>=1.0.0' (with version per styleguide)
  • from google import genai (correct import)
  • client = genai.Client() pattern
  • client.models.generate_content() with config dict

Styleguide Compliance

  • Import placed with first use (client init cell)
  • Model selector updated: gemini-2.5-flash, gemini-3-*-preview
  • Imperative text style ("Define...", "Test...")
  • Removed redundant model instantiation cells

Testing

  • Runs successfully in Colab
  • Formatted with nbfmt

bhasinagam and others added 4 commits December 24, 2025 01:37
…unified-sdk

refactor(sdk): migrate Providing_base_cases.ipynb to unified google-genai SDK
…enai SDK

## Summary
Migrates [examples/prompting/Providing_base_cases.ipynb](cci:7://file:///d:/GSoc@2026/cookbook/examples/prompting/Providing_base_cases.ipynb:0:0-0:0) from legacy `google-generativeai` to `google-genai` SDK.
## Changes
- `%pip install 'google-genai>=1.0.0'`
- `from google import genai` + `client = genai.Client()`
- `client.models.generate_content()` pattern
- Model selector with gemini-2.5/3.0 options
- Imperative text style
## Testing
- [x] Runs in Colab
- [x] Formatted with nbfmt
…unified-sdk

refactor(sdk): migrate Providing_base_cases.ipynb to unified google-g…
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions github-actions bot added status:awaiting review PR awaiting review from a maintainer component:examples Issues/PR referencing examples folder labels Dec 24, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @bhasinagam, 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!

This pull request refactors the Providing_base_cases.ipynb example notebook to align with the latest google-genai Unified SDK and internal style guidelines. The primary goal is to modernize the notebook's codebase, ensuring it leverages the most current SDK features and follows best practices for clarity and maintainability, while also enhancing the quality of the example outputs.

Highlights

  • SDK Migration: The notebook Providing_base_cases.ipynb has been updated to use the google-genai Unified SDK, replacing the legacy google-generativeai SDK. This includes changes to package installation, import statements (from google import genai), client initialization (client = genai.Client()), and content generation calls (client.models.generate_content()).
  • Styleguide Compliance: The notebook now adheres to the .gemini/styleguide.md, incorporating changes such as placing imports with first use, updating model selectors to include gemini-2.5-flash and gemini-3-*-preview, adopting an imperative text style in markdown cells, and removing redundant model instantiation cells.
  • Content Refinement: The example outputs for model responses have been updated to provide more detailed and structured information, specifically for the San Diego beaches safety tips and book recommendations.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

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.

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

The pull request updates the Providing_base_cases.ipynb notebook to utilize the google-genai>=1.0.0 library, replacing the older google-generativeai package. This involves refactoring the API client initialization from genai.configure to genai.Client, introducing a configurable MODEL_ID variable, and modifying generate_content calls to explicitly pass model and system instruction configurations. The notebook's content was also refined with updated markdown descriptions and more detailed example outputs for model responses. A review comment noted that the execution_count values in the notebook were not null, indicating that the nbfmt formatting script had not been run, and requested that it be executed to reset these counts before merging.

@bhasinagam bhasinagam marked this pull request as draft December 24, 2025 11:09
@bhasinagam bhasinagam marked this pull request as ready for review December 24, 2025 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:examples Issues/PR referencing examples folder status:awaiting review PR awaiting review from a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant