Implementation:Googleapis Python genai Tokens Converters
| Knowledge Sources | |
|---|---|
| Domains | Data_Transformation, Authentication |
| Last Updated | 2026-02-15 14:00 GMT |
Overview
Concrete tool for converting token-related and live connect configuration objects between ML Dev and Vertex AI formats.
Description
The _tokens_converters module contains code-generated converter functions for auth token creation (CreateAuthTokenConfig, CreateAuthTokenParameters) and their associated Live API types (LiveConnectConfig, LiveConnectConstraints, Tool). It maps authentication token parameters and live session constraints between API formats.
Usage
Internal infrastructure. Called automatically when creating auth tokens or configuring live connect constraints.
Code Reference
Source Location
- Repository: Googleapis_Python_genai
- File: google/genai/_tokens_converters.py
- Lines: 1-525
Signature
def _CreateAuthTokenConfig_to_mldev(api_client: BaseApiClient, from_object: Union[dict, object], parent_object: Optional[dict] = None) -> dict[str, Any]: ...
def _CreateAuthTokenParameters_to_mldev(api_client: BaseApiClient, from_object: Union[dict, object], parent_object: Optional[dict] = None) -> dict[str, Any]: ...
def _LiveConnectConfig_to_mldev(api_client: BaseApiClient, from_object: Union[dict, object], parent_object: Optional[dict] = None) -> dict[str, Any]: ...
def _Tool_to_mldev(from_object: Union[dict, object], parent_object: Optional[dict] = None) -> dict[str, Any]: ...
Import
from google.genai import _tokens_converters
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| api_client | BaseApiClient | For some converters | Client for determining API backend |
| from_object | dict or object | Yes | Source token/config object to convert |
| parent_object | dict | No | Parent context for nested conversion |
Outputs
| Name | Type | Description |
|---|---|---|
| returns | dict[str, Any] | Converted object in target API format |
Usage Examples
# Internal usage - called automatically by the Tokens module
from google.genai._tokens_converters import _CreateAuthTokenConfig_to_mldev
config_dict = _CreateAuthTokenConfig_to_mldev(
api_client=client._api_client,
from_object={"uses": 1, "expire_time": "2024-01-01T00:00:00Z"},
)