Skip to content

docs: fix auth_tokens.create() docstring to use the real field and type - #2836

Open
arunpshankar wants to merge 1 commit into
googleapis:mainfrom
arunpshankar:fix-auth-token-docstring
Open

docs: fix auth_tokens.create() docstring to use the real field and type#2836
arunpshankar wants to merge 1 commit into
googleapis:mainfrom
arunpshankar:fix-auth-token-docstring

Conversation

@arunpshankar

Copy link
Copy Markdown

The auth_tokens.create() docstring documents a config field and a type that do not exist. All four of its usage examples raise AttributeError if copied verbatim.

Reproduction

from google.genai import types

types.CreateAuthTokenConfig(
    uses=10,
    live_constrained_parameters=types.LiveEphemeralParameters(
        model="gemini-live-2.5-flash-preview",
    ),
)
AttributeError: module 'google.genai.types' has no attribute 'LiveEphemeralParameters'

Cause

The field on CreateAuthTokenConfig is live_connect_constraints, and the type is LiveConnectConstraints:

# google/genai/types.py
class CreateAuthTokenConfig(_common.BaseModel):
  ...
  live_connect_constraints: Optional[LiveConnectConstraints] = ...

LiveEphemeralParameters appears zero times in types.py. LiveConnectConstraints has the same (model, config) shape the examples already use, so this is a rename in the docs rather than a behaviour change.

What this PR changes

Docstring only, no functional change:

  • live_constrained_parameterslive_connect_constraints (5 occurrences)
  • types.LiveEphemeralParameters(types.LiveConnectConstraints( (3 occurrences, Cases 2–4)
  • prose comments referring to the old type name, and lockAdditionalFieldslock_additional_fields (the Python field name)
  • adjacent typo attrubiteattribute, and lowercased the sentence continuation

Verification

All four corrected examples construct against google-genai 2.16.0:

Case 1 ✅   Case 2 ✅   Case 3 ✅   Case 4 ✅
4/4 corrected examples construct
original as-documented: AttributeError

Found while building a Vertex-based teaching repo — the examples were the first thing I reached for when wiring ephemeral tokens for a browser Live client.

@google-cla

google-cla Bot commented Aug 9, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

The `create()` docstring documents a config field and a type that do not
exist, so all four of its usage examples raise AttributeError if copied:

    live_constrained_parameters=types.LiveEphemeralParameters(...)
    AttributeError: module 'google.genai.types' has no attribute
                    'LiveEphemeralParameters'

The field on CreateAuthTokenConfig is `live_connect_constraints` and the
type is `LiveConnectConstraints`, which has the same (model, config)
shape the examples already use - so this is a rename, not a behaviour
change. `LiveEphemeralParameters` appears zero times in types.py.

Also fixes the adjacent typo 'attrubite' -> 'attribute' and lowercases
the sentence continuation, and updates the prose comments that referred
to the old type name and to lockAdditionalFields (the Python field is
`lock_additional_fields`).

Docstring only - no functional change. Verified all four corrected
examples construct against google-genai 2.16.0.
@arunpshankar
arunpshankar force-pushed the fix-auth-token-docstring branch from f0a2cd7 to 185b2b4 Compare August 9, 2026 18:34
@arunpshankar

Copy link
Copy Markdown
Author

Two notes from double-checking this before review:

1. The rename is already recorded in this repo. CHANGELOG.md:1447:

Rename LiveEphemeralParameters to LiveConnectConstraints. (6719faf)

So the docstring is stale text left behind by a deliberate rename, not a forward reference. LiveEphemeralParameters and live_constrained_parameters now appear only in this docstring and in generated docs — nowhere in the package source.

2. docs/genai.html carries the same stale examples (lines ~3710, 3742–3750, 3772, 3789, 3806). I have deliberately not touched it, since it is Sphinx build output rather than a source file — but it will need regenerating for the published docs to pick this up.

Safety of the change: the patch is docstring-only. Parsing both revisions and comparing the ASTs with docstrings stripped gives an identical tree, so there is no functional delta.

@Venkaiahbabuneelam Venkaiahbabuneelam self-assigned this Aug 10, 2026
@Venkaiahbabuneelam Venkaiahbabuneelam added the size:M Code changes between 10-40 lines label Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M Code changes between 10-40 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants