Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How do you add "parameters" to a batch prediction job's POST request JSON body?

How do you configure a BatchPredictionJob to include a "parameters" JSON object (i.e., a dict) in the JSON body of each POST request? I've configured a custom-container based Model to expect "parameters" in the body of a given request made to the prediction route as suggested in the custom container "Request requirements" (https://cloud.google.com/vertex-ai/docs/predictions/custom-container-requirements#request_requiremen...).

The "instances" are constructed successfully, but the model_parameters dict I pass to the BatchPredictionJob.create() class method (https://cloud.google.com/python/docs/reference/aiplatform/latest/google.cloud.aiplatform.BatchPredic...) does not result in the addition of a "parameters" (or any other) key-value pair in the resultant request bodies. Is there another way to supply these "parameters"?

Another user on Stack Overflow seemed to share my question, but the answer isn't conclusive: https://stackoverflow.com/questions/69936296/vertex-ai-custom-container-batch-prediction.

If I inspect my BatchPredictionJob instance via to_dict(), the 'modelParameters' dict looks good. Furthermore, the instance's gca_resource.model_parameters MapComposite and gca_resource.model_parameters.pb MessageMapContainer look like they're populated correctly, too.

I tried pointing to a parameters schema YAML file (and parameters_schema_uri successfully populated in the Model's predict_schemata), but that didn't help either.

4 REPLIES 4

I have the same issue

Same here - it would be very useful.

Any updates on this. ? 

The documentation casually mention of you can add it but no how details of how to get this ?

https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/batch-prediction-gemini

.setModel(modelName) // Add model parameters per request in the input jsonl file.

 

any updates? i have the same problem 😞