Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions google/genai/tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,24 +128,24 @@ def create(
Args:
config (CreateAuthTokenConfig): Optional configuration for the request.

The CreateAuthTokenConfig's `live_constrained_parameters` attrubite
Can be used to lock the parameters of the live session so they
The CreateAuthTokenConfig's `live_connect_constraints` attribute
can be used to lock the parameters of the live session so they
can't be changed client side. This behavior has two basic modes depending on
whether `lock_additional_fields` is set:

If you do not pass `lock_additional_fields` the entire
`live_constrained_parameters` is locked and can't be changed
`live_connect_constraints` is locked and can't be changed
by the token's user.

If you set `lock_additional_fields`, then the non-null fields of
`live_constrained_parameters` are locked, and any additional fields
`live_connect_constraints` are locked, and any additional fields
specified in `lock_additional_fields`.

Usage:

.. code-block:: python

# Case 1: If LiveEphemeralParameters is unset, unlock LiveConnectConfig
# Case 1: If live_connect_constraints is unset, unlock LiveConnectConfig
# when using the token in Live API sessions. Each session connection can
# use a different configuration.

Expand All @@ -157,15 +157,15 @@ def create(

.. code-block:: python

# Case 2: If LiveEphemeralParameters is set, lock all fields in
# Case 2: If live_connect_constraints is set, lock all fields in
# LiveConnectConfig when using the token in Live API sessions. For
# example, changing `output_audio_transcription` in the Live API
# connection will be ignored by the API.

auth_token = client.auth_tokens.create(
config=types.CreateAuthTokenConfig(
uses=10,
live_constrained_parameters=types.LiveEphemeralParameters(
live_connect_constraints=types.LiveConnectConstraints(
model='gemini-live-2.5-flash-preview',
config=types.LiveConnectConfig(
system_instruction='You are an LLM called Gemini.'
Expand All @@ -176,14 +176,14 @@ def create(

.. code-block:: python

# Case 3: If LiveEphemeralParameters is set and lockAdditionalFields is
# Case 3: If live_connect_constraints is set and lock_additional_fields is
# empty, lock LiveConnectConfig with set fields (e.g.
# system_instruction in this example) when using the token in Live API
# sessions.
auth_token = client.auth_tokens.create(
config=types.CreateAuthTokenConfig(
uses=10,
live_constrained_parameters=types.LiveEphemeralParameters(
live_connect_constraints=types.LiveConnectConstraints(
config=types.LiveConnectConfig(
system_instruction='You are an LLM called Gemini.'
),
Expand All @@ -194,14 +194,14 @@ def create(

.. code-block:: python

# Case 4: If LiveEphemeralParameters is set and lockAdditionalFields is
# Case 4: If live_connect_constraints is set and lock_additional_fields is
# set, lock LiveConnectConfig with set and additional fields (e.g.
# system_instruction, temperature in this example) when using the token
# in Live API sessions.
auth_token = client.auth_tokens.create(
config=types.CreateAuthTokenConfig(
uses=10,
live_constrained_parameters=types.LiveEphemeralParameters(
live_connect_constraints=types.LiveConnectConstraints(
model='gemini-live-2.5-flash-preview',
config=types.LiveConnectConfig(
system_instruction='You are an LLM called Gemini.'
Expand Down Expand Up @@ -296,7 +296,7 @@ async def create(
auth_token = await client.aio.tokens.create(
config=types.CreateAuthTokenConfig(
uses=10,
live_constrained_parameters=types.LiveEphemeralParameters(
live_connect_constraints=types.LiveConnectConstraints(
model='gemini-live-2.5-flash-preview',
config=types.LiveConnectConfig(
system_instruction='You are an LLM called Gemini.'
Expand Down
Loading