- 3.10.0 (latest)
- 3.9.0
- 3.8.0
- 3.7.0
- 3.6.0
- 3.5.0
- 3.4.0
- 3.3.0
- 3.2.0
- 3.1.0
- 3.0.0
- 2.28.0
- 2.27.0
- 2.26.0
- 2.25.0
- 2.24.0
- 2.23.0
- 2.22.0
- 2.21.0
- 2.20.0
- 2.19.0
- 2.18.0
- 2.17.0
- 2.16.0
- 2.15.0
- 2.14.0
- 2.13.0
- 2.12.0
- 2.11.0
- 2.10.0
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.0
- 2.5.0
- 2.4.0
- 2.3.0
- 2.2.0
- 2.1.0
- 2.0.0
- 1.8.0
- 1.7.0
- 1.6.0
- 1.5.0
- 1.4.0
- 1.3.0
- 1.2.0
- 1.1.0
- 1.0.0
public abstract class PredictionServiceClient
Reference documentation and code samples for the Cloud AI Platform v1 API class PredictionServiceClient.
PredictionService client wrapper, for convenient use.
Derived Types
Namespace
GoogleCloudGoogle.Cloud.AIPlatformV1Assembly
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 | |
---|---|
Type | Description |
string |
DefaultScopes
public static IReadOnlyList<string> DefaultScopes { get; }
The default PredictionService scopes.
Property Value | |
---|---|
Type | Description |
IReadOnlyListstring |
The default PredictionService scopes are:
GrpcClient
public virtual PredictionService.PredictionServiceClient GrpcClient { get; }
The underlying gRPC PredictionService client
Property Value | |
---|---|
Type | Description |
PredictionServicePredictionServiceClient |
IAMPolicyClient
public virtual IAMPolicyClient IAMPolicyClient { get; }
The IAMPolicyClient associated with this client.
Property Value | |
---|---|
Type | Description |
IAMPolicyClient |
LocationsClient
public virtual LocationsClient LocationsClient { get; }
The LocationsClient associated with this client.
Property Value | |
---|---|
Type | Description |
LocationsClient |
ServiceMetadata
public static ServiceMetadata ServiceMetadata { get; }
The service metadata associated with this client type.
Property Value | |
---|---|
Type | Description |
ServiceMetadata |
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 | |
---|---|
Type | Description |
PredictionServiceClient | The created PredictionServiceClient. |
CreateAsync(CancellationToken)
public static Task<PredictionServiceClient> CreateAsync(CancellationToken cancellationToken = default)
Asynchronously creates a PredictionServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use PredictionServiceClientBuilder.
Parameter | |
---|---|
Name | Description |
cancellationToken | CancellationToken The CancellationToken to use while creating the client. |
Returns | |
---|---|
Type | Description |
TaskPredictionServiceClient | 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 | |
---|---|
Name | Description |
endpoint | EndpointName Required. The name of the Endpoint requested to serve the explanation.
Format:
|
instances | IEnumerableValue 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]. |
parameters | Value 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]. |
deployedModelId | string If specified, this ExplainRequest will be served by the chosen DeployedModel, overriding [Endpoint.traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split]. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
ExplainResponse | The RPC response. |
// 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 | |
---|---|
Name | Description |
request | ExplainRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
ExplainResponse | The RPC response. |
// 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 | |
---|---|
Name | Description |
endpoint | string Required. The name of the Endpoint requested to serve the explanation.
Format:
|
instances | IEnumerableValue 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]. |
parameters | Value 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]. |
deployedModelId | string If specified, this ExplainRequest will be served by the chosen DeployedModel, overriding [Endpoint.traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split]. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
ExplainResponse | The RPC response. |
// 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 | |
---|---|
Name | Description |
endpoint | EndpointName Required. The name of the Endpoint requested to serve the explanation.
Format:
|
instances | IEnumerableValue 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]. |
parameters | Value 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]. |
deployedModelId | string If specified, this ExplainRequest will be served by the chosen DeployedModel, overriding [Endpoint.traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split]. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskExplainResponse | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
endpoint | EndpointName Required. The name of the Endpoint requested to serve the explanation.
Format:
|
instances | IEnumerableValue 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]. |
parameters | Value 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]. |
deployedModelId | string If specified, this ExplainRequest will be served by the chosen DeployedModel, overriding [Endpoint.traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split]. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskExplainResponse | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
request | ExplainRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskExplainResponse | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
request | ExplainRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskExplainResponse | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
endpoint | string Required. The name of the Endpoint requested to serve the explanation.
Format:
|
instances | IEnumerableValue 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]. |
parameters | Value 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]. |
deployedModelId | string If specified, this ExplainRequest will be served by the chosen DeployedModel, overriding [Endpoint.traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split]. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskExplainResponse | A Task containing the RPC response. |
// 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