Chat about your notebook with Gemini
This document describes how you can use Gemini in Colab Enterprise, which is a product in the Gemini for Google Cloud portfolio, to chat about your notebook.
Learn how and when Gemini for Google Cloud uses your data.
This document is intended for data analysts, data scientists, and data developers who work with Colab Enterprise. It assumes you have knowledge of how to write code in a notebook environment.
Overview
You can chat with Gemini about potential coding solutions or how to do specific tasks in your notebook. You can also get explanations of the code in a notebook.
For example, you might start with prompts similar to the following:
- How do I filter a Pandas DataFrame?
- How can I create a plot in Colab Enterprise?
- Show me a list of publicly available datasets.
- Summarize the purpose of this notebook.
Gemini uses your notebook as context. You can discuss relevant details, get suggestions for improving your code, or get ideas for what to try next.
Before you begin
- Ensure that Gemini in Colab Enterprise is set up for your Google Cloud user account and project.
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
Enable the Vertex AI, Cloud AI Companion, Dataform, and Compute Engine APIs.
-
Enable the Vertex AI, Cloud AI Companion, Dataform, and Compute Engine APIs.
Required roles
To get the permissions that you need to use Gemini in Colab Enterprise, ask your administrator to grant you the following IAM roles on the project:
-
Colab Enterprise User (
roles/aiplatform.colabEnterpriseUser
) -
Gemini for Google Cloud User (
roles/cloudaicompanion.user
)
For more information about granting roles, see Manage access to projects, folders, and organizations.
You might also be able to get the required permissions through custom roles or other predefined roles.
Use chat
To chat about your notebook with Gemini, do the following:
-
In the Google Cloud console, go to the Colab Enterprise My notebooks page.
-
In the Region menu, select the region that contains your notebook.
-
Click the notebook that you want to open.
-
In the toolbar, click the
Show Gemini button to open the chat dialog. -
In the Gemini dialog, enter a prompt to begin your chat.
-
Gemini responds to your prompt. The response can include code snippets, general advice for your notebook, or general information that might help answer your question.
After evaluating the content, you can do the following:
- To copy a suggested code snippet, click the Copy button. Then paste the code into a code cell in your notebook.
- To add a suggested code snippet as a new code cell in your notebook, click the Add code cell button.
- Ask follow-up questions and continue the discussion as needed.
-
To close the Gemini dialog, click
Close.
Turn off Gemini in Colab Enterprise
To turn off Gemini in Colab Enterprise for a Google Cloud project, an administrator must turn off the Gemini for Google Cloud API. See Disabling services.
To turn off Gemini in Colab Enterprise for a specific user, an
administrator needs to revoke the
Gemini for
Google Cloud User (roles/cloudaicompanion.user
) role for that user. See
Revoke
a single IAM role.
What's next
Read the Gemini for Google Cloud overview.
For more ways to write and edit code with Gemini assistance, see the following: