Skip to content

Commit 8312dc8

Browse files
Correct imports for firestore
1 parent d2d2231 commit 8312dc8

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/google/adk/memory/firestore_memory_service.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
import re
2121
from typing import Any
2222
from typing import Optional
23+
from typing import TYPE_CHECKING
2324

24-
from google.cloud import firestore
2525
from typing_extensions import override
2626

2727
from . import _utils
@@ -30,7 +30,9 @@
3030
from .base_memory_service import SearchMemoryResponse
3131
from .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

3638
logger = 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

0 commit comments

Comments
 (0)