Skip to content

Commit b0ee607

Browse files
committed
docs: fix Gemini provider auth docs to match mutually-exclusive behavior
The Gemini config docs and class docstring stated that access_token is "used instead of api_key" and that "when both are set, access_token takes precedence". This contradicts _validate_auth, which raises a ValueError when both api_key and access_token are set (they are mutually exclusive) and also requires project when access_token is used. Update the access_token Field description and the GeminiConfig docstring to describe the actual validation behavior, and regenerate the provider docs. Closes #5970 Signed-off-by: Aawegg <aawegbhaladhare03@gmail.com>
1 parent 5969018 commit b0ee607

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
@@ -34,7 +34,7 @@ Google Gemini inference provider for accessing Gemini models and Google's AI ser
3434
| `network.timeout.connect` | `float \| None` | No | | Connection timeout in seconds. |
3535
| `network.timeout.read` | `float \| None` | No | | Read timeout in seconds. |
3636
| `network.headers` | `dict[str, str] \| None` | No | | Additional HTTP headers to include in all requests. |
37-
| `access_token` | `SecretStr \| None` | No | | OAuth2 access token for Gemini. When set, used instead of api_key for Bearer authentication. |
37+
| `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. |
3838
| `project` | `str \| None` | No | | Google Cloud project ID for quota attribution when using OAuth/ADC credentials. |
3939

4040
## 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)