This example no longer works because the Computer Use tool does not accept gemini-3.5-flash.
---------------------------------------------------------------------------
ClientError Traceback (most recent call last)
/tmp/ipykernel_277/3196089476.py in <cell line: 0>()
40
41 # Generate content with the configured settings
---> 42 response = client.models.generate_content(
43 model=MODEL_ID,
44 contents=contents,
13 frames/usr/local/lib/python3.12/dist-packages/google/genai/models.py in generate_content(self, model, contents, config)
6452 while remaining_remote_calls_afc > 0:
6453 i += 1
-> 6454 response = self._generate_content(
6455 model=model, contents=contents, config=parsed_config
6456 )
/usr/local/lib/python3.12/dist-packages/google/genai/models.py in _generate_content(self, model, contents, config)
4888 request_dict = _common.encode_unserializable_types(request_dict)
4889
-> 4890 response = self._api_client.request(
4891 'post', path, request_dict, http_options
4892 )
/usr/local/lib/python3.12/dist-packages/google/genai/_api_client.py in request(self, http_method, path, request_dict, http_options)
1609 http_method, path, request_dict, http_options
1610 )
-> 1611 response = self._request(http_request, http_options, stream=False)
1612 response_body = (
1613 response.response_stream[0] if response.response_stream else ''
/usr/local/lib/python3.12/dist-packages/google/genai/_api_client.py in _request(self, http_request, http_options, stream)
1402 return retry(self._request_once, http_request, stream) # type: ignore[no-any-return]
1403
-> 1404 return self._retry(self._request_once, http_request, stream) # type: ignore[no-any-return]
1405
1406 async def _async_request_once(
/usr/local/lib/python3.12/dist-packages/tenacity/__init__.py in __call__(self, fn, *args, **kwargs)
468 retry_state = RetryCallState(retry_object=self, fn=fn, args=args, kwargs=kwargs)
469 while True:
--> 470 do = self.iter(retry_state=retry_state)
471 if isinstance(do, DoAttempt):
472 try:
/usr/local/lib/python3.12/dist-packages/tenacity/__init__.py in iter(self, retry_state)
369 result = None
370 for action in self.iter_state.actions:
--> 371 result = action(retry_state)
372 return result
373
/usr/local/lib/python3.12/dist-packages/tenacity/__init__.py in exc_check(rs)
411 retry_exc = self.retry_error_cls(fut)
412 if self.reraise:
--> 413 raise retry_exc.reraise()
414 raise retry_exc from fut.exception()
415
/usr/local/lib/python3.12/dist-packages/tenacity/__init__.py in reraise(self)
182 def reraise(self) -> t.NoReturn:
183 if self.last_attempt.failed:
--> 184 raise self.last_attempt.result()
185 raise self
186
/usr/lib/python3.12/concurrent/futures/_base.py in result(self, timeout)
447 raise CancelledError()
448 elif self._state == FINISHED:
--> 449 return self.__get_result()
450
451 self._condition.wait(timeout)
/usr/lib/python3.12/concurrent/futures/_base.py in __get_result(self)
399 if self._exception:
400 try:
--> 401 raise self._exception
402 finally:
403 # Break a reference cycle with the exception in self._exception
/usr/local/lib/python3.12/dist-packages/tenacity/__init__.py in __call__(self, fn, *args, **kwargs)
471 if isinstance(do, DoAttempt):
472 try:
--> 473 result = fn(*args, **kwargs)
474 except BaseException: # noqa: B902
475 retry_state.set_exception(sys.exc_info()) # type: ignore[arg-type]
/usr/local/lib/python3.12/dist-packages/google/genai/_api_client.py in _request_once(self, http_request, stream)
1379 )
1380 response = self._httpx_client.send(httpx_request, stream=stream) # type: ignore[union-attr]
-> 1381 errors.APIError.raise_for_response(response)
1382 return HttpResponse(
1383 response.headers, response if stream else [response.text]
/usr/local/lib/python3.12/dist-packages/google/genai/errors.py in raise_for_response(cls, response)
153 response_json = response.body_segments[0].get('error', {})
154
--> 155 cls.raise_error(response.status_code, response_json, response)
156
157 @classmethod
/usr/local/lib/python3.12/dist-packages/google/genai/errors.py in raise_error(cls, status_code, response_json, response)
182 """
183 if 400 <= status_code < 500:
--> 184 raise ClientError(status_code, response_json, response)
185 elif 500 <= status_code < 600:
186 raise ServerError(status_code, response_json, response)
ClientError: 400 INVALID_ARGUMENT. {'error': {'code': 400, 'message': 'Unable to submit request because computer use is not supported for this model. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini', 'status': 'INVALID_ARGUMENT'}}
File Name
gemini/computer-use/intro_computer_use.ipynb
What happened?
This example no longer works because the Computer Use tool does not accept gemini-3.5-flash.
Relevant log output
Code of Conduct