-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
fix: Add Batch Prediction to Gen AI SDK Intro #1595
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
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.
Hi team,
I'm currently reviewing this pull request and will provide my feedback shortly. In the meantime, here's a summary for you and other reviewers to quickly get up to speed:
This pull request, authored by holtskinner, aims to add a Batch Prediction example to the Gen AI SDK introduction notebook within the generative-ai
repository. The changes are focused on enhancing the tutorial's comprehensiveness by illustrating the use of batch prediction capabilities.
Here's a breakdown of the changes:
- File:
gemini/getting-started/intro_genai_sdk.ipynb
- A minor typographical correction was made in the notebook's title (line 32, changed from "Google generative AI" to "Google Generative AI").
- The list of features demonstrated in the notebook was updated to include "Batch prediction" (line 120).
- The notebook's code was modified to include the necessary imports and code snippets for demonstrating batch prediction (lines 149-150, 196-204). This includes importing
datetime
andpandas
, and addingCreateBatchJobConfig
to the imports fromgoogle.genai.types
. - A significant section was added to the notebook to explain and demonstrate batch prediction using the Gemini API in Vertex AI (lines 1014-1202). This includes sections on preparing batch inputs and outputs, sending a batch prediction request, retrieving results, and listing batch prediction jobs. The example uses Cloud Storage for input and output.
The changes are well-structured and clearly explained. The addition of the batch prediction example significantly improves the tutorial's practical value.
Short poem for your enjoyment:
Code flows like a stream,
Batch predictions, swift and clean,
Efficiency gleams.
Thanks,
Gemini/code-review-assist
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.
This pull request adds a batch prediction example to the Gen AI SDK Intro Notebook. This is a valuable addition that enhances the comprehensiveness of the tutorial. The code and documentation changes are well-structured and easy to follow. I have a few suggestions to further improve the clarity and completeness of the example.
I've based my maintainability suggestions on common Python style guides, including PEP 8, since no specific style guide was provided.
It's great to see the added section in the notebook's overview mentioning batch prediction. This helps users quickly understand the notebook's contents.
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.
Hi team,
I'm currently reviewing this pull request and will provide my feedback shortly. In the meantime, here's a summary of the changes for you and other reviewers to get up to speed quickly:
This pull request, authored by holtskinner, aims to add a Batch Prediction example to the Gen AI SDK Intro Notebook within the generative-ai
repository. The changes made include:
- Minor Text Update: Line 32 of
gemini/getting-started/intro_genai_sdk.ipynb
corrects a minor typo, changing "Google generative AI" to "Google Generative AI". - Addition of Batch Prediction to Outline: Line 120 in
gemini/getting-started/intro_genai_sdk.ipynb
adds "Batch prediction" to the list of features covered in the notebook. - Dependency Update: Line 150 in
gemini/getting-started/intro_genai_sdk.ipynb
addspandas
as a dependency to thepip install
command, likely required for the batch prediction example. - Import Statements Update: Lines 197-205 in
gemini/getting-started/intro_genai_sdk.ipynb
add the necessary import statements for batch prediction functionality, specifically importingdatetime
andCreateBatchJobConfig
fromgoogle.genai.types
. - Major Section Addition: A significant section (lines 1014-1202) has been added to
gemini/getting-started/intro_genai_sdk.ipynb
detailing how to perform batch predictions using the Gen AI SDK. This includes explanations of preparing batch inputs and outputs, sending batch requests, and retrieving results. The new section covers preparing batch inputs from Cloud Storage, preparing batch output locations (Cloud Storage or BigQuery), sending a batch prediction request, and retrieving the results using pandas.
The changes are well-structured and clearly explain the process of batch prediction. The addition of pandas
as a dependency is logical and necessary for the data manipulation involved in the batch prediction example.
I'll have a more detailed review shortly.
Here's a little haiku to brighten your day:
Code flows like a stream,
Batch predictions, swift and clean,
Efficiency's gleam.
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.
This pull request adds a batch prediction example to the Gen AI SDK Intro Notebook. This is a valuable addition that enhances the comprehensiveness of the notebook. The code is generally well-written and clear. The use of markdown to explain the batch prediction process and the inclusion of code examples for preparing input, output, sending requests, and retrieving results is commendable. Here are a few suggestions based on Python PEP 8 style guide to further improve the notebook:
Description
Add Batch Prediction example to Gen AI SDK Intro Notebook.