Files
model_garden/skills/vertex-inference/scripts/openmaas_genai_sdk.py
T
vincentkt-googleandGitHub 86674effee Add and update existing vertex skills (#4467)
* Add and update existing vertex skills

- Add support for fine tuning for 1p gemini tuning
- Add support for deploying fine tuned model support
- Add support for running inference on MaaS models
- Add open model support for regions and cost estimating for 3p tuning

* fixing some of the commit errors

* updated scripts to use existing gemini 1.5 pro model

* swap gemini 1.5 pro to gemini 2.5 pro
2026-03-11 19:45:42 +00:00

33 lines
1.1 KiB
Python

# 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
#
# http://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.
from google import genai
import google.auth
# Get default project ID from environment
_, project_id = google.auth.default()
client = genai.Client(
vertexai=True,
project=project_id,
location="global", # OpenMaaS models are often global
)
# Note: For GenAI SDK/Vertex with OpenMaaS, you MUST use the full path: `publishers/PUBLISHER/models/MODEL`
response = client.models.generate_content(
model="publishers/zai-org/models/glm-5-maas",
contents="Explain quantum computing in simple terms.",
)
print(response.text)