Skip to content
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

feat: Update Notebooks for Google Gen AI SDK #1601

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft

Conversation

holtskinner
Copy link
Collaborator

Description

Update core feature notebooks to Gen AI SDK
Move Vertex AI SDK Notebooks to new files original_filename_vertex_ai_sdk.ipynb

@holtskinner holtskinner requested a review from a team as a code owner January 6, 2025 16:25
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@holtskinner holtskinner marked this pull request as draft January 6, 2025 16:25
Copy link
Contributor

@code-review-assist code-review-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.

Hi @holtskinner, reviewers, and future viewers!

I'm Gemini, currently reviewing this pull request. In the meantime, I'm providing a summary for everyone to quickly grasp the changes and intent.

This pull request, titled feat: Update Notebooks for Google Gen AI SDK, aims to update the core feature notebooks to utilize the Google Gen AI SDK. Specifically, the changes include:

  • Migration to Google Gen AI SDK: The notebooks are updated to use the google-genai library instead of the older google-cloud-aiplatform library. This is reflected in the changes to intro_context_caching.ipynb (lines 139, 150, 239-251, 279-287, 355-367, 389-393, 476, 493, 537-543, 567) and intro_controlled_generation.ipynb (lines 143, 154, 243-255, 285-287, 365-372, 507-510, 538-568, 612-623, 674-695, 716-733).
  • Renamed Vertex AI SDK Notebooks: Notebooks originally using the Vertex AI SDK are renamed to include _vertex_ai_sdk in their filenames. A new file intro_context_caching_vertex_ai_sdk.ipynb has been added (lines 1-570) to contain the original Vertex AI SDK code.
  • Documentation Updates: The intro_context_caching.ipynb notebook includes a link to the official Google Gen AI SDK documentation (lines 109-110). Minor updates to text and code comments are also present throughout the notebooks.
  • Model ID Update: The model ID in intro_context_caching.ipynb is updated from gemini-1.5-pro-001 to gemini-1.5-pro-002 (lines 297-299, 309-311). The intro_controlled_generation.ipynb notebook does not have any model ID changes.
  • Code Refactoring: Several code sections are refactored to align with the new SDK, including changes to how context caches are created, retrieved, and used (lines 344-367, 415-455, 476, 537-543, 567).

I will continue my review shortly. In the meantime, please review the changes and let me know if you have any questions.

Small changes made,
Code now feels new,
A better design.

Copy link
Contributor

Gemini encountered an error creating the review. You can try again by commenting @code-review-assist review.

Copy link
Contributor

@code-review-assist code-review-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.

Hi @holtskinner, I'm Gemini, and I'm currently reviewing your pull request. In the meantime, I'm providing a summary of the PR's content for you and other reviewers to quickly get up to speed.

This pull request, titled feat: Update Notebooks for Google Gen AI SDK, aims to update the core feature notebooks to utilize the Google Gen AI SDK. Specifically, the changes involve:

  • Moving Vertex AI SDK Notebooks: The existing notebooks using the Vertex AI SDK have been moved to new files with the naming convention original_filename_vertex_ai_sdk.ipynb.
  • Updating gemini/context-caching/intro_context_caching.ipynb:
    • Added a link to the official context caching documentation (lines 108-112).
    • Updated the installation instructions to use google-genai instead of google-cloud-aiplatform (lines 135-150).
    • Replaced references to vertexai with genai throughout the notebook (multiple changes).
    • Updated the model ID to gemini-1.5-pro-002 (lines 295-310).
    • Refactored code for creating, retrieving, and updating context caches to use the genai client (multiple changes).
    • Removed redundant code and improved clarity (multiple changes).

The changes are substantial and improve the notebooks by updating them to use the newer Google Gen AI SDK. The updated notebooks are more concise and easier to follow. I will provide a more detailed review shortly.

Meanwhile, here's a little poem to lighten the mood:

Code flows like a river,
Through branches, a winding path,
New SDK, clear stream.

Copy link
Contributor

Gemini encountered an error creating the review. You can try again by commenting @code-review-assist review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant