Class PredictionServiceClient (1.1.0)

public abstract class PredictionServiceClient

PredictionService client wrapper, for convenient use.

Inheritance

Object > PredictionServiceClient

Namespace

Google.Cloud.AIPlatform.V1

Assembly

Google.Cloud.AIPlatform.V1.dll

Remarks

A service for online predictions and explanations.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the PredictionService service, which is a host of "aiplatform.googleapis.com" and a port of 443.

Property Value
TypeDescription
String

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default PredictionService scopes.

Property Value
TypeDescription
IReadOnlyList<String>
Remarks

The default PredictionService scopes are:

GrpcClient

public virtual PredictionService.PredictionServiceClient GrpcClient { get; }

The underlying gRPC PredictionService client

Property Value
TypeDescription
PredictionService.PredictionServiceClient

Methods

Create()

public static PredictionServiceClient Create()

Synchronously creates a PredictionServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use PredictionServiceClientBuilder.

Returns
TypeDescription
PredictionServiceClient

The created PredictionServiceClient.

CreateAsync(CancellationToken)

public static Task<PredictionServiceClient> CreateAsync(CancellationToken cancellationToken = default(CancellationToken))

Asynchronously creates a PredictionServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use PredictionServiceClientBuilder.

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
Task<PredictionServiceClient>

The task representing the created PredictionServiceClient.

Explain(EndpointName, IEnumerable<Value>, Value, String, CallSettings)

public virtual ExplainResponse Explain(EndpointName endpoint, IEnumerable<Value> instances, Value parameters, string deployedModelId, CallSettings callSettings = null)

Perform an online explanation.

If [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id] is specified, the corresponding DeployModel must have [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec] populated. If [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id] is not specified, all DeployedModels must have [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec] populated. Only deployed AutoML tabular Models have explanation_spec.

Parameters
NameDescription
endpointEndpointName

Required. The name of the Endpoint requested to serve the explanation. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

instancesIEnumerable<Value>

Required. The instances that are the input to the explanation call. A DeployedModel may have an upper limit on the number of instances it supports per request, and when it is exceeded the explanation call errors in case of AutoML Models, or, in case of customer created Models, the behaviour is as documented by that Model. The schema of any single instance may be specified via Endpoint's DeployedModels' [Model's][google.cloud.aiplatform.v1.DeployedModel.model] [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] [instance_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.instance_schema_uri].

parametersValue

The parameters that govern the prediction. The schema of the parameters may be specified via Endpoint's DeployedModels' [Model's ][google.cloud.aiplatform.v1.DeployedModel.model] [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] [parameters_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.parameters_schema_uri].

deployedModelIdString

If specified, this ExplainRequest will be served by the chosen DeployedModel, overriding [Endpoint.traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split].

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
ExplainResponse

The RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = PredictionServiceClient.Create();
// Initialize request argument(s)
EndpointName endpoint = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]");
IEnumerable<Value> instances = new Value[] { new Value(), };
Value parameters = new Value();
string deployedModelId = "";
// Make the request
ExplainResponse response = predictionServiceClient.Explain(endpoint, instances, parameters, deployedModelId);

Explain(ExplainRequest, CallSettings)

public virtual ExplainResponse Explain(ExplainRequest request, CallSettings callSettings = null)

Perform an online explanation.

If [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id] is specified, the corresponding DeployModel must have [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec] populated. If [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id] is not specified, all DeployedModels must have [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec] populated. Only deployed AutoML tabular Models have explanation_spec.

Parameters
NameDescription
requestExplainRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
ExplainResponse

The RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = PredictionServiceClient.Create();
// Initialize request argument(s)
ExplainRequest request = new ExplainRequest
{
    EndpointAsEndpointName = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]"),
    Instances = { new Value(), },
    DeployedModelId = "",
    Parameters = new Value(),
    ExplanationSpecOverride = new ExplanationSpecOverride(),
};
// Make the request
ExplainResponse response = predictionServiceClient.Explain(request);

Explain(String, IEnumerable<Value>, Value, String, CallSettings)

public virtual ExplainResponse Explain(string endpoint, IEnumerable<Value> instances, Value parameters, string deployedModelId, CallSettings callSettings = null)

Perform an online explanation.

If [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id] is specified, the corresponding DeployModel must have [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec] populated. If [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id] is not specified, all DeployedModels must have [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec] populated. Only deployed AutoML tabular Models have explanation_spec.

Parameters
NameDescription
endpointString

Required. The name of the Endpoint requested to serve the explanation. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

instancesIEnumerable<Value>

