I’m trying to perform batch prediction on a large dataset using Vertex AI’s Gemini model in Python. The official documentation primarily uses curl for examples, which imo is not suitable for production environments. I’m looking for a Pythonic way to achieve this.
I’ve explored the following resources:
https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/batch-prediction-api
https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/batch-prediction-gemini#bigquery-input-example
However, the provided examples does not uses python but rather curl commands.
I’m seeking guidance on:
Best practices for batch prediction with Gemini in Python.
Code examples or tutorials that demonstrate the process effectively.
Any insights or code snippets would be greatly appreciated.
I tried the aproach described in the documentation but it is not suitable for my python production environment use case.
!curl -X POST
-H “Authorization: Bearer $(gcloud auth print-access-token)”
-H “Content-Type: application/json; charset=utf-8”
-d @request.json
“https://us-central1-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/batchPredictionJobs”
Emilio Ortega is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.