Class ModelServiceClient (2.4.0)

public class ModelServiceClient implements BackgroundResource

Service Description: A service for managing Vertex AI's machine learning Models.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
   Model response = modelServiceClient.getModel(name);
 }
 

Note: close() needs to be called on the ModelServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of ModelServiceSettings to create(). For example:

To customize credentials:


 ModelServiceSettings modelServiceSettings =
     ModelServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings);
 

To customize the endpoint:


 ModelServiceSettings modelServiceSettings =
     ModelServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 ModelServiceClient modelServiceClient = ModelServiceClient.create(modelServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > ModelServiceClient

Implements

BackgroundResource

Constructors

ModelServiceClient(ModelServiceSettings settings)

protected ModelServiceClient(ModelServiceSettings settings)

Constructs an instance of ModelServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
NameDescription
settingsModelServiceSettings

ModelServiceClient(ModelServiceStub stub)

protected ModelServiceClient(ModelServiceStub stub)
Parameter
NameDescription
stubModelServiceStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

close()

public final void close()

create()

public static final ModelServiceClient create()

Constructs an instance of ModelServiceClient with default settings.

Returns
TypeDescription
ModelServiceClient
Exceptions
TypeDescription
IOException

create(ModelServiceSettings settings)

public static final ModelServiceClient create(ModelServiceSettings settings)

Constructs an instance of ModelServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
NameDescription
settingsModelServiceSettings
Returns
TypeDescription
ModelServiceClient
Exceptions
TypeDescription
IOException

create(ModelServiceStub stub)

public static final ModelServiceClient create(ModelServiceStub stub)

Constructs an instance of ModelServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(ModelServiceSettings).

Parameter
NameDescription
stubModelServiceStub
Returns
TypeDescription
ModelServiceClient

deleteModelAsync(DeleteModelRequest request)

public final OperationFuture<Empty,DeleteOperationMetadata> deleteModelAsync(DeleteModelRequest request)

Deletes a Model.

Model can only be deleted if there are no [DeployedModels][] created from it.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   DeleteModelRequest request =
       DeleteModelRequest.newBuilder()
           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
           .build();
   modelServiceClient.deleteModelAsync(request).get();
 }
 
Parameter
NameDescription
requestDeleteModelRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Empty,DeleteOperationMetadata>

deleteModelAsync(ModelName name)

public final OperationFuture<Empty,DeleteOperationMetadata> deleteModelAsync(ModelName name)

Deletes a Model.

Model can only be deleted if there are no [DeployedModels][] created from it.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
   modelServiceClient.deleteModelAsync(name).get();
 }
 
Parameter
NameDescription
nameModelName

Required. The name of the Model resource to be deleted. Format: projects/{project}/locations/{location}/models/{model}

Returns
TypeDescription
OperationFuture<Empty,DeleteOperationMetadata>

deleteModelAsync(String name)

public final OperationFuture<Empty,DeleteOperationMetadata> deleteModelAsync(String name)

Deletes a Model.

Model can only be deleted if there are no [DeployedModels][] created from it.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
   modelServiceClient.deleteModelAsync(name).get();
 }
 
Parameter
NameDescription
nameString

Required. The name of the Model resource to be deleted. Format: projects/{project}/locations/{location}/models/{model}

Returns
TypeDescription
OperationFuture<Empty,DeleteOperationMetadata>

deleteModelCallable()

public final UnaryCallable<DeleteModelRequest,Operation> deleteModelCallable()

Deletes a Model.

Model can only be deleted if there are no [DeployedModels][] created from it.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   DeleteModelRequest request =
       DeleteModelRequest.newBuilder()
           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
           .build();
   ApiFuture
Returns
TypeDescription
UnaryCallable<DeleteModelRequest,Operation>

deleteModelOperationCallable()

public final OperationCallable<DeleteModelRequest,Empty,DeleteOperationMetadata> deleteModelOperationCallable()

Deletes a Model.

Model can only be deleted if there are no [DeployedModels][] created from it.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   DeleteModelRequest request =
       DeleteModelRequest.newBuilder()
           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
           .build();
   OperationFuture
Returns
TypeDescription
OperationCallable<DeleteModelRequest,Empty,DeleteOperationMetadata>

