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

Not able to specify Output Schema for Gemini Batch Prediction Job

I'm creating a Batch Prediction Job using Gemini Flash 002 model. I want to format the output in a specific json format.

I'm able to specify it in Standalone request as there is a parameter to define it. But when creating Batch Prediction, I don't have any idea where to specify it. The documentation page about input file format specifies format of input but not about format of output.

Please guide me on how to do output formatting for Batch prediction Job from Gemini. If possible show me a sample code in python to accomplish this. 

Thanks in Advance

0 1 195
1 REPLY 1

Hi @Tharun-PS,

Welcome to Google Cloud Community!

Make sure that you are using the supported model for batch prediction. 

For batch prediction output, you may refer to this link for guidance. 

You can also read the following documentation for more details:

  • Create a batch prediction job: This documentation explains how to create a batch prediction job in Vertex AI using different interfaces, including the API, and highlights the required parameters.
  • Vertex AI API Reference: You can browse the API reference to find the BatchPredictionJob.create method and all the parameters you need to correctly call the API from your workflow.

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.