-
Notifications
You must be signed in to change notification settings - Fork 6.5k
feat(generativeai): Create genai_sdk_supervised_get_example.py #13351
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
base: main
Are you sure you want to change the base?
Conversation
Add a Gen AI SDK example to get a tuning job.
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 @yishan-pu, 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
This pull request adds a new example, genai_sdk_supervised_get_example.py
, to the generative_ai/model_tuning
directory. The example demonstrates how to use the Gen AI SDK to retrieve a tuning job. It showcases how to initialize the client, get a tuning job by its name, and print information about the tuning job, tuned model, experiment, and checkpoints.
Highlights
- New Example: A new example script
genai_sdk_supervised_get_example.py
is added to demonstrate how to get a tuning job using the Gen AI SDK. - Tuning Job Retrieval: The example shows how to retrieve a tuning job by its name using
client.tunings.get(name=name)
. - Information Printing: The example prints information about the tuning job, including the tuned model, endpoint, experiment, and checkpoints.
Changelog
- generative_ai/model_tuning/genai_sdk_supervised_get_example.py
- Created a new file
genai_sdk_supervised_get_example.py
. - Added code to initialize the Gen AI client.
- Added code to retrieve a tuning job by name.
- Added code to print tuning job details such as tuned model, endpoint, experiment, and checkpoints.
- Included example responses in the comments.
- Created a new file
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.
A tuning job's quest,
To find the perfect model,
SDK guides the way.
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
The code adds a new example for retrieving a tuning job using the GenAI SDK. The example seems functional, but there are a few areas where it can be improved for clarity and robustness.
Summary of Findings
- Missing Error Handling: The code lacks error handling for the
client.tunings.get
call. If the tuning job does not exist or there is an issue with the API, the program will crash. Error handling should be added to make the example more robust. - Hardcoded Values: The
name
variable contains hardcoded project and tuning job IDs. While this is an example, it would be better to either use environment variables or generate these values dynamically for demonstration purposes. - TODO Comment: The
TODO
comment suggests that the user needs to update thePROJECT_ID
. It would be better to provide a default value or a more descriptive message on how to set the environment variable.
Merge Readiness
The code is functional but needs improvements in error handling and clarity. I recommend addressing the identified issues before merging. I am unable to directly approve the pull request, and other reviewers should review and approve this code before merging.
Here is the summary of possible violations 😱 There is a possible violation for not having product prefix.
The end of the violation section. All the stuff below is FYI purposes only. Here is the summary of changes. You are about to add 1 region tag.
This comment is generated by snippet-bot.
|
Add a Gen AI SDK example to get a tuning job.