Install the Vertex AI client libraries

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

  1. 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.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Enable the Vertex AI API.

    Enable the API

  4. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  5. Enable the Vertex AI API.

    Enable the API

  6. 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

Client library documentation

For more information about the library, see the Vertex AI client library for Go documentation: