google / google/generative-ai-go
How to set a region
- Dominant language
- Go
- Stars
- 857
- Forks
- 104
- PR merge metrics
- No merged PRs in 30d
Description
### Description of the feature request:
I am using the API for an OCR usecase. This is working fine, but all the requests are ending up in region `us-south1`. I see a previous issue (#79) but it was closed without providing an actual answer.
Our use-case will send a lot of requests when fully deployed, so I want the requests to be spread to multiple regions to avoid hitting the per-region quotas.
I see the endpoint being set in the code:
```go
func defaultGenerativeRESTClientOptions() []option.ClientOption {
return []option.ClientOption{
internaloption.WithDefaultEndpoint("https://generativelanguage.googleapis.com"),
internaloption.WithDefaultEndpointTemplate("https://generativelanguage.UNIVERSE_DOMAIN"),
internaloption.WithDefaultMTLSEndpoint("https://generativelanguage.mtls.googleapis.com"),
internaloption.WithDefaultUniverseDomain("googleapis.com"),
internaloption.WithDefaultAudience("https://generativelanguage.googleapis.com/"),
internaloption.WithDefaultScopes(DefaultAuthScopes()...),
}
}
```
However, I still have no idea how to specify a regional endpoint or why the current requests are all ending in `us-south1`. It doesn't seem possible based on these endpoints, but I want to confirm.
### What problem are you trying to solve with this feature?
Send requests to a specific region to spread traffic across multiple ones and avoid quotas.
Contributor guide
Research direction
Start by reviewing defaultGenerativeRESTClientOptions and the endpoint configuration shown in the issue, then compare it with issue #79 and the API's regional endpoint behavior. Determine whether a regional endpoint can be configured and document or implement the supported approach so requests can target specific regions and the result is verifiable against quota distribution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, cloud
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100