- 3.52.0 (latest)
- 3.50.0
- 3.49.0
- 3.48.0
- 3.47.0
- 3.46.0
- 3.45.0
- 3.44.0
- 3.43.0
- 3.42.0
- 3.41.0
- 3.40.0
- 3.38.0
- 3.37.0
- 3.36.0
- 3.35.0
- 3.34.0
- 3.33.0
- 3.32.0
- 3.31.0
- 3.30.0
- 3.29.0
- 3.28.0
- 3.25.0
- 3.24.0
- 3.23.0
- 3.22.0
- 3.21.0
- 3.20.0
- 3.19.0
- 3.18.0
- 3.17.0
- 3.16.0
- 3.15.0
- 3.14.0
- 3.13.0
- 3.12.0
- 3.11.0
- 3.10.0
- 3.9.0
- 3.8.0
- 3.7.0
- 3.6.0
- 3.5.0
- 3.4.2
- 3.3.0
- 3.2.0
- 3.0.0
- 2.9.8
- 2.8.9
- 2.7.4
- 2.5.3
- 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:
- 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.
- 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.
- 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.
Implements
BackgroundResourceStatic Methods
create()
public static final ModelServiceClient create()
Constructs an instance of ModelServiceClient with default settings.
Type | Description |
ModelServiceClient |
Type | Description |
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.
Name | Description |
settings | ModelServiceSettings |
Type | Description |
ModelServiceClient |
Type | Description |
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).
Name | Description |
stub | ModelServiceStub |
Type | Description |
ModelServiceClient |
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.
Name | Description |
settings | ModelServiceSettings |
ModelServiceClient(ModelServiceStub stub)
protected ModelServiceClient(ModelServiceStub stub)
Name | Description |
stub | ModelServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Name | Description |
duration | long |
unit | TimeUnit |
Type | Description |
boolean |
Type | Description |
InterruptedException |
close()
public final void close()
deleteModelAsync(DeleteModelRequest request)
public final OperationFuture<Empty,DeleteOperationMetadata> deleteModelAsync(DeleteModelRequest request)
Deletes a Model.
A model cannot be deleted if any Endpoint resource has a DeployedModel based on the model in its deployed_models field.
Sample code:
try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
DeleteModelRequest request =
DeleteModelRequest.newBuilder()
.setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
.build();
modelServiceClient.deleteModelAsync(request).get();
}
Name | Description |
request | DeleteModelRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Empty,DeleteOperationMetadata> |
deleteModelAsync(ModelName name)
public final OperationFuture<Empty,DeleteOperationMetadata> deleteModelAsync(ModelName name)
Deletes a Model.
A model cannot be deleted if any Endpoint resource has a DeployedModel based on the model in its deployed_models field.
Sample code:
try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
modelServiceClient.deleteModelAsync(name).get();
}
Name | Description |
name | ModelName Required. The name of the Model resource to be deleted. Format:
|
Type | Description |
OperationFuture<Empty,DeleteOperationMetadata> |
deleteModelAsync(String name)
public final OperationFuture<Empty,DeleteOperationMetadata> deleteModelAsync(String name)
Deletes a Model.
A model cannot be deleted if any Endpoint resource has a DeployedModel based on the model in its deployed_models field.
Sample code:
try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
modelServiceClient.deleteModelAsync(name).get();
}
Name | Description |
name | String Required. The name of the Model resource to be deleted. Format:
|
Type | Description |
OperationFuture<Empty,DeleteOperationMetadata> |
deleteModelCallable()
public final UnaryCallable<DeleteModelRequest,Operation> deleteModelCallable()
Deletes a Model.
A model cannot be deleted if any Endpoint resource has a DeployedModel based on the model in its deployed_models field.
Sample code:
try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
DeleteModelRequest request =
DeleteModelRequest.newBuilder()
.setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
.build();
ApiFuture<Operation> future = modelServiceClient.deleteModelCallable().futureCall(request);
// Do something.
future.get();
}
Type | Description |
UnaryCallable<DeleteModelRequest,Operation> |
deleteModelOperationCallable()
public final OperationCallable<DeleteModelRequest,Empty,DeleteOperationMetadata> deleteModelOperationCallable()
Deletes a Model.
A model cannot be deleted if any Endpoint resource has a DeployedModel based on the model in its deployed_models field.
Sample code:
try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
DeleteModelRequest request =
DeleteModelRequest.newBuilder()
.setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
.build();
OperationFuture<Empty, DeleteOperationMetadata> future =
modelServiceClient.deleteModelOperationCallable().futureCall(request);
// Do something.
future.get();
}
Type | Description |
OperationCallable<DeleteModelRequest,Empty,DeleteOperationMetadata> |
deleteModelVersionAsync(DeleteModelVersionRequest request)
public final OperationFuture<Empty,DeleteOperationMetadata> deleteModelVersionAsync(DeleteModelVersionRequest request)
Deletes a Model version.
Model version can only be deleted if there are no [DeployedModels][] created from it. Deleting the only version in the Model is not allowed. Use DeleteModel for deleting the Model instead.
Sample code:
try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
DeleteModelVersionRequest request =
DeleteModelVersionRequest.newBuilder()
.setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
.build();
modelServiceClient.deleteModelVersionAsync(request).get();
}
Name | Description |
request | DeleteModelVersionRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<Empty,DeleteOperationMetadata> |
deleteModelVersionAsync(ModelName name)
public final OperationFuture<Empty,DeleteOperationMetadata> deleteModelVersionAsync(ModelName name)
Deletes a Model version.
Model version can only be deleted if there are no [DeployedModels][] created from it. Deleting the only version in the Model is not allowed. Use DeleteModel for deleting the Model instead.
Sample code:
try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
modelServiceClient.deleteModelVersionAsync(name).get();
}
Name | Description |
name | ModelName Required. The name of the model version to be deleted, with a version ID explicitly included. Example: |
Type | Description |
OperationFuture<Empty,DeleteOperationMetadata> |
deleteModelVersionAsync(String name)
public final OperationFuture<Empty,DeleteOperationMetadata> deleteModelVersionAsync(String name)
Deletes a Model version.
Model version can only be deleted if there are no [DeployedModels][] created from it. Deleting the only version in the Model is not allowed. Use DeleteModel for deleting the Model instead.
Sample code:
try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
modelServiceClient.deleteModelVersionAsync(name).get();
}
Name | Description |
name | String Required. The name of the model version to be deleted, with a version ID explicitly included. Example: |
Type | Description |
OperationFuture<Empty,DeleteOperationMetadata> |
deleteModelVersionCallable()
public final UnaryCallable<DeleteModelVersionRequest,Operation> deleteModelVersionCallable()
Deletes a Model version.
Model version can only be deleted if there are no [DeployedModels][] created from it. Deleting the only version in the Model is not allowed. Use DeleteModel for deleting the Model instead.
Sample code:
try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
DeleteModelVersionRequest request =
DeleteModelVersionRequest.newBuilder()
.setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
.build();
ApiFuture<Operation> future =
modelServiceClient.deleteModelVersionCallable().futureCall(request);
// Do something.
future.get();
}
Type | Description |
UnaryCallable<DeleteModelVersionRequest,Operation> |
deleteModelVersionOperationCallable()
public final OperationCallable<DeleteModelVersionRequest,Empty,DeleteOperationMetadata> deleteModelVersionOperationCallable()
Deletes a Model version.
Model version can only be deleted if there are no [DeployedModels][] created from it. Deleting the only version in the Model is not allowed. Use DeleteModel for deleting the Model instead.
Sample code:
try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
DeleteModelVersionRequest request =
DeleteModelVersionRequest.newBuilder()
.setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
.build();
OperationFuture<Empty, DeleteOperationMetadata> future =
modelServiceClient.deleteModelVersionOperationCallable().futureCall(request);
// Do something.
future.get();
}
Type | Description |
OperationCallable<DeleteModelVersionRequest,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();
}
Name | Description |
request | ExportModelRequest The request object containing all of the parameters for the API call. |
Type | Description |
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();
}
Name | Description |
name | ModelName Required. The resource name of the Model to export. |
outputConfig | ExportModelRequest.OutputConfig Required. The desired output location and configuration. |
Type | Description |
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();
}
Name | Description |
name | String Required. The resource name of the Model to export. |
outputConfig | ExportModelRequest.OutputConfig Required. The desired output location and configuration. |
Type | Description |
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<Operation> future = modelServiceClient.exportModelCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
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<ExportModelResponse, ExportModelOperationMetadata> future =
modelServiceClient.exportModelOperationCallable().futureCall(request);
// Do something.
ExportModelResponse response = future.get();
}
Type | Description |
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);
}
Name | Description |
request | GetModelRequest The request object containing all of the parameters for the API call. |
Type | Description |
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);
}
Name | Description |
name | ModelName Required. The name of the Model resource. Format:
|
Type | Description |
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);
}
Name | Description |
name | String Required. The name of the Model resource. Format:
|
Type | Description |
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<Model> future = modelServiceClient.getModelCallable().futureCall(request);
// Do something.
Model response = future.get();
}
Type | Description |
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);
}
Name | Description |
request | GetModelEvaluationRequest The request object containing all of the parameters for the API call. |
Type | Description |
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);
}
Name | Description |
name | ModelEvaluationName Required. The name of the ModelEvaluation resource. Format:
|
Type | Description |
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);
}
Name | Description |
name | String Required. The name of the ModelEvaluation resource. Format:
|
Type | Description |
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<ModelEvaluation> future =
modelServiceClient.getModelEvaluationCallable().futureCall(request);
// Do something.
ModelEvaluation response = future.get();
}
Type | Description |
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);
}
Name | Description |
request | GetModelEvaluationSliceRequest The request object containing all of the parameters for the API call. |
Type | Description |
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);
}
Name | Description |
name | ModelEvaluationSliceName Required. The name of the ModelEvaluationSlice resource. Format:
|
Type | Description |
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);
}
Name | Description |
name | String Required. The name of the ModelEvaluationSlice resource. Format:
|
Type | Description |
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<ModelEvaluationSlice> future =
modelServiceClient.getModelEvaluationSliceCallable().futureCall(request);
// Do something.
ModelEvaluationSlice response = future.get();
}
Type | Description |
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.
Type | Description |
OperationsClient |
getSettings()
public final ModelServiceSettings getSettings()
Type | Description |
ModelServiceSettings |
getStub()
public ModelServiceStub getStub()
Type | Description |
ModelServiceStub |
importModelEvaluation(ImportModelEvaluationRequest request)
public final ModelEvaluation importModelEvaluation(ImportModelEvaluationRequest request)
Imports an externally generated ModelEvaluation.
Sample code:
try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
ImportModelEvaluationRequest request =
ImportModelEvaluationRequest.newBuilder()
.setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
.setModelEvaluation(ModelEvaluation.newBuilder().build())
.build();
ModelEvaluation response = modelServiceClient.importModelEvaluation(request);
}
Name | Description |
request | ImportModelEvaluationRequest The request object containing all of the parameters for the API call. |
Type | Description |
ModelEvaluation |
importModelEvaluation(ModelName parent, ModelEvaluation modelEvaluation)
public final ModelEvaluation importModelEvaluation(ModelName parent, ModelEvaluation modelEvaluation)
Imports an externally generated ModelEvaluation.
Sample code:
try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
ModelName parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
ModelEvaluation modelEvaluation = ModelEvaluation.newBuilder().build();
ModelEvaluation response = modelServiceClient.importModelEvaluation(parent, modelEvaluation);
}
Name | Description |
parent | ModelName Required. The name of the parent model resource. Format:
|
modelEvaluation | ModelEvaluation Required. Model evaluation resource to be imported. |
Type | Description |
ModelEvaluation |
importModelEvaluation(String parent, ModelEvaluation modelEvaluation)
public final ModelEvaluation importModelEvaluation(String parent, ModelEvaluation modelEvaluation)
Imports an externally generated ModelEvaluation.
Sample code:
try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
String parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
ModelEvaluation modelEvaluation = ModelEvaluation.newBuilder().build();
ModelEvaluation response = modelServiceClient.importModelEvaluation(parent, modelEvaluation);
}
Name | Description |
parent | String Required. The name of the parent model resource. Format:
|
modelEvaluation | ModelEvaluation Required. Model evaluation resource to be imported. |
Type | Description |
ModelEvaluation |
importModelEvaluationCallable()
public final UnaryCallable<ImportModelEvaluationRequest,ModelEvaluation> importModelEvaluationCallable()
Imports an externally generated ModelEvaluation.
Sample code:
try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
ImportModelEvaluationRequest request =
ImportModelEvaluationRequest.newBuilder()
.setParent(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
.setModelEvaluation(ModelEvaluation.newBuilder().build())
.build();
ApiFuture<ModelEvaluation> future =
modelServiceClient.importModelEvaluationCallable().futureCall(request);
// Do something.
ModelEvaluation response = future.get();
}
Type | Description |
UnaryCallable<ImportModelEvaluationRequest,ModelEvaluation> |
isShutdown()
public boolean isShutdown()
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Type | Description |
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);
}
}
Name | Description |
request | ListModelEvaluationSlicesRequest The request object containing all of the parameters for the API call. |
Type | Description |
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);
}
}
Name | Description |
parent | ModelEvaluationName Required. The resource name of the ModelEvaluation to list the
ModelEvaluationSlices from. Format:
|
Type | Description |
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);
}
}
Name | Description |
parent | String Required. The resource name of the ModelEvaluation to list the
ModelEvaluationSlices from. Format:
|
Type | Description |
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;
}
}
}
Type | Description |
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<ModelEvaluationSlice> future =
modelServiceClient.listModelEvaluationSlicesPagedCallable().futureCall(request);
// Do something.
for (ModelEvaluationSlice element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Type | Description |
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);
}
}
Name | Description |
request | ListModelEvaluationsRequest The request object containing all of the parameters for the API call. |
Type | Description |
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);
}
}
Name | Description |
parent | ModelName Required. The resource name of the Model to list the ModelEvaluations from.
Format: |
Type | Description |
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);
}
}
Name | Description |
parent | String Required. The resource name of the Model to list the ModelEvaluations from.
Format: |
Type | Description |
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;
}
}
}
Type | Description |
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<ModelEvaluation> future =
modelServiceClient.listModelEvaluationsPagedCallable().futureCall(request);
// Do something.
for (ModelEvaluation element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Type | Description |
UnaryCallable<ListModelEvaluationsRequest,ListModelEvaluationsPagedResponse> |
listModelVersions(ListModelVersionsRequest request)
public final ModelServiceClient.ListModelVersionsPagedResponse listModelVersions(ListModelVersionsRequest request)
Lists versions of the specified model.
Sample code:
try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
ListModelVersionsRequest request =
ListModelVersionsRequest.newBuilder()
.setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setReadMask(FieldMask.newBuilder().build())
.build();
for (Model element : modelServiceClient.listModelVersions(request).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
request | ListModelVersionsRequest The request object containing all of the parameters for the API call. |
Type | Description |
ModelServiceClient.ListModelVersionsPagedResponse |
listModelVersions(ModelName name)
public final ModelServiceClient.ListModelVersionsPagedResponse listModelVersions(ModelName name)
Lists versions of the specified model.
Sample code:
try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
for (Model element : modelServiceClient.listModelVersions(name).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
name | ModelName Required. The name of the model to list versions for. |
Type | Description |
ModelServiceClient.ListModelVersionsPagedResponse |
listModelVersions(String name)
public final ModelServiceClient.ListModelVersionsPagedResponse listModelVersions(String name)
Lists versions of the specified model.
Sample code:
try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
for (Model element : modelServiceClient.listModelVersions(name).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
name | String Required. The name of the model to list versions for. |
Type | Description |
ModelServiceClient.ListModelVersionsPagedResponse |
listModelVersionsCallable()
public final UnaryCallable<ListModelVersionsRequest,ListModelVersionsResponse> listModelVersionsCallable()
Lists versions of the specified model.
Sample code:
try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
ListModelVersionsRequest request =
ListModelVersionsRequest.newBuilder()
.setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setReadMask(FieldMask.newBuilder().build())
.build();
while (true) {
ListModelVersionsResponse response =
modelServiceClient.listModelVersionsCallable().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;
}
}
}
Type | Description |
UnaryCallable<ListModelVersionsRequest,ListModelVersionsResponse> |
listModelVersionsPagedCallable()
public final UnaryCallable<ListModelVersionsRequest,ModelServiceClient.ListModelVersionsPagedResponse> listModelVersionsPagedCallable()
Lists versions of the specified model.
Sample code:
try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
ListModelVersionsRequest request =
ListModelVersionsRequest.newBuilder()
.setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setReadMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Model> future =
modelServiceClient.listModelVersionsPagedCallable().futureCall(request);
// Do something.
for (Model element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Type | Description |
UnaryCallable<ListModelVersionsRequest,ListModelVersionsPagedResponse> |
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())
.build();
for (Model element : modelServiceClient.listModels(request).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
request | ListModelsRequest The request object containing all of the parameters for the API call. |
Type | Description |
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);
}
}
Name | Description |
parent | LocationName Required. The resource name of the Location to list the Models from. Format:
|
Type | Description |
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);
}
}
Name | Description |
parent | String Required. The resource name of the Location to list the Models from. Format:
|
Type | Description |
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())
.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;
}
}
}
Type | Description |
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())
.build();
ApiFuture<Model> future = modelServiceClient.listModelsPagedCallable().futureCall(request);
// Do something.
for (Model element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Type | Description |
UnaryCallable<ListModelsRequest,ListModelsPagedResponse> |
mergeVersionAliases(MergeVersionAliasesRequest request)
public final Model mergeVersionAliases(MergeVersionAliasesRequest request)
Merges a set of aliases for a Model version.
Sample code:
try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
MergeVersionAliasesRequest request =
MergeVersionAliasesRequest.newBuilder()
.setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
.addAllVersionAliases(new ArrayList<String>())
.build();
Model response = modelServiceClient.mergeVersionAliases(request);
}
Name | Description |
request | MergeVersionAliasesRequest The request object containing all of the parameters for the API call. |
Type | Description |
Model |
mergeVersionAliases(ModelName name, List<String> versionAliases)
public final Model mergeVersionAliases(ModelName name, List<String> versionAliases)
Merges a set of aliases for a Model version.
Sample code:
try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
List<String> versionAliases = new ArrayList<>();
Model response = modelServiceClient.mergeVersionAliases(name, versionAliases);
}
Name | Description |
name | ModelName Required. The name of the model version to merge aliases, with a version ID explicitly included. Example: |
versionAliases | List<String> Required. The set of version aliases to merge. The alias should be at
most 128 characters, and match There is NO ordering in aliases, which means 1) The aliases returned from GetModel API might not have the exactly same order from this MergeVersionAliases API. 2) Adding and deleting the same alias in the request is not recommended, and the 2 operations will be cancelled out. |
Type | Description |
Model |
mergeVersionAliases(String name, List<String> versionAliases)
public final Model mergeVersionAliases(String name, List<String> versionAliases)
Merges a set of aliases for a Model version.
Sample code:
try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
String name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
List<String> versionAliases = new ArrayList<>();
Model response = modelServiceClient.mergeVersionAliases(name, versionAliases);
}
Name | Description |
name | String Required. The name of the model version to merge aliases, with a version ID explicitly included. Example: |
versionAliases | List<String> Required. The set of version aliases to merge. The alias should be at
most 128 characters, and match There is NO ordering in aliases, which means 1) The aliases returned from GetModel API might not have the exactly same order from this MergeVersionAliases API. 2) Adding and deleting the same alias in the request is not recommended, and the 2 operations will be cancelled out. |
Type | Description |
Model |
mergeVersionAliasesCallable()
public final UnaryCallable<MergeVersionAliasesRequest,Model> mergeVersionAliasesCallable()
Merges a set of aliases for a Model version.
Sample code:
try (ModelServiceClient modelServiceClient = ModelServiceClient.create()) {
MergeVersionAliasesRequest request =
MergeVersionAliasesRequest.newBuilder()
.setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
.addAllVersionAliases(new ArrayList<String>())
.build();
ApiFuture<Model> future =
modelServiceClient.mergeVersionAliasesCallable().futureCall(request);
// Do something.
Model response = future.get();
}
Type | Description |
UnaryCallable<MergeVersionAliasesRequest,Model> |
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);
}
Name | Description |
model | Model Required. The Model which replaces the resource on the server. When Model Versioning is enabled, the model.name will be used to determine whether to update the model or model version. 1. model.name with the @ value, e.g. models/123@1, refers to a version specific update. 2. model.name without the @ value, e.g. models/123, refers to a model update. 3. model.name with @-, e.g. models/123@-, refers to a model update. 4. Supported model fields: display_name, description; supported version-specific fields: version_description. Labels are supported in both scenarios. Both the model labels and the version labels are merged when a model is returned. When updating labels, if the request is for model-specific update, model label gets updated. Otherwise, version labels get updated. 5. A model name or model version name fields update mismatch will cause a precondition error. 6. One request cannot update both the model and the version fields. You must update them separately. |
updateMask | FieldMask Required. The update mask applies to the resource. For the |
Type | Description |
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);
}
Name | Description |
request | UpdateModelRequest The request object containing all of the parameters for the API call. |
Type | Description |
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<Model> future = modelServiceClient.updateModelCallable().futureCall(request);
// Do something.
Model response = future.get();
}
Type | Description |
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();
}
Name | Description |
parent | LocationName Required. The resource name of the Location into which to upload the Model.
Format: |
model | Model Required. The Model to create. |
Type | Description |
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())
.setParentModel("parentModel998431903")
.setModelId("modelId1226956324")
.setModel(Model.newBuilder().build())
.build();
UploadModelResponse response = modelServiceClient.uploadModelAsync(request).get();
}
Name | Description |
request | UploadModelRequest The request object containing all of the parameters for the API call. |
Type | Description |
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();
}
Name | Description |
parent | String Required. The resource name of the Location into which to upload the Model.
Format: |
model | Model Required. The Model to create. |
Type | Description |
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())
.setParentModel("parentModel998431903")
.setModelId("modelId1226956324")
.setModel(Model.newBuilder().build())
.build();
ApiFuture<Operation> future = modelServiceClient.uploadModelCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
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())
.setParentModel("parentModel998431903")
.setModelId("modelId1226956324")
.setModel(Model.newBuilder().build())
.build();
OperationFuture<UploadModelResponse, UploadModelOperationMetadata> future =
modelServiceClient.uploadModelOperationCallable().futureCall(request);
// Do something.
UploadModelResponse response = future.get();
}
Type | Description |
OperationCallable<UploadModelRequest,UploadModelResponse,UploadModelOperationMetadata> |