-
Notifications
You must be signed in to change notification settings - Fork 725
Open
Labels
priority: p3Desirable enhancement or fix. May not be included in next release.Desirable enhancement or fix. May not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.
Description
Is your feature request related to a problem? Please describe.
The Use Provisioned Throughput documentation page shows only the REST option as a viable approach for using Provisioned Throughput for a specific project, Google model, and region with an API Key.
Describe the solution you'd like
I'd like the SDK to support this use case, which is currently impossible because if both Project ID, Location and API Key are specified, the client raises a ValueError exception (see google/genai/_api_client.py#L559-L565)
# Validate explicitly set initializer values.
if (project or location) and api_key:
# API cannot consume both project/location and api_key.
raise ValueError(
'Project/location and API key are mutually exclusive in the client'
' initializer.'
)I personally did the changes necessary to make it work locally, that is:
- Avoiding raising
ValueErrorduring client initialization to cover this use case - Modify
_request_onceand_async_request_onceto NOT use Bearer token when API key is provided with project/location - Remove the API key from headers when it's used as a query parameter
- Append the API key as query parameter
I could work on a PR if needed.
Describe alternatives you've considered
- I'll for now directly use the REST API.
- Using ADC it's currently not a viable solution.
Additional context
None.
Metadata
Metadata
Assignees
Labels
priority: p3Desirable enhancement or fix. May not be included in next release.Desirable enhancement or fix. May not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.