Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
336 changes: 336 additions & 0 deletions examples/GitHub_issue_analyzer.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,336 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "Tce3stUlHN0L"
},
"source": [
"##### Copyright 2026 Google LLC."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
Comment on lines +14 to +15
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The execution_count for this cell is 1, and it's also non-null for several other cells. According to the repository style guide (line 43), this indicates that the notebook formatting script has not been run. Please run the formatting script to reset the execution counts to null before merging.

References
  1. If the execution_count has changed to something else than null, it usually indicates that the formatting script has not been run. A warning should be raised, but only once per notebook. Be very clear that it means that the formatting script must be run, not that the outputs should be removed. (link)

"cellView": "form",
"id": "tuOe1ymfHZPu"
},
"outputs": [],
"source": [
"#@title Licensed under the Apache License, Version 2.0 (the \"License\");\n",
"# you may not use this file except in compliance with the License.\n",
"# You may obtain a copy of the License at\n",
"#\n",
"# https://www.apache.org/licenses/LICENSE-2.0\n",
"#\n",
"# Unless required by applicable law or agreed to in writing, software\n",
"# distributed under the License is distributed on an \"AS IS\" BASIS,\n",
"# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
"# See the License for the specific language governing permissions and\n",
"# limitations under the License."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "qFdPvlXBOdUN"
},
"source": [
"# Gemini API: Name of your guide"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "MfBg1C5NB3X0"
},
"source": [
"<a target=\"_blank\" href=\"https://colab.research.google.com/github/google-gemini/cookbook/blob/main/quickstarts/Template.ipynb\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" height=30/></a>"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The 'Open in Colab' badge link points to the template notebook (.../quickstarts/Template.ipynb) instead of this new notebook. According to the repository style guide (lines 50-53), this should be updated to point to the correct location for this example (.../examples/GitHub_issue_analyzer.ipynb).

<a target="_blank" href="https://colab.research.google.com/github/google-gemini/cookbook/blob/main/examples/GitHub_issue_analyzer.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" height=30/></a>
References
  1. The 'Open in Colab' button should link to the notebook's location on GitHub, allowing users to open it directly in Colab. (link)

]
},
{
"cell_type": "markdown",
"metadata": {
"id": "r6P32iYYV27b"
},
"source": [
"_[remove me] Be sure to update the Colab link!_"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "XCVydW40iixa"
},
"source": [
"[If you're adding a new example, use this badge to promote yourself (yes sorry you'll have to write your name a lot of times)]\n",
"<!-- Community Contributor Badge -->\n",
"<table>\n",
" <tr>\n",
" <!-- Author Avatar Cell -->\n",
" <td bgcolor=\"#d7e6ff\">\n",
" <a href=\"https://github.com/Giom-V\" target=\"_blank\" title=\"View Guillaume's profile on GitHub\">\n",
" <img src=\"https://github.com/Giom-V.png?size=100\"\n",
" alt=\"Giom-V's GitHub avatar\"\n",
" width=\"100\"\n",
" height=\"100\">\n",
" </a>\n",
" </td>\n",
" <!-- Text Content Cell -->\n",
" <td bgcolor=\"#d7e6ff\">\n",
" <h2><font color='black'>This notebook was contributed by <a href=\"https://github.com/Giom-V\" target=\"_blank\"><font color='#217bfe'><strong>Giom (use either your GitHub handle or your real name, your choice)</strong></font></a>.</font></h2>\n",
" <h5><font color='black'><a href=\"URL\"><font color=\"#078efb\">Add a link to you blog, or linkedIn, or something else</font></a> - See <a href=\"https://github.com/Giom-V\" target=\"_blank\"><font color=\"#078efb\"><strong>Giom</strong></font></a> other notebooks <a href=\"https://github.com/search?q=repo%3Agoogle-gemini%2Fcookbook%20%22Giom%22&type=code\" target=\"_blank\"><font color=\"#078efb\">here</font></a>.</h5></font><br>\n",
" <!-- Footer -->\n",
" <font color='black'><small><em>Have a cool Gemini example? Feel free to <a href=\"https://github.com/google-gemini/cookbook/blob/main/CONTRIBUTING.md\" target=\"_blank\"><font color=\"#078efb\">share it too</font></a>!</em></small></font>\n",
" </td>\n",
" </tr>\n",
"</table>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "6b527162"
},
"source": [
"[When the model is a preview one an can potentially change or if it's a paid-only feature, add a disclaimer:]\n",
"> **Note:** Image generation is a paid-only feature and won't work if you are on the free tier. Check the [pricing](https://ai.google.dev/pricing#imagen-4) page for more details.\n",
"\n",
"> **Note:** Image-out is a preview feature. It is free to use for now with quota limitations, but is subject to change.\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "xHxb-dlhMIzW"
},
"source": [
"[Include a paragraph or two here explaining what this example demonstrates, who should be interested in it, and what you need to know before you get started.]"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "monLpKy7423V"
},
"source": [
"## Setup"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "5mi7BrkD44MF"
},
"source": [
"### Install SDK"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "AQJjzmYgH3sX"
},
"outputs": [],
"source": [
"%pip install -U -q \"google-genai>=1.0.0\" # Install the Python SDK\n",
"\n",
"# Always set at least 1.0.0 as the minimal version as there were breaking\n",
"# changes through the previous versions\n",
"# Of course, if your notebook uses a new feature and needs a more recent\n",
"# version, set the right minimum version to indicate when the feature was\n",
"# introduced.\n",
"# Always test your notebook with that fixed version (eg. '==1.0.0') to make.\n",
"# sure it's really the minimum version.\n"
]
Comment on lines +147 to +156
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This cell fails to execute, as shown by the error in the notebook's output. The lines of comments after the %pip install command are being interpreted as part of the command. Please move these comments to a separate markdown cell or remove them to fix the installation step.

%pip install -U -q "google-genai>=1.0.0"  # Install the Python SDK

},
{
"cell_type": "markdown",
"metadata": {
"id": "MUXex9ctTuDB"
},
"source": [
"### Set up your API key\n",
"\n",
"To run the following cell, your API key must be stored it in a Colab Secret named `GOOGLE_API_KEY`. If you don't already have an API key, or you're not sure how to create a Colab Secret, see the [Authentication ![image](https://storage.googleapis.com/generativeai-downloads/images/colab_icon16.png)](../quickstarts/Authentication.ipynb) quickstart for an example."
]
},
{
"cell_type": "code",
"execution_count": null,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This cell, along with many others in the notebook, has execution_count: null, indicating it hasn't been run. The repository style guide (line 40) notes that if code has changed but outputs haven't, it's a sign the notebook hasn't been tested. Please ensure you run all cells from top to bottom and save the notebook with outputs before merging to verify that it works correctly.

References
  1. The outputs do not have to be ignored, but if none of them changed while some code has, it might be a sign that the notebook has not been run to check that it works, in which case a warning should be raised; (link)

"metadata": {
"id": "wltbMJLIIXGk"
},
"outputs": [],
"source": [
"from google.colab import userdata\n",
"from google import genai\n",
"\n",
"GOOGLE_API_KEY = userdata.get('GOOGLE_API_KEY')\n",
"client = genai.Client(api_key=GOOGLE_API_KEY)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "hL54YG-kMDVF"
},
"source": [
"Now select the model you want to use in this guide, either by selecting one in the list or writing it down. Keep in mind that some models, like the 2.5 ones are thinking models and thus take slightly more time to respond (cf. [thinking notebook](./Get_started_thinking.ipynb) for more details and in particular learn how to switch the thiking off)."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There's a typo in this sentence. "thiking" should be "thinking".

Now select the model you want to use in this guide, either by selecting one in the list or writing it down. Keep in mind that some models, like the 2.5 ones are thinking models and thus take slightly more time to respond (cf. [thinking notebook](./Get_started_thinking.ipynb) for more details and in particular learn how to switch the thinking off).

]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "Lf6FamchMDsk"
},
"outputs": [],
"source": [
"MODEL_ID = \"gemini-3-flash-preview\" # @param [\"gemini-2.5-flash-lite\", \"gemini-2.5-flash\", \"gemini-2.5-pro\", \"gemini-2.5-flash-preview\", \"gemini-3.1-flash-lite-preview\", \"gemini-3.1-pro-preview\"] {\"allow-input\":true, isTemplate: true}\n",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The default MODEL_ID "gemini-3-flash-preview" is not included in the list of available models in the @param definition, which will cause an error in the Colab form. Please ensure the default value is present in the list of options, as per the style guide on model selection (line 72).

MODEL_ID = "gemini-3-flash-preview" # @param ["gemini-2.5-flash-lite", "gemini-2.5-flash", "gemini-2.5-pro", "gemini-3-flash-preview", "gemini-3.1-flash-lite-preview", "gemini-3.1-pro-preview"] {"allow-input":true, isTemplate: true}
References
  1. When using a Colab selector for models, the default model ID must be one of the options available in the dropdown list. (link)

"\n",
"# Ideally order the model by \"cabability\" ie. generation then within generation\n",
"# 8b/flash-lite then flash then pro"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "w5i8tMZKIeUu"
},
"source": [
"## [Write your guide]\n",
"\n",
"[Add as many high level sections as needed to step through your guide. Try to introduce new concepts incrementally, including explanatory text at every step. Remember that notebooks need to be executable from start to finish using `Runtime -> Run all` in Colab.]"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "4677dd58e9b5"
},
"source": [
"## Next Steps\n",
"### Useful API references:\n",
"\n",
"[Always end with links to the related doumentation]\n",
"\n",
"### Related examples\n",
"\n",
"[If any, add links to the related examples]\n",
"\n",
"### Continue your discovery of the Gemini API\n",
"\n",
"[Finally, link some other quickstarts that are either related or require the same level of expertise]\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "UhNtHfuxCGVy"
},
"source": [
"# Resources (don't forget to delete everything starting from here)\n",
"\n",
"* Follow the [Google developer documentation style guide](https://developers.google.com/style/highlights)\n",
"* The [TensorFlow documentation style guide](https://www.tensorflow.org/community/contribute/docs_style) has useful guidance for notebooks.\n",
"* Read the [Cookbook contributor guide](https://github.com/google-gemini/cookbook/blob/main/CONTRIBUTING.md) and the [Cookbook Examples contributor guide](https://github.com/google-gemini/cookbook/blob/main/examples/CONTRIBUTING.md)."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "2V22fKegUtF9"
},
"source": [
"## Notebook style (also check the [Contributing guide](Contributing.mg))\n",
"\n",
"* Include the collapsed license at the top (uses the Colab \"Form\" mode to hide the cells).\n",
"* Save the notebook with the table of contents open.\n",
"* Use one `H1` header for the title.\n",
"* Include the button-bar immediately after the `H1`.\n",
"* Include an overview section before any code.\n",
"* Keep your installs and imports close to the code that first uses them. If they are used throughout (such as the SDK), they can go at the start of the guide.\n",
"* Keep code and text cells as brief as possible.\n",
"* Break text cells at headings\n",
"* Break code cells between \"building\" and \"running\", and between \"printing one result\" and \"printing another result\".\n",
"* Necessary but uninteresting code should be hidden in a toggleable code cell by putting `# @title` as the first line.\n",
"* You can optionally add a byline for content in `examples/` that you wrote, including one link to your GitHub, social, or site of your choice."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "QKp40qS-DGEZ"
},
"source": [
"### Code style\n",
"\n",
"* Notebooks are for people. Write code optimized for clarity.\n",
"* Keep examples quick and concise.\n",
"* Use the [Google Python Style Guide](http://google.github.io/styleguide/pyguide.html), where applicable. Code formatted by [`pyink`](https://github.com/google/pyink) will always be accepted.\n",
"* In particular, defining functions and variables takes extra spaces around the `=` sign, while function parameters don't:\n",
"```python\n",
" var = value\n",
" function(\n",
" parameter=value\n",
" )\n",
"```\n",
"* If you define a function, run it and show us what it does before using it in another function.\n",
"* Demonstrate small parts before combining them into something more complex.\n",
"* Keep the code as simple as possible, only use extra parameters like temperature when needed, and in that case, explain why\n",
"* To ensure notebook text remains accurate, present model metadata by executing code.\n",
" * For example, instead of saying \"1M token context\" in the text, display the output of `client.models.get(model='...').input_token_limit`.\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "78HBT9cQXJko"
},
"source": [
"### Text\n",
"\n",
"* Use an imperative style. \"Run a prompt using the API.\"\n",
"* Use sentence case in titles/headings.\n",
"* Use short titles/headings: \"Download the data\", \"Call the API\", \"Process the results\".\n",
"* Use the [Google developer documentation style guide](https://developers.google.com/style/highlights).\n",
"* Use [second person](https://developers.google.com/style/person): \"you\" rather than \"we\".\n",
"* When using links between notebooks, use relative ones as they'll work better in IDEs and Colab. Use absolute ones to link to folders or markdown files.\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "YrsKXcPRUvK9"
},
"source": [
"## GitHub workflow\n",
"\n",
"* Be consistent about how you save your notebooks, otherwise the JSON diffs are messy. [`nbfmt` and `nblint`](https://github.com/tensorflow/docs/blob/master/tools/tensorflow_docs/tools/README.md) help here.\n",
"* This notebook has the \"Omit code cell output when saving this notebook\" option set. GitHub refuses to diff notebooks with large diffs (inline images).\n",
"* [ReviewNB.com](http://reviewnb.com) can help with diffs. This is linked in a comment on a notebook pull request.\n",
"* Use the [Open in Colab](https://chrome.google.com/webstore/detail/open-in-colab/iogfkhleblhcpcekbiedikdehleodpjo) extension to open a GitHub notebook in Colab.\n",
"* The easiest way to edit a notebook in GitHub is to open it with Colab from the branch you want to edit. Then use File --> Save a copy in GitHub, which will save it back to the branch you opened it from.\n",
"* For PRs it's helpful to post a direct Colab link to the PR head: https://colab.research.google.com/github/{USER}/{REPO}/blob/{BRANCH}/{PATH}.ipynb"
]
}
],
"metadata": {
"colab": {
"collapsed_sections": [
"Tce3stUlHN0L"
],
"name": "GitHub_issue_analyzer.ipynb",
"toc_visible": true
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Comment on lines +1 to +620
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This notebook appears to be an unmodified copy of the project's template. The content for the 'GitHub issue analyzer' example is missing. Please replace all placeholder text and instructions with the actual code and explanations for your example. I've added more specific comments on issues within the template that also need to be addressed.

1 change: 1 addition & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ This is a collection of fun and helpful examples for the Gemini API.
| [Talk to documents](./Talk_to_documents_with_embeddings.ipynb) | Use embeddings to search through a custom database. | Embeddings | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/google-gemini/cookbook/blob/main/examples/Talk_to_documents_with_embeddings.ipynb) |
| [Entity extraction](./Entity_Extraction.ipynb) | Use Gemini API to speed up some of your tasks, such as searching through text to extract needed information. Entity extraction with a Gemini model is a simple query, and you can ask it to retrieve its answer in the form that you prefer. | Embeddings | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/google-gemini/cookbook/blob/main/examples/Entity_Extraction.ipynb) |
| [Google I/O 2025 Live coding session](./Google_IO2025_Live_Coding.ipynb) | Play with the notebook used during the Google I/O 2025 live coding session delivered by the Google DeepMind DevRel team. Work with the Gemini API SDK, know and practice with the GenMedia models, the thinking capable models, start using the Gemini API tools and more! | Gemini API and its models and features | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/google-gemini/cookbook/blob/main/examples/Google_IO2025_Live_Coding.ipynb) |
| [GitHub issue analyzer](./GitHub_issue_analyzer.ipynb) | Use Gemini API to interact with Pygithub API and extract useful insights from this repository | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/google-gemini/cookbook/blob/main/examples/GitHub_issue_analyzer.ipynb) |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The new table row for 'GitHub issue analyzer' is missing the 'Features' column, which breaks the table's alignment. Please add the relevant features for your example to this column to fix the formatting.

Suggested change
| [GitHub issue analyzer](./GitHub_issue_analyzer.ipynb) | Use Gemini API to interact with Pygithub API and extract useful insights from this repository | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/google-gemini/cookbook/blob/main/examples/GitHub_issue_analyzer.ipynb) |
| [GitHub issue analyzer](./GitHub_issue_analyzer.ipynb) | Use Gemini API to interact with Pygithub API and extract useful insights from this repository | Gemini API, Tools | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/google-gemini/cookbook/blob/main/examples/GitHub_issue_analyzer.ipynb) |


---
<br>
Expand Down