File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020import re
2121from typing import Any
2222from typing import Optional
23+ from typing import TYPE_CHECKING
2324
24- from google .cloud import firestore
2525from typing_extensions import override
2626
2727from . import _utils
3030from .base_memory_service import SearchMemoryResponse
3131from .memory_entry import MemoryEntry
3232
33- if False : # TYPE_CHECKING
33+ if TYPE_CHECKING :
34+ from google .cloud import firestore
35+
3436 from ..sessions .session import Session
3537
3638logger = logging .getLogger ("google_adk." + __name__ )
@@ -261,7 +263,12 @@ def __init__(
261263 stop_words: A set of words to ignore when extracting keywords. Defaults to
262264 a standard English stop words list.
263265 """
264- self .client = client or firestore .AsyncClient ()
266+ if client is None :
267+ from google .cloud import firestore
268+
269+ self .client = firestore .AsyncClient ()
270+ else :
271+ self .client = client
265272 self .events_collection = events_collection or DEFAULT_EVENTS_COLLECTION
266273 self .stop_words = (
267274 stop_words if stop_words is not None else DEFAULT_STOP_WORDS
You can’t perform that action at this time.
0 commit comments