To learn how to install the Vertex AI SDK for Python, see Install the Vertex AI SDK for Python. To view the Vertex AI SDK reference guide, see Vertex AI SDK reference.
Why use the Vertex AI SDK
The Vertex AI SDK for Python is recommended if you're an experienced machine learning (ML) and artificial intelligence (AI) engineer or a data scientist who wants to programmatically automate your workflow. The Vertex AI SDK for Python is similar to the Vertex AI Python client library, except the Vertex AI SDK is higher-level and less granular. For more information, see Understand the SDK and client library differences.
Write code with the Vertex AI SDK for Python
To use the Vertex AI SDK for Python, you need to add a line in your code to import its namespace. Next, use the Vertex AI SDK reference documentation and code samples to learn about its classes, methods, and properties.
Import the Vertex AI SDK namespace
The Vertex AI SDK for Python uses the google.cloud.aiplatform
namespace. To get
access to the Vertex AI SDK for Python's functionality, import this namespace by
adding the following line to your Python code:
from google.cloud import aiplatform
Learn about the Vertex AI SDK for Python
The Vertex AI SDK for Python reference documents the Vertex AI SDK for Python functionality. This reference includes class definitions, methods, properties, and everything else required to use the Vertex AI SDK to programmatically automate Vertex AI. For more information, see the Vertex AI SDK reference.
Try code samples and tutorials
Jupyter notebook tutorials show how to use the Vertex AI SDK for Python as part of a larger workflow. For more information, see Vertex AI notebook tutorials.
Code samples in the Vertex AI SDK for Python GitHub repository show you how to complete individual tasks. For more information, see the Vertex AI SDK for Python GitHub repository.
Understand the Vertex AI SDK and client library differences
When you install the Vertex AI SDK for Python, the Vertex AI Python client library is also installed. The Vertex AI SDK and the Vertex AI Python client library provide similar functionality with different levels of granularity. The Vertex AI SDK operates at a higher level of abstraction than the client library and is suitable for most common data science workflows. If you need lower-level functionality, then use the Vertex AI Python client library.
The Vertex AI SDK is available for Python and a Vertex AI client library is available for Python, Java, and Node.js. To learn how to install the Java or Node.js client library, see Install the Vertex AI client libraries. If a client library isn't available in your preferred programming language, you can use the Vertex AI REST API. For more information, see the Vertex AI REST reference.
Use Vertex AI Python client library and SDK together
If you use the Vertex AI SDK for Python and discover you need greater flexibility
or control, or if you need a method not included in the Vertex AI SDK, you
can use the Vertex AI Python client library in the same workflow. The
Vertex AI Python client library uses a different namespace to access the
Vertex AI API. The client library and the Vertex AI SDK for Python
namespaces can be used in the same Python script by adding an import
line for
each in your Python script.
To learn about the Vertex AI SDK namespace, see Import the Vertex AI SDK namespace earlier in this page.
Import the Vertex AI Python client library namespace
The Vertex AI Python client library namespace is
google.cloud.aiplatform.gapic
. This namespace maps to the
google.cloud.aiplatform_v1
namespace. These two namespaces can be used
interchangeably. To import the Python client library, include one of the
following in your Python script:
from google.cloud import aiplatform_v1
from google.cloud.aiplatform import gapic
What's next
Learn how to choose a training method.