Skip to content

Set 'us-central1' by default on GoogleProvider #2031

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 27, 2025

Conversation

Kludex
Copy link
Member

@Kludex Kludex commented Jun 19, 2025

Copy link

github-actions bot commented Jun 19, 2025

Docs Preview

commit: 134df78
Preview URL: https://3a3966e5-pydantic-ai-previews.pydantic.workers.dev

Copy link

@dhimmel dhimmel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not tested, but this looks like it would solve the missing location caused by the swap from GeminiModel to GoogleModel

@@ -104,7 +104,7 @@ def __init__(
self._client = genai.Client(
vertexai=vertexai,
project=project or os.environ.get('GOOGLE_CLOUD_PROJECT'),
location=location or os.environ.get('GOOGLE_CLOUD_LOCATION'),
location=location or os.environ.get('GOOGLE_CLOUD_LOCATION') or 'us-central1',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
location=location or os.environ.get('GOOGLE_CLOUD_LOCATION') or 'us-central1',
location=location or os.environ.get('GOOGLE_CLOUD_LOCATION') or 'global',

I think that's better.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there's a perfect value according to the docs. Select quotes:

  • "Selecting a global endpoint for your requests can improve overall availability while reducing resource exhausted (429) errors"
  • Usage of the global endpoint is supported for the following Google models... [gemini 2.0 and 2.5]
  • For some models, Google also offers a global endpoint (Preview)

Currently us-central1 supports the most models by far of any region including global, but not all of them. us-central1 has all google models but is missing some Anthropic partner models, which use us-east5 instead. global has fewer models but higher availability.

Google is not making like easy!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If not all models support global, I guess we have to stick to us-central1 - @Kludex let's add a comment with @dhimmel's details.

@Kludex Kludex enabled auto-merge (squash) June 27, 2025 09:16
@Kludex Kludex merged commit 359554c into main Jun 27, 2025
16 checks passed
@Kludex Kludex deleted the set-us-central-1-by-default-on-google branch June 27, 2025 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

google-vertex provider now uses google-genai but fails due to no default location
3 participants