google-gemini / google-gemini/computer-use-preview

Unable to use VERTEXAI

Open
#59 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
3.2k
Forks
405
PR merge metrics
No merged PRs in 30d

Description

Hi, nice launch!

TL;DR; I couldn't get it to work with Vertex AI. As per README I was exporting:
```
export USE_VERTEXAI=true
export VERTEXAI_PROJECT="YOUR_PROJECT_ID"
export VERTEXAI_LOCATION="YOUR_LOCATION"
```

I replaced the variables correctly with my project id and set the location to global.

1. If GEMINI_API_KEY is set alongside VERTEX variables it will throw an error that does not seem to be handled correctly:

```
File "/Users/redacted/Library/Caches/pypoetry/virtualenvs/computer-use-preview-8NSyF-7P-py3.13/lib/python3.13/site-packages/google/genai/client.py", line 311, in _get_api_client
return BaseApiClient(
vertexai=vertexai,
...<4 lines>...
http_options=http_options,
)
File "/Users/redacted/Library/Caches/pypoetry/virtualenvs/computer-use-preview-8NSyF-7P-py3.13/lib/python3.13/site-packages/google/genai/_api_client.py", line 559, in __init__
raise ValueError(
...<2 lines>...
)
ValueError: Project/location and API key are mutually exclusive in the client initializer.
Exception ignored in:
Traceback (most recent call last):
File "/Users/redacted/Library/Caches/pypoetry/virtualenvs/computer-use-preview-8NSyF-7P-py3.13/lib/python3.13/site-packages/google/genai/client.py", line 400, in __del__
self.close()
File "/Users/redacted/Library/Caches/pypoetry/virtualenvs/computer-use-preview-8NSyF-7P-py3.13/lib/python3.13/site-packages/google/genai/client.py", line 386, in close
self._api_client.close()
AttributeError: 'Client' object has no attribute '_api_client'
```

2. After unsetting GEMINI_API_KEY it failed with the following error:
```
poetry run python main.py --query="Go to Google and type 'Hello World' into the search bar" --env="playwright"
Creating session...
Started local playwright.
400 INVALID_ARGUMENT. {'error': {'code': 400, 'message': "The GenerateContentRequest proto is invalid:\n * tools[0].tool_type: required one_of 'tool_type'
must have one initialized field", 'status': 'INVALID_ARGUMENT'}}
Generating content failed on attempt 1. Retrying in 1 seconds...

400 INVALID_ARGUMENT. {'error': {'code': 400, 'message': "The GenerateContentRequest proto is invalid:\n * tools[0].tool_type: required one_of 'tool_type'
must have one initialized field", 'status': 'INVALID_ARGUMENT'}}
Generating content failed on attempt 2. Retrying in 2 seconds...

400 INVALID_ARGUMENT. {'error': {'code': 400, 'message': "The GenerateContentRequest proto is invalid:\n * tools[0].tool_type: required one_of 'tool_type'
must have one initialized field", 'status': 'INVALID_ARGUMENT'}}
Generating content failed on attempt 3. Retrying in 4 seconds...
```

I decided then to just use `GEMINI_API_KEY` after removing all `VERTEXAI_` env variables (via unset) which worked just fine.

Also it would be nice if we knew in which locations `gemini-2.5-computer-use-preview-10-2025` is available.

Best regards,
Caio

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.