refactor: reformat notebook template (#4414)

* refactor: reformat notebook template

* Update Python version to 3.12

* Fix an import

* Update licience year
This commit is contained in:
Eric Dong
2026-01-12 13:15:30 -05:00
committed by GitHub
parent 1f2db2903c
commit 4fac3a630f
2 changed files with 27 additions and 11 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.14'
python-version: '3.12'
- name: Fetch pull request branch
uses: actions/checkout@v6
with:
+26 -10
View File
@@ -8,7 +8,7 @@
},
"outputs": [],
"source": [
"# Copyright 2025 Google LLC\n",
"# Copyright 2026 Google LLC\n",
"#\n",
"# Licensed under the Apache License, Version 2.0 (the \"License\");\n",
"# you may not use this file except in compliance with the License.\n",
@@ -85,7 +85,7 @@
"id": "No17Cw5hgx12"
},
"source": [
"### Install Vertex AI SDK for Python and other required packages\n"
"### Install required packages\n"
]
},
{
@@ -99,6 +99,29 @@
"! pip3 install --upgrade --quiet google-cloud-aiplatform"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "1e9f41eb4f56"
},
"source": [
"### Import libraries"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "15601a82db68"
},
"outputs": [],
"source": [
"import os\n",
"import sys\n",
"\n",
"import vertexai"
]
},
{
"cell_type": "markdown",
"metadata": {
@@ -118,10 +141,7 @@
},
"outputs": [],
"source": [
"import sys\n",
"\n",
"if \"google.colab\" in sys.modules:\n",
"\n",
" from google.colab import auth\n",
"\n",
" auth.authenticate_user()"
@@ -146,8 +166,6 @@
},
"outputs": [],
"source": [
"import os\n",
"\n",
"PROJECT_ID = \"[your-project-id]\" # @param {type: \"string\", placeholder: \"[your-project-id]\", isTemplate: true}\n",
"if not PROJECT_ID or PROJECT_ID == \"[your-project-id]\":\n",
" PROJECT_ID = str(os.environ.get(\"GOOGLE_CLOUD_PROJECT\"))\n",
@@ -161,7 +179,7 @@
"id": "d95621cbf42f"
},
"source": [
"### Initialize Vertex AI SDK for Python"
"### Initialize Vertex AI SDK"
]
},
{
@@ -172,8 +190,6 @@
},
"outputs": [],
"source": [
"import vertexai\n",
"\n",
"vertexai.init(project=PROJECT_ID, location=LOCATION)"
]
},