Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Googleapis Python genai Live Converters

From Leeroopedia
Knowledge Sources
Domains Data_Transformation, Live_API
Last Updated 2026-02-15 14:00 GMT

Overview

Concrete tool for converting Live API request and response objects between ML Dev and Vertex AI formats.

Description

The _live_converters module contains code-generated converter functions that transform Live API objects (Blob, Content, FunctionCall, GenerationConfig, LiveClientSetup, LiveConnectConfig, Tool, etc.) between the Google ML Dev API format and the Vertex AI format. Each entity has _to_mldev, _to_vertex, _from_mldev, and _from_vertex variants.

Usage

Internal infrastructure. These converters are called automatically when the SDK sends Live API requests or processes responses based on the configured backend (Gemini Developer API vs Vertex AI).

Code Reference

Source Location

Signature

# Representative converter signatures (code-generated, 50+ functions total)
def _Blob_to_mldev(from_object: Union[dict, object], parent_object: Optional[dict] = None) -> dict[str, Any]: ...
def _Content_to_mldev(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 _LiveConnectConfig_to_vertex(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 _live_converters

I/O Contract

Inputs

Name Type Required Description
from_object dict or object Yes Source object to convert
parent_object dict No Parent context for nested conversion
api_client BaseApiClient For some converters Client for determining API backend

Outputs

Name Type Description
returns dict[str, Any] Converted object in target API format

Usage Examples

# Internal usage - called automatically by the SDK
from google.genai._live_converters import _LiveConnectConfig_to_mldev

# Convert a LiveConnectConfig to ML Dev API format
config_dict = _LiveConnectConfig_to_mldev(
    api_client=client._api_client,
    from_object={"generation_config": {"temperature": 0.7}},
)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment