Skip to content

Add self improving prompts notebook#1136

Open
MohitRajCode wants to merge 4 commits intogoogle-gemini:mainfrom
MohitRajCode:add-self-improving-prompts-notebook
Open

Add self improving prompts notebook#1136
MohitRajCode wants to merge 4 commits intogoogle-gemini:mainfrom
MohitRajCode:add-self-improving-prompts-notebook

Conversation

@MohitRajCode
Copy link

This PR adds a new example notebook demonstrating a simple
self-improving prompt loop using Gemini models.

The notebook shows how a prompt can be iteratively refined
using model-generated critique to improve response quality.

Closes #1113

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions github-actions bot added status:awaiting review PR awaiting review from a maintainer component:examples Issues/PR referencing examples folder labels Feb 9, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @mohithacker01, 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 new example notebook that showcases a self-improving prompt mechanism with Gemini models. The core concept demonstrated is the iterative refinement of model outputs, where the model itself generates critiques to enhance the quality of its responses. This approach aims to improve AI-generated content without requiring constant manual prompt adjustments, providing a valuable pattern for applications like customer support bots and automated content refinement.

Highlights

  • New Example Notebook: A new Jupyter notebook, self_improving_prompts.ipynb, has been added to the examples directory.
  • Self-Improving Prompts: The notebook demonstrates a self-improving prompt loop using Gemini models, where the model iteratively refines its own responses.
  • Model-Generated Critique: It showcases how model-generated critique can be used to enhance the quality of responses without manual prompt tuning.
Changelog
  • examples/prompting/self_improving_prompts.ipynb
    • This new Jupyter notebook has been added to illustrate the self-improving prompt pattern.
    • It contains Python code that utilizes the google.genai library to interact with Gemini models.
    • The notebook defines functions for generating an initial response, critiquing it, and then improving it based on the critique.
    • An example scenario for refining a customer service response is provided.
    • Users are required to set a GEMINI_API_KEY environment variable to run the notebook.
Activity
  • No human activity (comments, reviews) has been recorded on this pull request yet.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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 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

  1. 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.

@google-cla
Copy link

google-cla bot commented Feb 9, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Contributor

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

Code Review

This pull request adds a new notebook demonstrating a self-improving prompt loop, which is a valuable example. However, the notebook needs several updates to align with the repository's style guide before it can be merged. The main issues include missing setup elements like the pip installation and Colab badge, the use of hardcoded values instead of interactive forms, and structural improvements for better readability. Additionally, the new notebook should be referenced in the README.md files in the examples/ and examples/prompting/ directories as per the style guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:examples Issues/PR referencing examples folder status:awaiting review PR awaiting review from a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue: Systemic Passivity & Lack of Autonomous Initiation Toggle (Trusted Partner Mode)

1 participant