Method: endpoints.explain Stay organized with collections Save and categorize content based on your preferences.
Full name: projects.locations.endpoints.explain
Perform an online explanation.
IfdeployedModelId is specified, the corresponding endpoints.deployModel must haveexplanationSpec populated. IfdeployedModelId is not specified, all DeployedModels must haveexplanationSpec populated.
Endpoint
posthttps://{service-endpoint}/v1/{endpoint}:explain Where{service-endpoint} is one of thesupported service endpoints.
Path parameters
endpointstringRequired. The name of the Endpoint requested to serve the explanation. Format:projects/{project}/locations/{location}/endpoints/{endpoint}
Request body
The request body contains data with the following structure:
instances[]value (Value format)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'sPredictSchemata'sinstanceSchemaUri.
parametersvalue (Value format)The parameters that govern the prediction. The schema of the parameters may be specified via Endpoint's DeployedModels'Model'sPredictSchemata'sparametersSchemaUri.
explanationSpecOverrideobject (ExplanationSpecOverride)If specified, overrides theexplanationSpec of the DeployedModel. Can be used for explaining prediction results with different configurations, such as: - Explaining top-5 predictions results as opposed to top-1; - Increasing path count or step count of the attribution methods to reduce approximate errors; - Using different baselines for explaining the prediction results.
deployedModelIdstringIf specified, this ExplainRequest will be served by the chosen DeployedModel, overridingEndpoint.traffic_split.
Response body
Response message forPredictionService.Explain.
If successful, the response body contains data with the following structure:
explanations[]object (Explanation)The explanations of the Model'sPredictResponse.predictions.
It has the same number of elements asinstances to be explained.
deployedModelIdstringid of the Endpoint's DeployedModel that served this explanation.
predictions[]value (Value format)The predictions that are the output of the predictions call. Same asPredictResponse.predictions.
| JSON representation |
|---|
{"explanations":[{object ( |
ExplanationSpecOverride
TheExplanationSpec entries that can be overridden atonline explanation time.
parametersobject (ExplanationParameters)The parameters to be overridden. Note that the attribution method cannot be changed. If not specified, no parameter is overridden.
metadataobject (ExplanationMetadataOverride)The metadata to be overridden. If not specified, no metadata is overridden.
examplesOverrideobject (ExamplesOverride)The example-based explanations parameter overrides.
| JSON representation |
|---|
{"parameters":{object ( |
ExplanationMetadataOverride
TheExplanationMetadata entries that can be overridden atonline explanation time.
inputsmap (key: string, value: object (InputMetadataOverride))Required. Overrides theinput metadata of the features. The key is the name of the feature to be overridden. The keys specified here must exist in the input metadata to be overridden. If a feature is not specified here, the corresponding feature's input metadata is not overridden.
| JSON representation |
|---|
{"inputs":{string:{object ( |
InputMetadataOverride
Theinput metadata entries to be overridden.
inputBaselines[]value (Value format)baseline inputs for this feature.
This overrides theinput_baseline field of theExplanationMetadata.InputMetadata object of the corresponding feature's input metadata. If it's not specified, the original baselines are not overridden.
| JSON representation |
|---|
{"inputBaselines":[value]} |
ExamplesOverride
Overrides for example-based explanations.
neighborCountintegerThe number of neighbors to return.
crowdingCountintegerThe number of neighbors to return that have the same crowding tag.
restrictions[]object (ExamplesRestrictionsNamespace)Restrict the resulting nearest neighbors to respect these constraints.
returnEmbeddingsbooleanIf true, return the embeddings instead of neighbors.
dataFormatenum (DataFormat)The format of the data being provided with each call.
| JSON representation |
|---|
{"neighborCount":integer,"crowdingCount":integer,"restrictions":[{object ( |
ExamplesRestrictionsNamespace
Restrictions namespace for example-based explanations overrides.
namespaceNamestringThe namespace name.
allow[]stringThe list of allowed tags.
deny[]stringThe list of deny tags.
| JSON representation |
|---|
{"namespaceName":string,"allow":[string],"deny":[string]} |
DataFormat
data format enum.
| Enums | |
|---|---|
DATA_FORMAT_UNSPECIFIED | Unspecified format. Must not be used. |
INSTANCES | Provided data is a set of model inputs. |
EMBEDDINGS | Provided data is a set of embeddings. |
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-06-27 UTC.