exportModelAsync(ExportModelRequest request)

public final OperationFuture<ExportModelResponse,ExportModelOperationMetadata> exportModelAsync(ExportModelRequest request)

Exports a trained, exportable, Model to a location specified by the user. A Model is considered to be exportable if it has at least one supported export format.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   ExportModelRequest request =
       ExportModelRequest.newBuilder()
           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
           .setOutputConfig(ExportModelRequest.OutputConfig.newBuilder().build())
           .build();
   ExportModelResponse response = modelServiceClient.exportModelAsync(request).get();
 }
 
Parameter
NameDescription
requestExportModelRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<ExportModelResponse,ExportModelOperationMetadata>

exportModelAsync(ModelName name, ExportModelRequest.OutputConfig outputConfig)

public final OperationFuture<ExportModelResponse,ExportModelOperationMetadata> exportModelAsync(ModelName name, ExportModelRequest.OutputConfig outputConfig)

Exports a trained, exportable, Model to a location specified by the user. A Model is considered to be exportable if it has at least one supported export format.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
   ExportModelRequest.OutputConfig outputConfig =
       ExportModelRequest.OutputConfig.newBuilder().build();
   ExportModelResponse response = modelServiceClient.exportModelAsync(name, outputConfig).get();
 }
 
Parameters
NameDescription
nameModelName

Required. The resource name of the Model to export.

outputConfigExportModelRequest.OutputConfig

Required. The desired output location and configuration.

Returns
TypeDescription
OperationFuture<ExportModelResponse,ExportModelOperationMetadata>

exportModelAsync(String name, ExportModelRequest.OutputConfig outputConfig)

public final OperationFuture<ExportModelResponse,ExportModelOperationMetadata> exportModelAsync(String name, ExportModelRequest.OutputConfig outputConfig)

Exports a trained, exportable, Model to a location specified by the user. A Model is considered to be exportable if it has at least one supported export format.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
   ExportModelRequest.OutputConfig outputConfig =
       ExportModelRequest.OutputConfig.newBuilder().build();
   ExportModelResponse response = modelServiceClient.exportModelAsync(name, outputConfig).get();
 }
 
Parameters
NameDescription
nameString

Required. The resource name of the Model to export.

outputConfigExportModelRequest.OutputConfig

Required. The desired output location and configuration.

Returns
TypeDescription
OperationFuture<ExportModelResponse,ExportModelOperationMetadata>

exportModelCallable()

public final UnaryCallable<ExportModelRequest,Operation> exportModelCallable()

Exports a trained, exportable, Model to a location specified by the user. A Model is considered to be exportable if it has at least one supported export format.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   ExportModelRequest request =
       ExportModelRequest.newBuilder()
           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
           .setOutputConfig(ExportModelRequest.OutputConfig.newBuilder().build())
           .build();
   ApiFuture
Returns
TypeDescription
UnaryCallable<ExportModelRequest,Operation>

exportModelOperationCallable()

public final OperationCallable<ExportModelRequest,ExportModelResponse,ExportModelOperationMetadata> exportModelOperationCallable()

Exports a trained, exportable, Model to a location specified by the user. A Model is considered to be exportable if it has at least one supported export format.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   ExportModelRequest request =
       ExportModelRequest.newBuilder()
           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
           .setOutputConfig(ExportModelRequest.OutputConfig.newBuilder().build())
           .build();
   OperationFuture
Returns
TypeDescription
OperationCallable<ExportModelRequest,ExportModelResponse,ExportModelOperationMetadata>

getModel(GetModelRequest request)

public final Model getModel(GetModelRequest request)

Gets a Model.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   GetModelRequest request =
       GetModelRequest.newBuilder()
           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
           .build();
   Model response = modelServiceClient.getModel(request);
 }
 
Parameter
NameDescription
requestGetModelRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Model

getModel(ModelName name)

public final Model getModel(ModelName name)

Gets a Model.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
   Model response = modelServiceClient.getModel(name);
 }
 
Parameter
NameDescription
nameModelName

Required. The name of the Model resource. Format: projects/{project}/locations/{location}/models/{model}

Returns
TypeDescription
Model

getModel(String name)

public final Model getModel(String name)

