Client libraries provide an optimized developer experience for calling the Vertex AI API. The client libraries use each supported language's natural conventions and reduce boilerplate code that you have to write. The following guide explains how to install the libraries and set up authentication for using them in a local development environment.
Before you begin
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Enable the Vertex AI API.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Enable the Vertex AI API.
-
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
Client libraries
Vertex AI provides client libraries for the following languages. Select the language that you want to use.
C#
Run the following command to add the Google.Cloud.AIPlatform.V1
package
reference to your project file:
dotnet add package Google.Cloud.AIPlatform.V1
Try code samples
To view or get individual code samples, go to the dotnet-aiplatform GitHub repository.
Client library documentation
For more information, view the Vertex AI .NET client library documentation.
Java
If you are using Maven, add the following to your dependencies:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-aiplatform</artifactId>
<version>3.35.0</version>
</dependency>
If you are using Gradle, add the following to your dependencies:
compile 'com.google.cloud:google-cloud-aiplatform:3.35.0'
If you are using sbt, add the following to your dependencies:
libraryDependencies += "com.google.cloud" % "google-cloud-aiplatform" % "3.35.0"
Try code samples
To view or get individual code samples, go to the java-aiplatform GitHub repository.
Client library documentation
For more information, view the Vertex AI client library for Java documentation.
Node.js
Before installing the library, prepare your environment for Node.js development.
Run the following command in your environment to install the client library:
npm install @google-cloud/aiplatform
Client library documentation
For more information, view the Vertex AI client library for Node.js documentation.
Python
The Vertex AI Python client library is installed when you install the Vertex AI SDK for Python.
For more information, see Install the Vertex AI SDK for Python.
Go
Before installing the library, prepare your environment for Go development.
Review available packages
Review the available Vertex AI API Go packages to determine which package best meets your project's needs:
Package cloud.google.com/go/vertexai (recommended)
vertexai
is a human authored package that provides access to common capabilities and features.This package is recommended as the starting point for most developers building with the Vertex AI API. To access capabilities and features not yet covered by this package, use the auto-generated
aiplatform
instead.Package cloud.google.com/go/aiplatform
aiplatform
is an auto-generated package.This package is intended for projects that require access to Vertex AI API capabilities and features not yet provided by the human authored
vertexai
package.
Installation
Package cloud.google.com/go/vertexai (recommended)
Run the following command to install this package in your environment:
go get cloud.google.com/go/vertexai
Package cloud.google.com/go/aiplatform
Run the following command to install this package in your environment:
go get cloud.google.com/go/aiplatform
Samples
Package cloud.google.com/go/vertexai (recommended)
Samples for using this package are available, in the
golang-samples
GitHub repository in the top-levelvertexai
directory:Package cloud.google.com/go/aiplatform
Samples for using this package are available, in the
golang-samples
GitHub repository in the top-levelaiplatform
directory:
Client library documentation
For more information about the library, see the Vertex AI client library for Go documentation:
Package cloud.google.com/go/vertexai (recommended)
- Vertex AI
cloud.google.com/go/vertexai
API reference
- Vertex AI
Package cloud.google.com/go/aiplatform
- Vertex AI
cloud.google.com/go/aiplatform
v1 API reference - Vertex AI
cloud.google.com/go/aiplatform
v1beta1 API reference
- Vertex AI