Add Self-Improving Prompts notebook#1120
Add Self-Improving Prompts notebook#1120Karanjot786 wants to merge 3 commits intogoogle-gemini:mainfrom
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Summary of ChangesHello @Karanjot786, 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 introduces a novel approach to prompt engineering by enabling the Gemini model to autonomously refine its own prompts. The new notebook provides a comprehensive guide and a reusable function for this self-critique and iterative improvement process, aiming to enhance prompt effectiveness and streamline the development of high-quality AI interactions. Highlights
Using Gemini Code AssistThe 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
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 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
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a new notebook, Self_Improving_Prompts.ipynb, which is a great example of using Gemini to iteratively refine prompts. The notebook is well-structured and clearly demonstrates the self-improvement pattern. I've added a few comments with suggestions to align the notebook with the repository's style guide, mainly concerning notebook formatting, use of modern HTML, and docstring completeness. Overall, this is a valuable addition to the cookbook.
There was a problem hiding this comment.
Code Review
This pull request introduces a new notebook, Self_Improving_Prompts.ipynb, which is a great example of using Gemini to iteratively refine prompts. The notebook is well-structured and the concept is clearly explained. The update to the README.md is also correct. My review includes a few suggestions to align the notebook with the repository's style guide, mainly concerning notebook metadata, HTML formatting, and docstring completeness.
|
Thanks for the review! I've addressed the feedback:
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces an excellent new notebook, Self_Improving_Prompts.ipynb, which clearly demonstrates how to use Gemini for iterative prompt improvement. The example is well-structured, starting with a simple case and building up to a reusable function. The update to the README.md is also correct.
My review includes a couple of suggestions to improve consistency with the rest of the cookbook, mainly regarding notebook formatting and the method for retrieving API keys in Colab. These changes will help maintain a uniform style across all examples, making them easier for users to follow.
Closes #1110
What this PR does
Adds a new prompting example showing how to use Gemini to optimize prompts through self-critique.
Changes
examples/prompting/Self_Improving_Prompts.ipynbNotebook contents
improve_prompt()function for any promptExample output
Before: Generic 2-sentence summary
After: Single sentence, 25 words, specific tone and constraints
The
improve_prompt()function took "Write a poem about coding" and after 2 iterations produced a full Petrarchan sonnet about refactoring code.Testing
cc @Giom-V @patrickloeber