From 443fa9d456294c4a6aa49368cc4b5e6f01ec3d0d Mon Sep 17 00:00:00 2001 From: A Vertex SDK engineer Date: Fri, 15 Dec 2023 10:41:08 -0800 Subject: [PATCH] fix: Missing request parameter for v1beta explain. PiperOrigin-RevId: 591298842 --- google/cloud/aiplatform/preview/models.py | 24 +++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/google/cloud/aiplatform/preview/models.py b/google/cloud/aiplatform/preview/models.py index 360e7f0931..a307c79047 100644 --- a/google/cloud/aiplatform/preview/models.py +++ b/google/cloud/aiplatform/preview/models.py @@ -1105,6 +1105,7 @@ def explain( """ self.wait() request = gca_prediction_service_compat.ExplainRequest() + request.endpoint = self.resource_name if instances is not None: request.instances.extend(instances) @@ -1199,14 +1200,21 @@ async def explain_async( """ self.wait() - request = gca_prediction_service_compat.ExplainRequest( - endpoint=self.resource_name, - instances=instances, - parameters=parameters, - deployed_model_id=deployed_model_id, - explanation_spec_override=explanation_spec_override, - concurrent_explanation_spec_override=concurrent_explanation_spec_override, - ) + request = gca_prediction_service_compat.ExplainRequest() + request.endpoint = self.resource_name + + if instances is not None: + request.instances.extend(instances) + if parameters is not None: + request.parameters = parameters + if deployed_model_id is not None: + request.deployed_model_id = deployed_model_id + if explanation_spec_override is not None: + request.explanation_spec_override = explanation_spec_override + if concurrent_explanation_spec_override is not None: + request.concurrent_explanation_spec_override = ( + concurrent_explanation_spec_override + ) explain_response = await self._prediction_async_client.select_version( "v1beta1"