diff --git a/automl/google/cloud/automl_v1beta1/tables/tables_client.py b/automl/google/cloud/automl_v1beta1/tables/tables_client.py index 7b960f0b7b12..3a65ecc8f235 100644 --- a/automl/google/cloud/automl_v1beta1/tables/tables_client.py +++ b/automl/google/cloud/automl_v1beta1/tables/tables_client.py @@ -2596,6 +2596,7 @@ def predict( model=None, model_name=None, model_display_name=None, + params=None, project=None, region=None, **kwargs @@ -2642,6 +2643,9 @@ def predict( The `model` instance you want to predict with . This must be supplied if `model_display_name` or `model_name` are not supplied. + params (dict[str, str]): + `feature_importance` can be set as True to enable local + explainability. The default is false. Returns: A :class:`~google.cloud.automl_v1beta1.types.PredictResponse` @@ -2683,7 +2687,7 @@ def predict( request = {"row": {"values": values}} - return self.prediction_client.predict(model.name, request, **kwargs) + return self.prediction_client.predict(model.name, request, params, **kwargs) def batch_predict( self, diff --git a/automl/tests/unit/gapic/v1beta1/test_tables_client_v1beta1.py b/automl/tests/unit/gapic/v1beta1/test_tables_client_v1beta1.py index 516a4b76080d..f164a8875787 100644 --- a/automl/tests/unit/gapic/v1beta1/test_tables_client_v1beta1.py +++ b/automl/tests/unit/gapic/v1beta1/test_tables_client_v1beta1.py @@ -1117,7 +1117,7 @@ def test_predict_from_array(self): client = self.tables_client({"get_model.return_value": model}, {}) client.predict(["1"], model_name="my_model") client.prediction_client.predict.assert_called_with( - "my_model", {"row": {"values": [{"string_value": "1"}]}} + "my_model", {"row": {"values": [{"string_value": "1"}]}}, None ) def test_predict_from_dict(self): @@ -1134,6 +1134,7 @@ def test_predict_from_dict(self): client.prediction_client.predict.assert_called_with( "my_model", {"row": {"values": [{"string_value": "1"}, {"string_value": "2"}]}}, + None, ) def test_predict_from_dict_missing(self): @@ -1148,7 +1149,9 @@ def test_predict_from_dict_missing(self): client = self.tables_client({"get_model.return_value": model}, {}) client.predict({"a": "1"}, model_name="my_model") client.prediction_client.predict.assert_called_with( - "my_model", {"row": {"values": [{"string_value": "1"}, {"null_value": 0}]}} + "my_model", + {"row": {"values": [{"string_value": "1"}, {"null_value": 0}]}}, + None, ) def test_predict_all_types(self): @@ -1210,6 +1213,7 @@ def test_predict_all_types(self): ] } }, + None, ) def test_predict_from_array_missing(self):