Gets a Model.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
   Model response = modelServiceClient.getModel(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the Model resource. Format: projects/{project}/locations/{location}/models/{model}

Returns
TypeDescription
Model

getModelCallable()

public final UnaryCallable<GetModelRequest,Model> getModelCallable()

Gets a Model.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   GetModelRequest request =
       GetModelRequest.newBuilder()
           .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
           .build();
   ApiFuture
Returns
TypeDescription
UnaryCallable<GetModelRequest,Model>

getModelEvaluation(GetModelEvaluationRequest request)

public final ModelEvaluation getModelEvaluation(GetModelEvaluationRequest request)

Gets a ModelEvaluation.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   GetModelEvaluationRequest request =
       GetModelEvaluationRequest.newBuilder()
           .setName(
               ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]")
                   .toString())
           .build();
   ModelEvaluation response = modelServiceClient.getModelEvaluation(request);
 }
 
Parameter
NameDescription
requestGetModelEvaluationRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
ModelEvaluation

getModelEvaluation(ModelEvaluationName name)

public final ModelEvaluation getModelEvaluation(ModelEvaluationName name)

Gets a ModelEvaluation.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   ModelEvaluationName name =
       ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]");
   ModelEvaluation response = modelServiceClient.getModelEvaluation(name);
 }
 
Parameter
NameDescription
nameModelEvaluationName

Required. The name of the ModelEvaluation resource. Format: projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}

Returns
TypeDescription
ModelEvaluation

getModelEvaluation(String name)

public final ModelEvaluation getModelEvaluation(String name)

Gets a ModelEvaluation.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   String name =
       ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]").toString();
   ModelEvaluation response = modelServiceClient.getModelEvaluation(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the ModelEvaluation resource. Format: projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}

Returns
TypeDescription
ModelEvaluation

getModelEvaluationCallable()

public final UnaryCallable<GetModelEvaluationRequest,ModelEvaluation> getModelEvaluationCallable()

Gets a ModelEvaluation.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   GetModelEvaluationRequest request =
       GetModelEvaluationRequest.newBuilder()
           .setName(
               ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]")
                   .toString())
           .build();
   ApiFuture
Returns
TypeDescription
UnaryCallable<GetModelEvaluationRequest,ModelEvaluation>

getModelEvaluationSlice(GetModelEvaluationSliceRequest request)

public final ModelEvaluationSlice getModelEvaluationSlice(GetModelEvaluationSliceRequest request)

Gets a ModelEvaluationSlice.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   GetModelEvaluationSliceRequest request =
       GetModelEvaluationSliceRequest.newBuilder()
           .setName(
               ModelEvaluationSliceName.of(
                       "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]")
                   .toString())
           .build();
   ModelEvaluationSlice response = modelServiceClient.getModelEvaluationSlice(request);
 }
 
Parameter
NameDescription
requestGetModelEvaluationSliceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
ModelEvaluationSlice

getModelEvaluationSlice(ModelEvaluationSliceName name)

public final ModelEvaluationSlice getModelEvaluationSlice(ModelEvaluationSliceName name)

Gets a ModelEvaluationSlice.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   ModelEvaluationSliceName name =
       ModelEvaluationSliceName.of(
           "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]");
   ModelEvaluationSlice response = modelServiceClient.getModelEvaluationSlice(name);
 }
 
Parameter
NameDescription
nameModelEvaluationSliceName

Required. The name of the ModelEvaluationSlice resource. Format: projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}/slices/{slice}

Returns
TypeDescription
ModelEvaluationSlice

getModelEvaluationSlice(String name)

public final ModelEvaluationSlice getModelEvaluationSlice(String name)

Gets a ModelEvaluationSlice.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   String name =
       ModelEvaluationSliceName.of(
               "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]")
           .toString();
   ModelEvaluationSlice response = modelServiceClient.getModelEvaluationSlice(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the ModelEvaluationSlice resource. Format: projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}/slices/{slice}

Returns
TypeDescription
ModelEvaluationSlice

getModelEvaluationSliceCallable()

public final UnaryCallable<GetModelEvaluationSliceRequest,ModelEvaluationSlice> getModelEvaluationSliceCallable()

Gets a ModelEvaluationSlice.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   GetModelEvaluationSliceRequest request =
       GetModelEvaluationSliceRequest.newBuilder()
           .setName(
               ModelEvaluationSliceName.of(
                       "[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]", "[SLICE]")
                   .toString())
           .build();
   ApiFuture
