GoogleCloudPlatform / GoogleCloudPlatform/generative-ai
[Bug]: Some Gemini models are not supported on single-region endpoints, can improve by separating Gemini region with other resources' region
- Dominant language
- Jupyter Notebook
- Stars
- 17.7k
- Forks
- 4.5k
- Avg merge
- 12h 38m
- Merged PRs (30d)
- 42
Description
### File Name
https://github.com/GoogleCloudPlatform/generative-ai/blob/main/gemini/sample-apps/gemini-streamlit-cloudrun/app.py
### What happened?
Followed what is in Google Skills training Develop GenAI Apps with Gemini and Streamlit module named Utilize the Streamlit Framework with Cloud Run and the Gemini API in Agent Platform, where they suggested loading Gemini 3.1 Flast Lite, Gemini 3.5 Flash, and Gemini 2.5 Pro as models to utilize in the lab.
Running the streamlit app, Gemini 2.5 Pro was the only model working. Both Gemini 3.1 Flast Lite and Gemini 3.5 Flash are both getting Error 404 s:
google.genai.errors.ClientError: 404 NOT_FOUND. {'error' : {'code':404, 'message': 'Publisher model `projects/qwiklabs-gcp-03.../locations/us-west1/publishers/google/models/gemini-3.1-flash-lite` was not found or your project does not have access to it...'}
Determined root cause was due to some Gemini models not being supported on single-region endpoints such as "us-west1". Switching to multi-region like "us" solves this issue. Locally applied fix was to change location= "us" in the following line to make it work.
https://github.com/GoogleCloudPlatform/generative-ai/blob/d4b21163c285a26891e280c3c095250463133a0c/gemini/sample-apps/gemini-streamlit-cloudrun/app.py#L77
More general fix would be to differentiate LOCATION variable for the LLMs vs LOCATION variable for the other resources. This way the app would support multi-region-only LLMs and still not affect the deployment of other resources. Note that in an alternate scenario, a full location switch was done with LOCATION="global" but it failed due to another error being raised.
### Relevant log output
```shell
google.genai.errors.ClientError: 404 NOT_FOUND. {'error' : {'code':404, 'message': 'Publisher model `projects/qwiklabs-gcp-03.../locations/us-west1/publishers/google/models/gemini-3.1-flash-lite` was not found or your project does not have access to it...'}
```
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
Assessment
This issue has not been assessed yet.