-
Notifications
You must be signed in to change notification settings - Fork 6.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
feat(genai, generative_ai): Migration of Gemini samples to 2.X models #13267
base: main
Are you sure you want to change the base?
Conversation
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 @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
This pull request updates the Gemini samples by updating the model name from gemini-1.5-pro-001
and gemini-1.5-flash-002
to gemini-2.0-flash-001
in several files. It also removes old content cache samples and related test files.
Highlights
- Model Name Update: The model name is updated to
gemini-2.0-flash-001
indiscoveryengine/answer_query_sample.py
,discoveryengine/session_sample.py
,generative_ai/batch_predict/gemini_batch_predict_bigquery.py
,generative_ai/batch_predict/gemini_batch_predict_gcs.py
,generative_ai/express_mode/api_key_example.py
, and other files. - Content Cache Sample Removal: The pull request removes the old content cache samples, including
genai/content_cache/contentcache_create_with_txt_gcs_pdf.py
,genai/content_cache/contentcache_delete.py
,genai/content_cache/contentcache_list.py
,genai/content_cache/contentcache_update.py
,genai/content_cache/contentcache_use_with_txt.py
,genai/content_cache/noxfile_config.py
, andgenai/content_cache/test_content_cache_examples.py
.
Changelog
Click here to see the changelog
- discoveryengine/answer_query_sample.py
- Updated model name from
gemini-1.5-pro-001
togemini-2.0-flash-001
in the header comment. - Updated
model_version
fromgemini-1.5-flash-001/answer_gen/v2
togemini-2.0-flash-001/answer_gen/v2
.
- Updated model name from
- discoveryengine/session_sample.py
- Updated model name from
gemini-1.5-pro-001
togemini-2.0-flash-001
in the header comment.
- Updated model name from
- genai/content_cache/contentcache_create_with_txt_gcs_pdf.py
- Removed file.
- genai/content_cache/contentcache_delete.py
- Removed file.
- genai/content_cache/contentcache_list.py
- Removed file.
- genai/content_cache/contentcache_update.py
- Removed file.
- genai/content_cache/contentcache_use_with_txt.py
- Removed file.
- genai/content_cache/noxfile_config.py
- Removed file.
- genai/content_cache/test_content_cache_examples.py
- Removed file.
- generative_ai/batch_predict/gemini_batch_predict_bigquery.py
- Updated
source_model
fromgemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated
- generative_ai/batch_predict/gemini_batch_predict_gcs.py
- Updated
source_model
fromgemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated
- generative_ai/context_caching/create_context_cache.py
- Removed file.
- generative_ai/context_caching/delete_context_cache.py
- Removed file.
- generative_ai/context_caching/get_context_cache.py
- Removed file.
- generative_ai/context_caching/list_context_caches.py
- Removed file.
- generative_ai/context_caching/noxfile_config.py
- Removed file.
- generative_ai/context_caching/requirements-test.txt
- Removed file.
- generative_ai/context_caching/requirements.txt
- Removed file.
- generative_ai/context_caching/test_context_caching.py
- Removed file.
- generative_ai/context_caching/update_context_cache.py
- Removed file.
- generative_ai/context_caching/use_context_cache.py
- Removed file.
- generative_ai/controlled_generation/controlled_generation_test.py
- Removed file.
- generative_ai/controlled_generation/example_01.py
- Removed file.
- generative_ai/controlled_generation/example_02.py
- Removed file.
- generative_ai/controlled_generation/example_03.py
- Removed file.
- generative_ai/controlled_generation/example_04.py
- Removed file.
- generative_ai/controlled_generation/example_05.py
- Removed file.
- generative_ai/controlled_generation/example_06.py
- Removed file.
- generative_ai/controlled_generation/example_07.py
- Removed file.
- generative_ai/controlled_generation/noxfile_config.py
- Removed file.
- generative_ai/controlled_generation/requirements-test.txt
- Removed file.
- generative_ai/controlled_generation/requirements.txt
- Removed file.
- generative_ai/express_mode/api_key_example.py
- Updated model name from
gemini-1.5-flash
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/function_calling/advanced_example.py
- Removed file.
- generative_ai/function_calling/basic_example.py
- Removed file.
- generative_ai/function_calling/chat_example.py
- Removed file.
- generative_ai/function_calling/chat_function_calling_basic.py
- Removed file.
- generative_ai/function_calling/chat_function_calling_config.py
- Removed file.
- generative_ai/function_calling/noxfile_config.py
- Removed file.
- generative_ai/function_calling/parallel_function_calling_example.py
- Removed file.
- generative_ai/function_calling/requirements-test.txt
- Removed file.
- generative_ai/function_calling/requirements.txt
- Removed file.
- generative_ai/function_calling/test_function_calling.py
- Removed file.
- generative_ai/grounding/noxfile_config.py
- Removed file.
- generative_ai/grounding/palm_example.py
- Removed file.
- generative_ai/grounding/requirements-test.txt
- Removed file.
- generative_ai/grounding/requirements.txt
- Removed file.
- generative_ai/grounding/test_grounding.py
- Removed file.
- generative_ai/grounding/vais_example.py
- Removed file.
- generative_ai/grounding/web_example.py
- Removed file.
- generative_ai/image/image_example01.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/image/image_example02.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/labels/labels_example.py
- Updated model name from
gemini-1.5-flash-001
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/prompts/prompt_create.py
- Updated model name from
gemini-1.5-pro-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/prompts/prompt_delete.py
- Updated model name from
gemini-1.5-pro-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/prompts/prompt_get.py
- Updated model name from
gemini-1.5-pro-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/prompts/prompt_list_version.py
- Updated model name from
gemini-1.5-pro-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/prompts/prompt_restore_version.py
- Updated model name from
gemini-1.5-pro-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/prompts/prompt_template.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/provisioned_throughput/provisioned_throughput_with_txt.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/rag/generate_content_example.py
- Updated model name from
gemini-1.5-flash-001
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/rag/quickstart_example.py
- Updated model name from
gemini-1.5-flash-001
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/safety/safety_config_example.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/system_instructions/system_instructions_example.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/template_folder/advanced_example.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/template_folder/simple_example.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/text_generation/chat_multiturn_example.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/text_generation/chat_multiturn_stream_example.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/text_generation/gemini_describe_http_image_example.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/text_generation/gemini_describe_http_pdf_example.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/text_generation/gemini_translate_text.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/text_generation/generation_config_example.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/text_generation/multimodal_stream_example.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/text_generation/single_turn_multi_image_example.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/text_generation/text_example01.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/text_generation/text_example03.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/text_generation/text_stream_example01.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/token_count/api_example.py
- Removed file.
- generative_ai/token_count/list_tokens_example.py
- Removed file.
- generative_ai/token_count/local_sdk_example.py
- Removed file.
- generative_ai/token_count/multimodal_token_count_example.py
- Removed file.
- generative_ai/token_count/noxfile_config.py
- Removed file.
- generative_ai/token_count/requirements-test.txt
- Removed file.
- generative_ai/token_count/requirements.txt
- Removed file.
- generative_ai/token_count/simple_example.py
- Removed file.
- generative_ai/token_count/test_list_tokens_example.py
- Removed file.
- generative_ai/token_count/test_token_count_examples.py
- Removed file.
- generative_ai/understand_audio/summarization_example.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/understand_audio/transcription_example.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/understand_docs/pdf_example.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/understand_video/audio_video_example.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/understand_video/single_turn_video_example.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/video/gemini_describe_http_video_example.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/video/gemini_youtube_video_key_moments_example.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/video/gemini_youtube_video_summarization_example.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/video/multimodal_example01.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- generative_ai/video/multimodal_example02.py
- Updated model name from
gemini-1.5-flash-002
togemini-2.0-flash-001
.
- Updated model name from
- translate/samples/snippets/translate_with_gemini.py
- Updated model name from
gemini-1.0-pro
togemini-2.0-flash-001
.
- Updated model name from
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 new model arrives, shining bright,
Old samples fade into the night.
gemini-2.0-flash-001
,
Now the chosen one,
In code, we trust its guiding light.
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 pull request updates the Gemini samples by updating the model names and cleaning up old samples. The changes look good overall, but there are a few areas that could be improved.
Summary of Findings
- Model Name Updates: The model names have been updated from
gemini-1.5-pro-001
andgemini-1.5-flash-002
togemini-2.0-flash-001
. This is a necessary update to reflect the latest model versions. - File Deletions: Several files related to content caching have been deleted. Ensure that these files are no longer needed and that the deletion does not introduce any regressions.
Merge Readiness
The pull request is almost ready for merging. Please address the comments regarding the deleted files to ensure no regressions are introduced. I am unable to approve this pull request, and users should have others review and approve this code before merging.
Here is the summary of possible violations 😱 There are 2 possible violations for removing region tag in use.
The end of the violation section. All the stuff below is FYI purposes only. You are about to delete the following sample browser pages.
Here is the summary of changes. You are about to add 2 region tags.
You are about to delete 73 region tags.
This comment is generated by snippet-bot.
|
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.
Please update the PR with the CL that removes the snippets in use. Thanks.
snippetbot is good now; the PR has conflicts with requirements.txt that need to be resolved now. |
Migrate the Gemini Samples to 2.X
Majority of the required samples are created in genai folder which uses the latest GenAI SDK. In this PR, we are mostly clearing 1.X samples in generative_ai folder.
bugs: b/407554370
ref: cl/742330022 cl/743584467