Required. The instances that are the input to the explanation call. A DeployedModel may have an upper limit on the number of instances it supports per request, and when it is exceeded the explanation call errors in case of AutoML Models, or, in case of customer created Models, the behaviour is as documented by that Model. The schema of any single instance may be specified via Endpoint's DeployedModels' [Model's][google.cloud.aiplatform.v1.DeployedModel.model] [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] [instance_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.instance_schema_uri].

parametersValue

The parameters that govern the prediction. The schema of the parameters may be specified via Endpoint's DeployedModels' [Model's ][google.cloud.aiplatform.v1.DeployedModel.model] [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] [parameters_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.parameters_schema_uri].

deployedModelIdString

If specified, this ExplainRequest will be served by the chosen DeployedModel, overriding [Endpoint.traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split].

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
ExplainResponse

The RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = PredictionServiceClient.Create();
// Initialize request argument(s)
string endpoint = "projects/[PROJECT]/locations/[LOCATION]/endpoints/[ENDPOINT]";
IEnumerable<Value> instances = new Value[] { new Value(), };
Value parameters = new Value();
string deployedModelId = "";
// Make the request
ExplainResponse response = predictionServiceClient.Explain(endpoint, instances, parameters, deployedModelId);

ExplainAsync(EndpointName, IEnumerable<Value>, Value, String, CallSettings)

public virtual Task<ExplainResponse> ExplainAsync(EndpointName endpoint, IEnumerable<Value> instances, Value parameters, string deployedModelId, CallSettings callSettings = null)

Perform an online explanation.

If [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id] is specified, the corresponding DeployModel must have [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec] populated. If [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id] is not specified, all DeployedModels must have [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec] populated. Only deployed AutoML tabular Models have explanation_spec.

Parameters
NameDescription
endpointEndpointName

Required. The name of the Endpoint requested to serve the explanation. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

instancesIEnumerable<Value>

Required. The instances that are the input to the explanation call. A DeployedModel may have an upper limit on the number of instances it supports per request, and when it is exceeded the explanation call errors in case of AutoML Models, or, in case of customer created Models, the behaviour is as documented by that Model. The schema of any single instance may be specified via Endpoint's DeployedModels' [Model's][google.cloud.aiplatform.v1.DeployedModel.model] [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] [instance_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.instance_schema_uri].

parametersValue

The parameters that govern the prediction. The schema of the parameters may be specified via Endpoint's DeployedModels' [Model's ][google.cloud.aiplatform.v1.DeployedModel.model] [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] [parameters_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.parameters_schema_uri].

deployedModelIdString

If specified, this ExplainRequest will be served by the chosen DeployedModel, overriding [Endpoint.traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split].

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<ExplainResponse>

A Task containing the RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = await PredictionServiceClient.CreateAsync();
// Initialize request argument(s)
EndpointName endpoint = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]");
IEnumerable<Value> instances = new Value[] { new Value(), };
Value parameters = new Value();
string deployedModelId = "";
// Make the request
ExplainResponse response = await predictionServiceClient.ExplainAsync(endpoint, instances, parameters, deployedModelId);

ExplainAsync(EndpointName, IEnumerable<Value>, Value, String, CancellationToken)

public virtual Task<ExplainResponse> ExplainAsync(EndpointName endpoint, IEnumerable<Value> instances, Value parameters, string deployedModelId, CancellationToken cancellationToken)

Perform an online explanation.

If [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id] is specified, the corresponding DeployModel must have [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec] populated. If [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id] is not specified, all DeployedModels must have [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec] populated. Only deployed AutoML tabular Models have explanation_spec.

Parameters
NameDescription
endpointEndpointName

Required. The name of the Endpoint requested to serve the explanation. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

instancesIEnumerable<Value>

Required. The instances that are the input to the explanation call. A DeployedModel may have an upper limit on the number of instances it supports per request, and when it is exceeded the explanation call errors in case of AutoML Models, or, in case of customer created Models, the behaviour is as documented by that Model. The schema of any single instance may be specified via Endpoint's DeployedModels' [Model's][google.cloud.aiplatform.v1.DeployedModel.model] [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] [instance_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.instance_schema_uri].

parametersValue

The parameters that govern the prediction. The schema of the parameters may be specified via Endpoint's DeployedModels' [Model's ][google.cloud.aiplatform.v1.DeployedModel.model] [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] [parameters_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.parameters_schema_uri].

deployedModelIdString

If specified, this ExplainRequest will be served by the chosen DeployedModel, overriding [Endpoint.traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split].

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<ExplainResponse>

A Task containing the RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = await PredictionServiceClient.CreateAsync();
// Initialize request argument(s)
EndpointName endpoint = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]");
IEnumerable<Value> instances = new Value[] { new Value(), };
Value parameters = new Value();
string deployedModelId = "";
// Make the request
ExplainResponse response = await predictionServiceClient.ExplainAsync(endpoint, instances, parameters, deployedModelId);

ExplainAsync(ExplainRequest, CallSettings)

public virtual Task<ExplainResponse> ExplainAsync(ExplainRequest request, CallSettings callSettings = null)

Perform an online explanation.

If [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id] is specified, the corresponding DeployModel must have [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec] populated. If [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id] is not specified, all DeployedModels must have [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec] populated. Only deployed AutoML tabular Models have explanation_spec.

Parameters
NameDescription
requestExplainRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<ExplainResponse>

A Task containing the RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = await PredictionServiceClient.CreateAsync();
// Initialize request argument(s)
ExplainRequest request = new ExplainRequest
{
    EndpointAsEndpointName = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]"),
    Instances = { new Value(), },
    DeployedModelId = "",
    Parameters = new Value(),
    ExplanationSpecOverride = new ExplanationSpecOverride(),
};
// Make the request
ExplainResponse response = await predictionServiceClient.ExplainAsync(request);

ExplainAsync(ExplainRequest, CancellationToken)

public virtual Task<ExplainResponse> ExplainAsync(ExplainRequest request, CancellationToken cancellationToken)

Perform an online explanation.

If [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id] is specified, the corresponding DeployModel must have [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec] populated. If [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id] is not specified, all DeployedModels must have [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec] populated. Only deployed AutoML tabular Models have explanation_spec.

Parameters
NameDescription
requestExplainRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<ExplainResponse>

A Task containing the RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = await PredictionServiceClient.CreateAsync();
// Initialize request argument(s)
ExplainRequest request = new ExplainRequest
{
    EndpointAsEndpointName = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]"),
    Instances = { new Value(), },
    DeployedModelId = "",
    Parameters = new Value(),
    ExplanationSpecOverride = new ExplanationSpecOverride(),
};
// Make the request
ExplainResponse response = await predictionServiceClient.ExplainAsync(request);

ExplainAsync(String, IEnumerable<Value>, Value, String, CallSettings)

public virtual Task<ExplainResponse> ExplainAsync(string endpoint, IEnumerable<Value> instances, Value parameters, string deployedModelId, CallSettings callSettings = null)

Perform an online explanation.

If [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id] is specified, the corresponding DeployModel must have [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec] populated. If [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id] is not specified, all DeployedModels must have [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec] populated. Only deployed AutoML tabular Models have explanation_spec.

Parameters
NameDescription
endpointString

Required. The name of the Endpoint requested to serve the explanation. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

instancesIEnumerable<Value>

Required. The instances that are the input to the explanation call. A DeployedModel may have an upper limit on the number of instances it supports per request, and when it is exceeded the explanation call errors in case of AutoML Models, or, in case of customer created Models, the behaviour is as documented by that Model. The schema of any single instance may be specified via Endpoint's DeployedModels' [Model's][google.cloud.aiplatform.v1.DeployedModel.model] [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] [instance_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.instance_schema_uri].

parametersValue

The parameters that govern the prediction. The schema of the parameters may be specified via Endpoint's DeployedModels' [Model's ][google.cloud.aiplatform.v1.DeployedModel.model] [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] [parameters_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.parameters_schema_uri].

deployedModelIdString

If specified, this ExplainRequest will be served by the chosen DeployedModel, overriding [Endpoint.traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split].

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<ExplainResponse>

A Task containing the RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = await PredictionServiceClient.CreateAsync();
// Initialize request argument(s)
string endpoint = "projects/[PROJECT]/locations/[LOCATION]/endpoints/[ENDPOINT]";
IEnumerable<Value> instances = new Value[] { new Value(), };
Value parameters = new Value();
string deployedModelId = "";
// Make the request
ExplainResponse response = await predictionServiceClient.ExplainAsync(endpoint, instances, parameters, deployedModelId);

ExplainAsync(String, IEnumerable<Value>, Value, String, CancellationToken)

public virtual Task<ExplainResponse> ExplainAsync(string endpoint, IEnumerable<Value> instances, Value parameters, string deployedModelId, CancellationToken cancellationToken)

Perform an online explanation.

If [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id] is specified, the corresponding DeployModel must have [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec] populated. If [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id] is not specified, all DeployedModels must have [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec] populated. Only deployed AutoML tabular Models have explanation_spec.

Parameters
NameDescription
endpointString

Required. The name of the Endpoint requested to serve the explanation. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

instancesIEnumerable<Value>

Required. The instances that are the input to the explanation call. A DeployedModel may have an upper limit on the number of instances it supports per request, and when it is exceeded the explanation call errors in case of AutoML Models, or, in case of customer created Models, the behaviour is as documented by that Model. The schema of any single instance may be specified via Endpoint's DeployedModels' [Model's][google.cloud.aiplatform.v1.DeployedModel.model] [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] [instance_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.instance_schema_uri].

parametersValue

The parameters that govern the prediction. The schema of the parameters may be specified via Endpoint's DeployedModels' [Model's ][google.cloud.aiplatform.v1.DeployedModel.model] [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] [parameters_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.parameters_schema_uri].

deployedModelIdString

If specified, this ExplainRequest will be served by the chosen DeployedModel, overriding [Endpoint.traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split].

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<ExplainResponse>

A Task containing the RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = await PredictionServiceClient.CreateAsync();
// Initialize request argument(s)
string endpoint = "projects/[PROJECT]/locations/[LOCATION]/endpoints/[ENDPOINT]";
IEnumerable<Value> instances = new Value[] { new Value(), };
Value parameters = new Value();
string deployedModelId = "";
// Make the request
ExplainResponse response = await predictionServiceClient.ExplainAsync(endpoint, instances, parameters, deployedModelId);

Predict(EndpointName, IEnumerable<Value>, Value, CallSettings)

public virtual PredictResponse Predict(EndpointName endpoint, IEnumerable<Value> instances, Value parameters, CallSettings callSettings = null)

Perform an online prediction.

Parameters
NameDescription
endpointEndpointName

Required. The name of the Endpoint requested to serve the prediction. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

instancesIEnumerable<Value>

Required. The instances that are the input to the prediction call. A DeployedModel may have an upper limit on the number of instances it supports per request, and when it is exceeded the prediction call errors in case of AutoML Models, or, in case of customer created Models, the behaviour is as documented by that Model. The schema of any single instance may be specified via Endpoint's DeployedModels' [Model's][google.cloud.aiplatform.v1.DeployedModel.model] [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] [instance_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.instance_schema_uri].

parametersValue

The parameters that govern the prediction. The schema of the parameters may be specified via Endpoint's DeployedModels' [Model's ][google.cloud.aiplatform.v1.DeployedModel.model] [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] [parameters_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.parameters_schema_uri].

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PredictResponse

The RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = PredictionServiceClient.Create();
// Initialize request argument(s)
EndpointName endpoint = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]");
IEnumerable<Value> instances = new Value[] { new Value(), };
Value parameters = new Value();
// Make the request
PredictResponse response = predictionServiceClient.Predict(endpoint, instances, parameters);

Predict(PredictRequest, CallSettings)

public virtual PredictResponse Predict(PredictRequest request, CallSettings callSettings = null)

Perform an online prediction.

Parameters
NameDescription
requestPredictRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PredictResponse

The RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = PredictionServiceClient.Create();
// Initialize request argument(s)
PredictRequest request = new PredictRequest
{
    EndpointAsEndpointName = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]"),
    Instances = { new Value(), },
    Parameters = new Value(),
};
// Make the request
PredictResponse response = predictionServiceClient.Predict(request);

Predict(String, IEnumerable<Value>, Value, CallSettings)

public virtual PredictResponse Predict(string endpoint, IEnumerable<Value> instances, Value parameters, CallSettings callSettings = null)

Perform an online prediction.

Parameters
NameDescription
endpointString

Required. The name of the Endpoint requested to serve the prediction. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

instancesIEnumerable<Value>

Required. The instances that are the input to the prediction call. A DeployedModel may have an upper limit on the number of instances it supports per request, and when it is exceeded the prediction call errors in case of AutoML Models, or, in case of customer created Models, the behaviour is as documented by that Model. The schema of any single instance may be specified via Endpoint's DeployedModels' [Model's][google.cloud.aiplatform.v1.DeployedModel.model] [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] [instance_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.instance_schema_uri].

parametersValue

The parameters that govern the prediction. The schema of the parameters may be specified via Endpoint's DeployedModels' [Model's ][google.cloud.aiplatform.v1.DeployedModel.model] [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] [parameters_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.parameters_schema_uri].

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PredictResponse

The RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = PredictionServiceClient.Create();
// Initialize request argument(s)
string endpoint = "projects/[PROJECT]/locations/[LOCATION]/endpoints/[ENDPOINT]";
IEnumerable<Value> instances = new Value[] { new Value(), };
Value parameters = new Value();
// Make the request
PredictResponse response = predictionServiceClient.Predict(endpoint, instances, parameters);

PredictAsync(EndpointName, IEnumerable<Value>, Value, CallSettings)

public virtual Task<PredictResponse> PredictAsync(EndpointName endpoint, IEnumerable<Value> instances, Value parameters, CallSettings callSettings = null)

Perform an online prediction.

Parameters
NameDescription
endpointEndpointName

Required. The name of the Endpoint requested to serve the prediction. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

instancesIEnumerable<Value>

Required. The instances that are the input to the prediction call. A DeployedModel may have an upper limit on the number of instances it supports per request, and when it is exceeded the prediction call errors in case of AutoML Models, or, in case of customer created Models, the behaviour is as documented by that Model. The schema of any single instance may be specified via Endpoint's DeployedModels' [Model's][google.cloud.aiplatform.v1.DeployedModel.model] [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] [instance_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.instance_schema_uri].

parametersValue

The parameters that govern the prediction. The schema of the parameters may be specified via Endpoint's DeployedModels' [Model's ][google.cloud.aiplatform.v1.DeployedModel.model] [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] [parameters_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.parameters_schema_uri].

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<PredictResponse>

A Task containing the RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = await PredictionServiceClient.CreateAsync();
// Initialize request argument(s)
EndpointName endpoint = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]");
IEnumerable<Value> instances = new Value[] { new Value(), };
Value parameters = new Value();
// Make the request
PredictResponse response = await predictionServiceClient.PredictAsync(endpoint, instances, parameters);

PredictAsync(EndpointName, IEnumerable<Value>, Value, CancellationToken)

public virtual Task<PredictResponse> PredictAsync(EndpointName endpoint, IEnumerable<Value> instances, Value parameters, CancellationToken cancellationToken)

Perform an online prediction.

Parameters
NameDescription
endpointEndpointName

Required. The name of the Endpoint requested to serve the prediction. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

instancesIEnumerable<Value>

Required. The instances that are the input to the prediction call. A DeployedModel may have an upper limit on the number of instances it supports per request, and when it is exceeded the prediction call errors in case of AutoML Models, or, in case of customer created Models, the behaviour is as documented by that Model. The schema of any single instance may be specified via Endpoint's DeployedModels' [Model's][google.cloud.aiplatform.v1.DeployedModel.model] [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] [instance_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.instance_schema_uri].

parametersValue

The parameters that govern the prediction. The schema of the parameters may be specified via Endpoint's DeployedModels' [Model's ][google.cloud.aiplatform.v1.DeployedModel.model] [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] [parameters_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.parameters_schema_uri].

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<PredictResponse>

A Task containing the RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = await PredictionServiceClient.CreateAsync();
// Initialize request argument(s)
EndpointName endpoint = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]");
IEnumerable<Value> instances = new Value[] { new Value(), };
Value parameters = new Value();
// Make the request
PredictResponse response = await predictionServiceClient.PredictAsync(endpoint, instances, parameters);

PredictAsync(PredictRequest, CallSettings)

public virtual Task<PredictResponse> PredictAsync(PredictRequest request, CallSettings callSettings = null)

Perform an online prediction.

Parameters
NameDescription
requestPredictRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<PredictResponse>

A Task containing the RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = await PredictionServiceClient.CreateAsync();
// Initialize request argument(s)
PredictRequest request = new PredictRequest
{
    EndpointAsEndpointName = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]"),
    Instances = { new Value(), },
    Parameters = new Value(),
};
// Make the request
PredictResponse response = await predictionServiceClient.PredictAsync(request);

PredictAsync(PredictRequest, CancellationToken)

public virtual Task<PredictResponse> PredictAsync(PredictRequest request, CancellationToken cancellationToken)

Perform an online prediction.

Parameters
NameDescription
requestPredictRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<PredictResponse>

A Task containing the RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = await PredictionServiceClient.CreateAsync();
// Initialize request argument(s)
PredictRequest request = new PredictRequest
{
    EndpointAsEndpointName = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]"),
    Instances = { new Value(), },
    Parameters = new Value(),
};
// Make the request
PredictResponse response = await predictionServiceClient.PredictAsync(request);

PredictAsync(String, IEnumerable<Value>, Value, CallSettings)

public virtual Task<PredictResponse> PredictAsync(string endpoint, IEnumerable<Value> instances, Value parameters, CallSettings callSettings = null)

Perform an online prediction.

Parameters
NameDescription
endpointString

Required. The name of the Endpoint requested to serve the prediction. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

instancesIEnumerable<Value>

Required. The instances that are the input to the prediction call. A DeployedModel may have an upper limit on the number of instances it supports per request, and when it is exceeded the prediction call errors in case of AutoML Models, or, in case of customer created Models, the behaviour is as documented by that Model. The schema of any single instance may be specified via Endpoint's DeployedModels' [Model's][google.cloud.aiplatform.v1.DeployedModel.model] [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] [instance_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.instance_schema_uri].

parametersValue

The parameters that govern the prediction. The schema of the parameters may be specified via Endpoint's DeployedModels' [Model's ][google.cloud.aiplatform.v1.DeployedModel.model] [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] [parameters_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.parameters_schema_uri].

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<PredictResponse>

A Task containing the RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = await PredictionServiceClient.CreateAsync();
// Initialize request argument(s)
string endpoint = "projects/[PROJECT]/locations/[LOCATION]/endpoints/[ENDPOINT]";
IEnumerable<Value> instances = new Value[] { new Value(), };
Value parameters = new Value();
// Make the request
PredictResponse response = await predictionServiceClient.PredictAsync(endpoint, instances, parameters);

PredictAsync(String, IEnumerable<Value>, Value, CancellationToken)

public virtual Task<PredictResponse> PredictAsync(string endpoint, IEnumerable<Value> instances, Value parameters, CancellationToken cancellationToken)

Perform an online prediction.

Parameters
NameDescription
endpointString

Required. The name of the Endpoint requested to serve the prediction. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

instancesIEnumerable<Value>

Required. The instances that are the input to the prediction call. A DeployedModel may have an upper limit on the number of instances it supports per request, and when it is exceeded the prediction call errors in case of AutoML Models, or, in case of customer created Models, the behaviour is as documented by that Model. The schema of any single instance may be specified via Endpoint's DeployedModels' [Model's][google.cloud.aiplatform.v1.DeployedModel.model] [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] [instance_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.instance_schema_uri].

parametersValue

The parameters that govern the prediction. The schema of the parameters may be specified via Endpoint's DeployedModels' [Model's ][google.cloud.aiplatform.v1.DeployedModel.model] [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata] [parameters_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.parameters_schema_uri].

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<PredictResponse>

A Task containing the RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = await PredictionServiceClient.CreateAsync();
// Initialize request argument(s)
string endpoint = "projects/[PROJECT]/locations/[LOCATION]/endpoints/[ENDPOINT]";
IEnumerable<Value> instances = new Value[] { new Value(), };
Value parameters = new Value();
// Make the request
PredictResponse response = await predictionServiceClient.PredictAsync(endpoint, instances, parameters);

RawPredict(EndpointName, HttpBody, CallSettings)

public virtual HttpBody RawPredict(EndpointName endpoint, HttpBody httpBody, CallSettings callSettings = null)

Perform an online prediction with an arbitrary HTTP payload.

The response includes the following HTTP headers:

  • X-Vertex-AI-Endpoint-Id: ID of the [Endpoint][google.cloud.aiplatform.v1.Endpoint] that served this prediction.

  • X-Vertex-AI-Deployed-Model-Id: ID of the Endpoint's [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] that served this prediction.

Parameters
NameDescription
endpointEndpointName

Required. The name of the Endpoint requested to serve the prediction. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

httpBodyHttpBody

The prediction input. Supports HTTP headers and arbitrary data payload.

A [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] may have an upper limit on the number of instances it supports per request. When this limit it is exceeded for an AutoML model, the [RawPredict][google.cloud.aiplatform.v1.PredictionService.RawPredict] method returns an error. When this limit is exceeded for a custom-trained model, the behavior varies depending on the model.

You can specify the schema for each instance in the [predict_schemata.instance_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.instance_schema_uri] field when you create a [Model][google.cloud.aiplatform.v1.Model]. This schema applies when you deploy the Model as a DeployedModel to an [Endpoint][google.cloud.aiplatform.v1.Endpoint] and use the RawPredict method.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
HttpBody

The RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = PredictionServiceClient.Create();
// Initialize request argument(s)
EndpointName endpoint = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]");
HttpBody httpBody = new HttpBody();
// Make the request
HttpBody response = predictionServiceClient.RawPredict(endpoint, httpBody);

RawPredict(RawPredictRequest, CallSettings)

public virtual HttpBody RawPredict(RawPredictRequest request, CallSettings callSettings = null)

Perform an online prediction with an arbitrary HTTP payload.

The response includes the following HTTP headers:

  • X-Vertex-AI-Endpoint-Id: ID of the [Endpoint][google.cloud.aiplatform.v1.Endpoint] that served this prediction.

  • X-Vertex-AI-Deployed-Model-Id: ID of the Endpoint's [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] that served this prediction.

Parameters
NameDescription
requestRawPredictRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
HttpBody

The RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = PredictionServiceClient.Create();
// Initialize request argument(s)
RawPredictRequest request = new RawPredictRequest
{
    EndpointAsEndpointName = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]"),
    HttpBody = new HttpBody(),
};
// Make the request
HttpBody response = predictionServiceClient.RawPredict(request);

RawPredict(String, HttpBody, CallSettings)

public virtual HttpBody RawPredict(string endpoint, HttpBody httpBody, CallSettings callSettings = null)

Perform an online prediction with an arbitrary HTTP payload.

The response includes the following HTTP headers:

  • X-Vertex-AI-Endpoint-Id: ID of the [Endpoint][google.cloud.aiplatform.v1.Endpoint] that served this prediction.

  • X-Vertex-AI-Deployed-Model-Id: ID of the Endpoint's [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] that served this prediction.

Parameters
NameDescription
endpointString

Required. The name of the Endpoint requested to serve the prediction. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

httpBodyHttpBody

The prediction input. Supports HTTP headers and arbitrary data payload.

A [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] may have an upper limit on the number of instances it supports per request. When this limit it is exceeded for an AutoML model, the [RawPredict][google.cloud.aiplatform.v1.PredictionService.RawPredict] method returns an error. When this limit is exceeded for a custom-trained model, the behavior varies depending on the model.

You can specify the schema for each instance in the [predict_schemata.instance_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.instance_schema_uri] field when you create a [Model][google.cloud.aiplatform.v1.Model]. This schema applies when you deploy the Model as a DeployedModel to an [Endpoint][google.cloud.aiplatform.v1.Endpoint] and use the RawPredict method.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
HttpBody

The RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = PredictionServiceClient.Create();
// Initialize request argument(s)
string endpoint = "projects/[PROJECT]/locations/[LOCATION]/endpoints/[ENDPOINT]";
HttpBody httpBody = new HttpBody();
// Make the request
HttpBody response = predictionServiceClient.RawPredict(endpoint, httpBody);

RawPredictAsync(EndpointName, HttpBody, CallSettings)

public virtual Task<HttpBody> RawPredictAsync(EndpointName endpoint, HttpBody httpBody, CallSettings callSettings = null)

Perform an online prediction with an arbitrary HTTP payload.

The response includes the following HTTP headers:

  • X-Vertex-AI-Endpoint-Id: ID of the [Endpoint][google.cloud.aiplatform.v1.Endpoint] that served this prediction.

  • X-Vertex-AI-Deployed-Model-Id: ID of the Endpoint's [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] that served this prediction.

Parameters
NameDescription
endpointEndpointName

Required. The name of the Endpoint requested to serve the prediction. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

httpBodyHttpBody

The prediction input. Supports HTTP headers and arbitrary data payload.

A [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] may have an upper limit on the number of instances it supports per request. When this limit it is exceeded for an AutoML model, the [RawPredict][google.cloud.aiplatform.v1.PredictionService.RawPredict] method returns an error. When this limit is exceeded for a custom-trained model, the behavior varies depending on the model.

You can specify the schema for each instance in the [predict_schemata.instance_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.instance_schema_uri] field when you create a [Model][google.cloud.aiplatform.v1.Model]. This schema applies when you deploy the Model as a DeployedModel to an [Endpoint][google.cloud.aiplatform.v1.Endpoint] and use the RawPredict method.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<HttpBody>

A Task containing the RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = await PredictionServiceClient.CreateAsync();
// Initialize request argument(s)
EndpointName endpoint = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]");
HttpBody httpBody = new HttpBody();
// Make the request
HttpBody response = await predictionServiceClient.RawPredictAsync(endpoint, httpBody);

RawPredictAsync(EndpointName, HttpBody, CancellationToken)

public virtual Task<HttpBody> RawPredictAsync(EndpointName endpoint, HttpBody httpBody, CancellationToken cancellationToken)

Perform an online prediction with an arbitrary HTTP payload.

The response includes the following HTTP headers:

  • X-Vertex-AI-Endpoint-Id: ID of the [Endpoint][google.cloud.aiplatform.v1.Endpoint] that served this prediction.

  • X-Vertex-AI-Deployed-Model-Id: ID of the Endpoint's [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] that served this prediction.

Parameters
NameDescription
endpointEndpointName

Required. The name of the Endpoint requested to serve the prediction. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

httpBodyHttpBody

The prediction input. Supports HTTP headers and arbitrary data payload.

A [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] may have an upper limit on the number of instances it supports per request. When this limit it is exceeded for an AutoML model, the [RawPredict][google.cloud.aiplatform.v1.PredictionService.RawPredict] method returns an error. When this limit is exceeded for a custom-trained model, the behavior varies depending on the model.

You can specify the schema for each instance in the [predict_schemata.instance_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.instance_schema_uri] field when you create a [Model][google.cloud.aiplatform.v1.Model]. This schema applies when you deploy the Model as a DeployedModel to an [Endpoint][google.cloud.aiplatform.v1.Endpoint] and use the RawPredict method.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<HttpBody>

A Task containing the RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = await PredictionServiceClient.CreateAsync();
// Initialize request argument(s)
EndpointName endpoint = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]");
HttpBody httpBody = new HttpBody();
// Make the request
HttpBody response = await predictionServiceClient.RawPredictAsync(endpoint, httpBody);

RawPredictAsync(RawPredictRequest, CallSettings)

public virtual Task<HttpBody> RawPredictAsync(RawPredictRequest request, CallSettings callSettings = null)

Perform an online prediction with an arbitrary HTTP payload.

The response includes the following HTTP headers:

  • X-Vertex-AI-Endpoint-Id: ID of the [Endpoint][google.cloud.aiplatform.v1.Endpoint] that served this prediction.

  • X-Vertex-AI-Deployed-Model-Id: ID of the Endpoint's [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] that served this prediction.

Parameters
NameDescription
requestRawPredictRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<HttpBody>

A Task containing the RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = await PredictionServiceClient.CreateAsync();
// Initialize request argument(s)
RawPredictRequest request = new RawPredictRequest
{
    EndpointAsEndpointName = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]"),
    HttpBody = new HttpBody(),
};
// Make the request
HttpBody response = await predictionServiceClient.RawPredictAsync(request);

RawPredictAsync(RawPredictRequest, CancellationToken)

public virtual Task<HttpBody> RawPredictAsync(RawPredictRequest request, CancellationToken cancellationToken)

Perform an online prediction with an arbitrary HTTP payload.

The response includes the following HTTP headers:

  • X-Vertex-AI-Endpoint-Id: ID of the [Endpoint][google.cloud.aiplatform.v1.Endpoint] that served this prediction.

  • X-Vertex-AI-Deployed-Model-Id: ID of the Endpoint's [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] that served this prediction.

Parameters
NameDescription
requestRawPredictRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<HttpBody>

A Task containing the RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = await PredictionServiceClient.CreateAsync();
// Initialize request argument(s)
RawPredictRequest request = new RawPredictRequest
{
    EndpointAsEndpointName = EndpointName.FromProjectLocationEndpoint("[PROJECT]", "[LOCATION]", "[ENDPOINT]"),
    HttpBody = new HttpBody(),
};
// Make the request
HttpBody response = await predictionServiceClient.RawPredictAsync(request);

RawPredictAsync(String, HttpBody, CallSettings)

public virtual Task<HttpBody> RawPredictAsync(string endpoint, HttpBody httpBody, CallSettings callSettings = null)

Perform an online prediction with an arbitrary HTTP payload.

The response includes the following HTTP headers:

  • X-Vertex-AI-Endpoint-Id: ID of the [Endpoint][google.cloud.aiplatform.v1.Endpoint] that served this prediction.

  • X-Vertex-AI-Deployed-Model-Id: ID of the Endpoint's [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] that served this prediction.

Parameters
NameDescription
endpointString

Required. The name of the Endpoint requested to serve the prediction. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

httpBodyHttpBody

The prediction input. Supports HTTP headers and arbitrary data payload.

A [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] may have an upper limit on the number of instances it supports per request. When this limit it is exceeded for an AutoML model, the [RawPredict][google.cloud.aiplatform.v1.PredictionService.RawPredict] method returns an error. When this limit is exceeded for a custom-trained model, the behavior varies depending on the model.

You can specify the schema for each instance in the [predict_schemata.instance_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.instance_schema_uri] field when you create a [Model][google.cloud.aiplatform.v1.Model]. This schema applies when you deploy the Model as a DeployedModel to an [Endpoint][google.cloud.aiplatform.v1.Endpoint] and use the RawPredict method.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<HttpBody>

A Task containing the RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = await PredictionServiceClient.CreateAsync();
// Initialize request argument(s)
string endpoint = "projects/[PROJECT]/locations/[LOCATION]/endpoints/[ENDPOINT]";
HttpBody httpBody = new HttpBody();
// Make the request
HttpBody response = await predictionServiceClient.RawPredictAsync(endpoint, httpBody);

RawPredictAsync(String, HttpBody, CancellationToken)

public virtual Task<HttpBody> RawPredictAsync(string endpoint, HttpBody httpBody, CancellationToken cancellationToken)

Perform an online prediction with an arbitrary HTTP payload.

The response includes the following HTTP headers:

  • X-Vertex-AI-Endpoint-Id: ID of the [Endpoint][google.cloud.aiplatform.v1.Endpoint] that served this prediction.

  • X-Vertex-AI-Deployed-Model-Id: ID of the Endpoint's [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] that served this prediction.

Parameters
NameDescription
endpointString

Required. The name of the Endpoint requested to serve the prediction. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

httpBodyHttpBody

The prediction input. Supports HTTP headers and arbitrary data payload.

A [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] may have an upper limit on the number of instances it supports per request. When this limit it is exceeded for an AutoML model, the [RawPredict][google.cloud.aiplatform.v1.PredictionService.RawPredict] method returns an error. When this limit is exceeded for a custom-trained model, the behavior varies depending on the model.

You can specify the schema for each instance in the [predict_schemata.instance_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.instance_schema_uri] field when you create a [Model][google.cloud.aiplatform.v1.Model]. This schema applies when you deploy the Model as a DeployedModel to an [Endpoint][google.cloud.aiplatform.v1.Endpoint] and use the RawPredict method.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<HttpBody>

A Task containing the RPC response.

Example
// Create client
PredictionServiceClient predictionServiceClient = await PredictionServiceClient.CreateAsync();
// Initialize request argument(s)
string endpoint = "projects/[PROJECT]/locations/[LOCATION]/endpoints/[ENDPOINT]";
HttpBody httpBody = new HttpBody();
// Make the request
HttpBody response = await predictionServiceClient.RawPredictAsync(endpoint, httpBody);

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
TypeDescription
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.