Repository: googleapis/python-automl

Issue:
The `params` parameter is ignored in `batch_predict()` method
Passing a value to the `params` parameter in the `batch_predict()` method of `TablesClient` class does not have any effect.

For example, passing the value `params={'feature_importance':  'true'}` to `batch_predict()` is supposed to have feature importance generated along with the output, but there was none.


#### Environment details
  - OS type and version: Ubuntu 18.04.5 LTS
  - Python version: 3.5.2, 3.6.10, 3.7.2, 3.8.6
  - pip version: 20.2.4
  - `google-cloud-automl` version: 2.1.0

#### Steps to reproduce

  1.  Make a batch prediction with `params` (e.g. `params={'feature_importance':  'true'}`).
  2. Invoke the request.
  3. Notice that the generated output does not generate feature importance.

#### Code example

```python
from google.cloud import automl_v1beta1

client = automl_v1beta1.TablesClient(project='my-project', region='us-central1')

client.batch_predict(
    bigquery_input_uri='bq://my-project.dataset.table',
    bigquery_output_uri='bq://my-project',
    model_display_name='my_model',
    params={'feature_importance': 'true'}
)

```


Discussion:
munkhuushmgl: I will address the issue via #111 

https://source.cloud.google.com/results/invocations/8142cdb2-680b-4d32-b327-f3fffda9ed2c/targets/github%2Fpython-automl%2Fsamples%2Fsnippets/tests

Patch:
diff --git a/google/cloud/automl_v1beta1/services/tables/tables_client.py b/google/cloud/automl_v1beta1/services/tables/tables_client.py
index 21028a3..f6e7889 100644
--- a/google/cloud/automl_v1beta1/services/tables/tables_client.py
+++ b/google/cloud/automl_v1beta1/services/tables/tables_client.py
@@ -2999,7 +2999,10 @@ class TablesClient(object):
             )
 
         req = google.cloud.automl_v1beta1.BatchPredictRequest(
-            name=model_name, input_config=input_request, output_config=output_request,
+            name=model_name,
+            input_config=input_request,
+            output_config=output_request,
+            params=params,
         )
 
         method_kwargs = self.__process_request_kwargs(req, **kwargs)


Test patch:
diff --git a/tests/unit/test_tables_client_v1beta1.py b/tests/unit/test_tables_client_v1beta1.py
index 1d5b168..4df06d4 100644
--- a/tests/unit/test_tables_client_v1beta1.py
+++ b/tests/unit/test_tables_client_v1beta1.py
@@ -1599,6 +1599,24 @@ class TestTablesClient(object):
             )
         )
 
+    def test_batch_predict_bigquery_with_params(self):
+        client = self.tables_client({}, {})
+        client.batch_predict(
+            model_name="my_model",
+            bigquery_input_uri="bq://input",
+            bigquery_output_uri="bq://output",
+            params={"feature_importance": "true"},
+        )
+
+        client.prediction_client.batch_predict.assert_called_with(
+            request=automl_v1beta1.BatchPredictRequest(
+                name="my_model",
+                input_config={"bigquery_source": {"input_uri": "bq://input"}},
+                output_config={"bigquery_destination": {"output_uri": "bq://output"}},
+                params={"feature_importance": "true"},
+            )
+        )
+
     def test_batch_predict_mixed(self):
         client = self.tables_client({}, {})
         client.batch_predict(