Skip to content

Commit d0b2a24

Browse files
Aaweggmattf
andauthored
docs: fix Gemini provider auth docs to match mutually-exclusive behavior (#6341)
# What does this PR do? Fixes #5970. The Gemini provider documentation and the `GeminiConfig` class docstring described `access_token` as being "used instead of api_key" and stated that "when both are set, `access_token` takes precedence". This contradicts the actual behavior enforced by `GeminiConfig._validate_auth`, which: - raises a `ValueError` when **both** `api_key` and `access_token` are set (they are **mutually exclusive**), and - requires `project` to be set whenever `access_token` is used. This PR updates the `access_token` `Field` description and the `GeminiConfig` docstring so they accurately describe the validation behavior, and regenerates the provider docs via `scripts/provider_codegen.py`. ## Changes - `src/ogx/providers/remote/inference/gemini/config.py`: correct the class docstring and the `access_token` field description. - `docs/docs/providers/inference/remote_gemini.mdx`: regenerated to match. ## Test Plan - Docs-only / description-only change; no runtime behavior is modified. - Ran `./scripts/provider_codegen.py` (via the codegen group) and confirmed the regenerated `remote_gemini.mdx` matches the updated field description with no other diffs. Made with [Cursor](https://cursor.com) Signed-off-by: Aawegg <aawegbhaladhare03@gmail.com> Co-authored-by: Matthew Farrellee <matt@cs.wisc.edu>
1 parent 4a9b998 commit d0b2a24

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

docs/docs/providers/inference/remote_gemini.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Google Gemini inference provider for accessing Gemini models and Google's AI ser
3838
| `network.limits.max_connections` | `int \| None` | No | 100 | Maximum number of concurrent connections in the pool. None means no limit. Values must be >= 1 if set. |
3939
| `network.limits.max_keepalive_connections` | `int \| None` | No | 20 | Maximum number of idle keep-alive connections to retain. None means no limit. Values must be >= 0 if set. |
4040
| `network.limits.keepalive_expiry` | `float \| None` | No | 5.0 | Time in seconds to keep idle keep-alive connections open before closing them. None means no expiry. Values must be >= 0 if set. |
41-
| `access_token` | `SecretStr \| None` | No | | OAuth2 access token for Gemini. When set, used instead of api_key for Bearer authentication. |
41+
| `access_token` | `SecretStr \| None` | No | | OAuth2 access token for Gemini, used for Bearer authentication. Mutually exclusive with api_key—set one or the other, not both. Requires project to be set. |
4242
| `project` | `str \| None` | No | | Google Cloud project ID for quota attribution when using OAuth/ADC credentials. |
4343

4444
## Sample Configuration

src/ogx/providers/remote/inference/gemini/config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ class GeminiConfig(RemoteInferenceProviderConfig):
2828
Supports either a static API key (``api_key`` / ``GEMINI_API_KEY``) or an
2929
OAuth2 access token (``access_token`` / ``GEMINI_ACCESS_TOKEN``) for
3030
short-lived credential injection (e.g. ``gcloud auth application-default
31-
print-access-token``). When both are set, ``access_token`` takes precedence.
31+
print-access-token``). ``api_key`` and ``access_token`` are mutually
32+
exclusive—set one or the other, not both. When ``access_token`` is used,
33+
``project`` is also required.
3234
"""
3335

3436
access_token: SecretStr | None = Field(
3537
default=None,
36-
description="OAuth2 access token for Gemini. When set, used instead of api_key for Bearer authentication.",
38+
description="OAuth2 access token for Gemini, used for Bearer authentication. Mutually exclusive with api_key—set one or the other, not both. Requires project to be set.",
3739
)
3840
project: str | None = Field(
3941
default=None,

0 commit comments

Comments
 (0)