mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
chore: Defer import of live, Client and _transformers in google.genai
Co-authored-by: Liang Wu <wuliang@google.com> PiperOrigin-RevId: 831444358
This commit is contained in:
committed by
Copybara-Service
parent
a19be12c1f
commit
22c6dbe83c
@@ -27,7 +27,6 @@ from typing import Optional
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Union
|
||||
|
||||
from google.genai import Client
|
||||
from google.genai import types
|
||||
from typing_extensions import override
|
||||
|
||||
@@ -41,6 +40,8 @@ from .gemini_llm_connection import GeminiLlmConnection
|
||||
from .llm_response import LlmResponse
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from google.genai import Client
|
||||
|
||||
from .llm_request import LlmRequest
|
||||
|
||||
logger = logging.getLogger('google_adk.' + __name__)
|
||||
@@ -200,6 +201,8 @@ class Gemini(BaseLlm):
|
||||
Returns:
|
||||
The api client.
|
||||
"""
|
||||
from google.genai import Client
|
||||
|
||||
return Client(
|
||||
http_options=types.HttpOptions(
|
||||
headers=self._tracking_headers,
|
||||
@@ -239,6 +242,8 @@ class Gemini(BaseLlm):
|
||||
|
||||
@cached_property
|
||||
def _live_api_client(self) -> Client:
|
||||
from google.genai import Client
|
||||
|
||||
return Client(
|
||||
http_options=types.HttpOptions(
|
||||
headers=self._tracking_headers, api_version=self._live_api_version
|
||||
|
||||
Reference in New Issue
Block a user