mirror of
https://github.com/GoogleCloudPlatform/vertex-ai-samples.git
synced 2026-09-26 14:42:04 +00:00
7.4 KiB
7.4 KiB
In [ ]:
# @title Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.In [ ]:
! pip3 install --upgrade --quiet google-genai google-cloud-aiplatformIn [ ]:
import os
import sys
# Vertex AI SDK
# import vertexai
# Gen AI SDK
# from google import genai
# from google.genai import typesIn [ ]:
if "google.colab" in sys.modules:
from google.colab import auth
auth.authenticate_user()In [ ]:
PROJECT_ID = "[your-project-id]" # @param {type: "string", placeholder: "[your-project-id]", isTemplate: true}
if not PROJECT_ID or PROJECT_ID == "[your-project-id]":
PROJECT_ID = str(os.environ.get("GOOGLE_CLOUD_PROJECT"))
LOCATION = "us-central1" # @param {type:"string"}In [ ]:
# Vertex AI SDK
# vertexai.init(project=PROJECT_ID, location=LOCATION)
# Gen AI SDK
# client = genai.Client(vertexai=True, project=PROJECT_ID, location=LOCATION)