Returns
TypeDescription
UnaryCallable<GetModelEvaluationSliceRequest,ModelEvaluationSlice>

getOperationsClient()

public final OperationsClient getOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
TypeDescription
OperationsClient

getSettings()

public final ModelServiceSettings getSettings()
Returns
TypeDescription
ModelServiceSettings

getStub()

public ModelServiceStub getStub()
Returns
TypeDescription
ModelServiceStub

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

listModelEvaluationSlices(ListModelEvaluationSlicesRequest request)

public final ModelServiceClient.ListModelEvaluationSlicesPagedResponse listModelEvaluationSlices(ListModelEvaluationSlicesRequest request)

Lists ModelEvaluationSlices in a ModelEvaluation.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   ListModelEvaluationSlicesRequest request =
       ListModelEvaluationSlicesRequest.newBuilder()
           .setParent(
               ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]")
                   .toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setReadMask(FieldMask.newBuilder().build())
           .build();
   for (ModelEvaluationSlice element :
       modelServiceClient.listModelEvaluationSlices(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListModelEvaluationSlicesRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
ModelServiceClient.ListModelEvaluationSlicesPagedResponse

listModelEvaluationSlices(ModelEvaluationName parent)

public final ModelServiceClient.ListModelEvaluationSlicesPagedResponse listModelEvaluationSlices(ModelEvaluationName parent)

Lists ModelEvaluationSlices in a ModelEvaluation.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   ModelEvaluationName parent =
       ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]");
   for (ModelEvaluationSlice element :
       modelServiceClient.listModelEvaluationSlices(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentModelEvaluationName

Required. The resource name of the ModelEvaluation to list the ModelEvaluationSlices from. Format: projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}

Returns
TypeDescription
ModelServiceClient.ListModelEvaluationSlicesPagedResponse

listModelEvaluationSlices(String parent)

public final ModelServiceClient.ListModelEvaluationSlicesPagedResponse listModelEvaluationSlices(String parent)

Lists ModelEvaluationSlices in a ModelEvaluation.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   String parent =
       ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]").toString();
   for (ModelEvaluationSlice element :
       modelServiceClient.listModelEvaluationSlices(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentString

Required. The resource name of the ModelEvaluation to list the ModelEvaluationSlices from. Format: projects/{project}/locations/{location}/models/{model}/evaluations/{evaluation}

Returns
TypeDescription
ModelServiceClient.ListModelEvaluationSlicesPagedResponse

listModelEvaluationSlicesCallable()

public final UnaryCallable<ListModelEvaluationSlicesRequest,ListModelEvaluationSlicesResponse> listModelEvaluationSlicesCallable()

Lists ModelEvaluationSlices in a ModelEvaluation.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   ListModelEvaluationSlicesRequest request =
       ListModelEvaluationSlicesRequest.newBuilder()
           .setParent(
               ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]")
                   .toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setReadMask(FieldMask.newBuilder().build())
           .build();
   while (true) {
     ListModelEvaluationSlicesResponse response =
         modelServiceClient.listModelEvaluationSlicesCallable().call(request);
     for (ModelEvaluationSlice element : response.getResponsesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListModelEvaluationSlicesRequest,ListModelEvaluationSlicesResponse>

listModelEvaluationSlicesPagedCallable()

public final UnaryCallable<ListModelEvaluationSlicesRequest,ModelServiceClient.ListModelEvaluationSlicesPagedResponse> listModelEvaluationSlicesPagedCallable()

Lists ModelEvaluationSlices in a ModelEvaluation.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   ListModelEvaluationSlicesRequest request =
       ListModelEvaluationSlicesRequest.newBuilder()
           .setParent(
               ModelEvaluationName.of("[PROJECT]", "[LOCATION]", "[MODEL]", "[EVALUATION]")
                   .toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setReadMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture
Returns
TypeDescription
UnaryCallable<ListModelEvaluationSlicesRequest,ListModelEvaluationSlicesPagedResponse>

listModelEvaluations(ListModelEvaluationsRequest request)

public final ModelServiceClient.ListModelEvaluationsPagedResponse listModelEvaluations(ListModelEvaluationsRequest request)

Lists ModelEvaluations in a Model.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   ListModelEvaluationsRequest request =
       ListModelEvaluationsRequest.newBuilder()
           .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setReadMask(FieldMask.newBuilder().build())
           .build();
   for (ModelEvaluation element :
       modelServiceClient.listModelEvaluations(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListModelEvaluationsRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
ModelServiceClient.ListModelEvaluationsPagedResponse

listModelEvaluations(ModelName parent)

public final ModelServiceClient.ListModelEvaluationsPagedResponse listModelEvaluations(ModelName parent)

Lists ModelEvaluations in a Model.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   ModelName parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
   for (ModelEvaluation element : modelServiceClient.listModelEvaluations(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentModelName

Required. The resource name of the Model to list the ModelEvaluations from. Format: projects/{project}/locations/{location}/models/{model}

Returns
TypeDescription
ModelServiceClient.ListModelEvaluationsPagedResponse

listModelEvaluations(String parent)

public final ModelServiceClient.ListModelEvaluationsPagedResponse listModelEvaluations(String parent)

Lists ModelEvaluations in a Model.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   String parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
   for (ModelEvaluation element : modelServiceClient.listModelEvaluations(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentString

Required. The resource name of the Model to list the ModelEvaluations from. Format: projects/{project}/locations/{location}/models/{model}

Returns
TypeDescription
ModelServiceClient.ListModelEvaluationsPagedResponse

listModelEvaluationsCallable()

public final UnaryCallable<ListModelEvaluationsRequest,ListModelEvaluationsResponse> listModelEvaluationsCallable()

Lists ModelEvaluations in a Model.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   ListModelEvaluationsRequest request =
       ListModelEvaluationsRequest.newBuilder()
           .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setReadMask(FieldMask.newBuilder().build())
           .build();
   while (true) {
     ListModelEvaluationsResponse response =
         modelServiceClient.listModelEvaluationsCallable().call(request);
     for (ModelEvaluation element : response.getResponsesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListModelEvaluationsRequest,ListModelEvaluationsResponse>

listModelEvaluationsPagedCallable()

public final UnaryCallable<ListModelEvaluationsRequest,ModelServiceClient.ListModelEvaluationsPagedResponse> listModelEvaluationsPagedCallable()

Lists ModelEvaluations in a Model.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   ListModelEvaluationsRequest request =
       ListModelEvaluationsRequest.newBuilder()
           .setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setReadMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture
Returns
TypeDescription
UnaryCallable<ListModelEvaluationsRequest,ListModelEvaluationsPagedResponse>

listModels(ListModelsRequest request)

public final ModelServiceClient.ListModelsPagedResponse listModels(ListModelsRequest request)

Lists Models in a Location.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   ListModelsRequest request =
       ListModelsRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setReadMask(FieldMask.newBuilder().build())
           .setOrderBy("orderBy-1207110587")
           .build();
   for (Model element : modelServiceClient.listModels(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListModelsRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
ModelServiceClient.ListModelsPagedResponse

listModels(LocationName parent)

public final ModelServiceClient.ListModelsPagedResponse listModels(LocationName parent)

Lists Models in a Location.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   for (Model element : modelServiceClient.listModels(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentLocationName

Required. The resource name of the Location to list the Models from. Format: projects/{project}/locations/{location}

Returns
TypeDescription
ModelServiceClient.ListModelsPagedResponse

listModels(String parent)

public final ModelServiceClient.ListModelsPagedResponse listModels(String parent)

Lists Models in a Location.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   for (Model element : modelServiceClient.listModels(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentString

Required. The resource name of the Location to list the Models from. Format: projects/{project}/locations/{location}

Returns
TypeDescription
ModelServiceClient.ListModelsPagedResponse

listModelsCallable()

public final UnaryCallable<ListModelsRequest,ListModelsResponse> listModelsCallable()

Lists Models in a Location.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   ListModelsRequest request =
       ListModelsRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setReadMask(FieldMask.newBuilder().build())
           .setOrderBy("orderBy-1207110587")
           .build();
   while (true) {
     ListModelsResponse response = modelServiceClient.listModelsCallable().call(request);
     for (Model element : response.getResponsesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListModelsRequest,ListModelsResponse>

listModelsPagedCallable()

public final UnaryCallable<ListModelsRequest,ModelServiceClient.ListModelsPagedResponse> listModelsPagedCallable()

Lists Models in a Location.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   ListModelsRequest request =
       ListModelsRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setReadMask(FieldMask.newBuilder().build())
           .setOrderBy("orderBy-1207110587")
           .build();
   ApiFuture
Returns
TypeDescription
UnaryCallable<ListModelsRequest,ListModelsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateModel(Model model, FieldMask updateMask)

public final Model updateModel(Model model, FieldMask updateMask)

Updates a Model.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   Model model = Model.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   Model response = modelServiceClient.updateModel(model, updateMask);
 }
 
Parameters
NameDescription
modelModel

Required. The Model which replaces the resource on the server.

updateMaskFieldMask

Required. The update mask applies to the resource. For the FieldMask definition, see google.protobuf.FieldMask.

Returns
TypeDescription
Model

updateModel(UpdateModelRequest request)

public final Model updateModel(UpdateModelRequest request)

Updates a Model.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   UpdateModelRequest request =
       UpdateModelRequest.newBuilder()
           .setModel(Model.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   Model response = modelServiceClient.updateModel(request);
 }
 
Parameter
NameDescription
requestUpdateModelRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Model

updateModelCallable()

public final UnaryCallable<UpdateModelRequest,Model> updateModelCallable()

Updates a Model.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   UpdateModelRequest request =
       UpdateModelRequest.newBuilder()
           .setModel(Model.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture
Returns
TypeDescription
UnaryCallable<UpdateModelRequest,Model>

uploadModelAsync(LocationName parent, Model model)

public final OperationFuture<UploadModelResponse,UploadModelOperationMetadata> uploadModelAsync(LocationName parent, Model model)

Uploads a Model artifact into Vertex AI.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   Model model = Model.newBuilder().build();
   UploadModelResponse response = modelServiceClient.uploadModelAsync(parent, model).get();
 }
 
Parameters
NameDescription
parentLocationName

Required. The resource name of the Location into which to upload the Model. Format: projects/{project}/locations/{location}

modelModel

Required. The Model to create.

Returns
TypeDescription
OperationFuture<UploadModelResponse,UploadModelOperationMetadata>

uploadModelAsync(UploadModelRequest request)

public final OperationFuture<UploadModelResponse,UploadModelOperationMetadata> uploadModelAsync(UploadModelRequest request)

Uploads a Model artifact into Vertex AI.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   UploadModelRequest request =
       UploadModelRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setModel(Model.newBuilder().build())
           .build();
   UploadModelResponse response = modelServiceClient.uploadModelAsync(request).get();
 }
 
Parameter
NameDescription
requestUploadModelRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<UploadModelResponse,UploadModelOperationMetadata>

uploadModelAsync(String parent, Model model)

public final OperationFuture<UploadModelResponse,UploadModelOperationMetadata> uploadModelAsync(String parent, Model model)

Uploads a Model artifact into Vertex AI.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   Model model = Model.newBuilder().build();
   UploadModelResponse response = modelServiceClient.uploadModelAsync(parent, model).get();
 }
 
Parameters
NameDescription
parentString

Required. The resource name of the Location into which to upload the Model. Format: projects/{project}/locations/{location}

modelModel

Required. The Model to create.

Returns
TypeDescription
OperationFuture<UploadModelResponse,UploadModelOperationMetadata>

uploadModelCallable()

public final UnaryCallable<UploadModelRequest,Operation> uploadModelCallable()

Uploads a Model artifact into Vertex AI.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   UploadModelRequest request =
       UploadModelRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setModel(Model.newBuilder().build())
           .build();
   ApiFuture
Returns
TypeDescription
UnaryCallable<UploadModelRequest,Operation>

uploadModelOperationCallable()

public final OperationCallable<UploadModelRequest,UploadModelResponse,UploadModelOperationMetadata> uploadModelOperationCallable()

Uploads a Model artifact into Vertex AI.

Sample code:


 try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
   UploadModelRequest request =
       UploadModelRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setModel(Model.newBuilder().build())
           .build();
   OperationFuture
Returns
TypeDescription
OperationCallable<UploadModelRequest,UploadModelResponse,UploadModelOperationMetadata>