|
|
Gemini Batch Processing API
Author: Venkata Sudhakar
The Gemini Batch API lets you submit thousands of prompts as a single job and collect results asynchronously. Batch jobs run at 50% lower cost than synchronous requests and are ideal for nightly data processing, bulk content generation, and large-scale classification tasks. ShopMax India uses batch processing to generate product descriptions for thousands of new listings overnight. You create a batch by uploading a JSONL input file where each line is one request. The API returns a job ID. You poll for completion and then download the output JSONL file containing all responses. The job can take from minutes to hours depending on size. The below example shows how ShopMax India generates product descriptions in batch for 5,000 new electronics items overnight.
Submitting the batch job and polling for completion,
It gives the following output,
Batch job submitted: batches/shopmax-desc-job-001
Status: JOB_STATE_RUNNING
Status: JOB_STATE_SUCCEEDED
PROD001: Upgrade your connectivity with the Samsung Galaxy A55. Featuring a stunning 6.6-inch
PROD002: Experience wireless audio freedom with the Boat Airdopes 141. Enjoy 42 hours of
PROD003: Boost your productivity with the Logitech MX Keys Mini. The compact wireless
For ShopMax India night-batch workflows, schedule the job at 11 PM using Cloud Scheduler. A Cloud Function uploads the JSONL file, submits the batch, and a second function triggered by Cloud Scheduler at 6 AM downloads results and writes descriptions to the product database before the team starts their day.
|
|