Hello, Gemini Community
I am trying to use the google_search tool (or grounding) in batch mode, but am running into errors. Here’s my code which I copied from the documentation.
inline_requests_list = [
{‘contents’: [{‘parts’: [{‘text’: ‘Who won the euro 1998?’}]}]},
{‘contents’: [{‘parts’: [{‘text’: ‘Who won the euro 2025?’}]}], ‘tools’: [{‘google_search’: {}}]}
]
2. Create the batch job with the inline requests.
print(“Creating inline batch job…”)
inline_batch_job = client.batches.create(
model=“gemini-2.5-pro”,
src=inline_requests_list,
config={
‘display_name’: “inlined-requests-job-1”,
},
)
I recieve the following error :
--------------------------------------------------------------------------- Va in Batches.create(self, model, src, config) 5240 raise ValueError( 5241 ‘inlined_requests is not supported in Vertex AI. Please use’ 5242 ’ Google Cloud Storage URI or BigQuery URI instead.’ 5243 ) 5245 config = _extra_utils.format_destination(src, config) → 5246 return self._create(model=model, src=src, config=config) File …
in Batches._create(self, model, src, config) 4863 def _create( 4864 self, 4865 *, (…) 4868 config: Optional[types.CreateBatchJobConfigOrDict] = None, 4869 ) → types.BatchJob: → 4870 parameter_model = types._CreateBatchJobParameters( 4871 model=model, 4872 src=src, 4873 config=config, 4874 ) 4876 request_url_dict: Optional[dict[str, str]] 4878 if self._api_client.vertexai: File …
ValidationError: 3 validation errors for _CreateBatchJobParameters src.BatchJobSource Input should be a valid dictionary or object to extract fields from [type=model_attributes_type, input_value=[{‘contents’: [{‘parts’: …{‘google_search’: {}}]}], input_type=list] For further information visit “Modified by moderator” src.list[InlinedRequest].1.tools Extra inputs are not permitted [type=extra_forbidden, input_value=[{‘google_search’: {}}], input_type=list] For further information visit “Modified by moderator” src.str Input should be a valid string [type=string_type, input_value=[{‘contents’: [{‘parts’: …{‘google_search’: {}}]}], input_type=list] For further information visit
Also when I try to use the batch mode to receive a file as input, I receive an internal error (code: 13)
Does anyone know how to fix this or what I am doing wrong?