back to home

googleapis / python-aiplatform

A Python SDK for Vertex AI, a fully managed, end-to-end platform for data science and machine learning.

870 stars
437 forks
416 issues
PythonShellDockerfile

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing googleapis/python-aiplatform in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/googleapis/python-aiplatform)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

Vertex AI SDK for Python ================================================= |GA| |pypi| |versions| |unit-tests| |system-tests| |sample-tests| _: Google Vertex AI is an integrated suite of machine learning tools and services for building and using ML models with AutoML or custom code. It offers both novices and experts the best workbench for the entire machine learning development lifecycle. • _ • _ .. |GA| image:: https://img.shields.io/badge/support-ga-gold.svg :target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#general-availability .. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-aiplatform.svg :target: https://pypi.org/project/google-cloud-aiplatform/ .. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-aiplatform.svg :target: https://pypi.org/project/google-cloud-aiplatform/ .. |unit-tests| image:: https://storage.googleapis.com/cloud-devrel-public/python-aiplatform/badges/sdk-unit-tests.svg :target: https://storage.googleapis.com/cloud-devrel-public/python-aiplatform/badges/sdk-unit-tests.html .. |system-tests| image:: https://storage.googleapis.com/cloud-devrel-public/python-aiplatform/badges/sdk-system-tests.svg :target: https://storage.googleapis.com/cloud-devrel-public/python-aiplatform/badges/sdk-system-tests.html .. |sample-tests| image:: https://storage.googleapis.com/cloud-devrel-public/python-aiplatform/badges/sdk-sample-tests.svg :target: https://storage.googleapis.com/cloud-devrel-public/python-aiplatform/badges/sdk-sample-tests.html .. _Vertex AI: https://cloud.google.com/vertex-ai/docs .. _Client Library Documentation: https://cloud.google.com/python/docs/reference/aiplatform/latest .. _Product Documentation: https://cloud.google.com/vertex-ai/docs Installation ~~~~~~~~~~~~ .. code-block:: console pip install google-cloud-aiplatform With :code: : .. code-block:: console uv pip install google-cloud-aiplatform Generative AI in the Vertex AI SDK ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To use Gen AI features from the Vertex AI SDK, you can instantiate a Vertex SDK client with the following: .. code-block:: Python import vertexai from vertexai import types # Instantiate GenAI client from Vertex SDK # Replace with your project ID and location client = vertexai.Client(project='my-project', location='us-central1') See the examples below for guidance on how to use specific features supported by the Vertex SDK client. Gen AI Evaluation ^^^^^^^^^^^^^^^^^ To run evaluation, first generate model responses from a set of prompts. .. code-block:: Python import pandas as pd prompts_df = pd.DataFrame({ "prompt": [ "What is the capital of France?", "Write a haiku about a cat.", "Write a Python function to calculate the factorial of a number.", "Translate 'How are you?' to French.", ], "reference": [ "Paris", "Sunbeam on the floor,\nA furry puddle sleeping,\nTwitching tail tells tales.", "def factorial(n):\n if n = 3.9 Deprecated Python Versions ^^^^^^^^^^^^^^^^^^^^^^^^^^ Python <= 3.8. The last version of this library compatible with Python 3.8 is google-cloud-aiplatform==1.90.0. The last version of this library compatible with Python 3.7 is google-cloud-aiplatform==1.31.1. The last version of this library compatible with Python 3.6 is google-cloud-aiplatform==1.12.1. Overview ~~~~~~~~ This section provides a brief overview of the Vertex AI SDK for Python. You can also reference the notebooks in _ for examples. .. _vertex-ai-samples: https://github.com/GoogleCloudPlatform/vertex-ai-samples/tree/main/notebooks/community/sdk All publicly available SDK features can be found in the :code: directory. Under the hood, Vertex SDK builds on top of GAPIC, which stands for Google API CodeGen. The GAPIC library code sits in :code: and :code: , and it is auto-generated from Google's service proto files. For most developers' programmatic needs, they can follow these steps to figure out which libraries to import: • Look through :code: first -- Vertex SDK's APIs will almost always be easier to use and more concise comparing with GAPIC • If the feature that you are looking for cannot be found there, look through :code: to see if it's available in GAPIC • If it is still in beta phase, it will be available in :code: If none of the above scenarios could help you find the right tools for your task, please feel free to open a github issue and send us a feature request. Importing ^^^^^^^^^ Vertex AI SDK resource based functionality can be used by importing the following namespace: .. code-block:: Python from google.cloud import aiplatform Initialization ^^^^^^^^^^^^^^ Initialize the SDK to store common configurations that you use with the SDK. .. code-block:: Python aiplatform.init( # your Google Cloud Project ID or number # environment default used is not set project='my-project', # the Vertex AI region you will use # defaults to us-central1 location='us-central1', # Google Cloud Storage bucket in same region as location # used to stage artifacts staging_bucket='gs://my_staging_bucket', # custom google.auth.credentials.Credentials # environment default credentials used if not set credentials=my_credentials, # customer managed encryption key resource name # will be applied to all Vertex AI resources if set encryption_spec_key_name=my_encryption_key_name, # the name of the experiment to use to track # logged metrics and parameters experiment='my-experiment', # description of the experiment above experiment_description='my experiment description' ) Datasets ^^^^^^^^ Vertex AI provides managed tabular, text, image, and video datasets. In the SDK, datasets can be used downstream to train models. To create a tabular dataset: .. code-block:: Python my_dataset = aiplatform.TabularDataset.create( display_name="my-dataset", gcs_source=['gs://path/to/my/dataset.csv']) You can also create and import a dataset in separate steps: .. co…