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

Batch Text Generation with Google Cloud Storage (GCS) as input

What is the correct config for running a Gemini batch text generation job with GCS as input?

https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/batch-prediction-gemini#cloud-stora...
Request JSON body is invalid. 
'INPUT_SOURCE' is an incomplete k:v pair. 

{
    "displayName": "BP_JOB_NAME",
    "model": "publishers/google/models/gemini-1.0-pro-002",
    "inputConfig": {
      "instancesFormat":"INSTANCES_FORMAT",
      "inputSource":{ INPUT_SOURCE
        "inputUri" : "INPUT_URI"
      }
    },
    "outputConfig": {
      "predictionsFormat":"bigquery",
      "bigqueryDestination":{
        "outputUri": "OUTPUT_URI"
        }
    }
}

Error message:

{
  "error": {
    "code": 400,
    "message": "Invalid JSON payload received. Expected : between key:value pair.\ne\":{ gcsSource      \"inputUri\" : \"gs://j\n                    ^",
    "status": "INVALID_ARGUMENT"
  }
}
0 1 205
1 REPLY 1

Hi  judyapple ,

Welcome to Google Cloud Community!

The configuration provided in the documentation for running Gemini batch text generation jobs is  correct. However,  based on the error you provided it looks like it is due to an incomplete key-value pair INPUT_SOURCE

Here are key considerations that might help you resolve the error: 

  • Check Input_Source - Ensure that the inputSource includes a gcsSource object to specify the GCS input URI. 
  • Correct JSON Format - Ensure your JSON follows proper syntax.
  • Check for Typos - Make sure there are no typos or syntax errors (like missing commas or colons) in your JSON structure.

I hope the above information is helpful.