跳到内容

Firestore

FirestoreIndexStore #

基础类: KVIndexStore

Firestore 索引存储。

参数

名称 类型 描述 默认值
firestore_kvstore FirestoreKVStore

Firestore 键值存储

必需
namespace str

索引存储的命名空间

源代码位于 llama-index-integrations/storage/index_store/llama-index-storage-index-store-firestore/llama_index/storage/index_store/firestore/base.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
class FirestoreIndexStore(KVIndexStore):
    """
    Firestore Index store.

    Args:
        firestore_kvstore (FirestoreKVStore): Firestore key-value store
        namespace (str): namespace for the index store

    """

    def __init__(
        self,
        firestore_kvstore: FirestoreKVStore,
        namespace: Optional[str] = None,
        collection_suffix: Optional[str] = None,
    ) -> None:
        """Init a FirestoreIndexStore."""
        super().__init__(
            firestore_kvstore, namespace=namespace, collection_suffix=collection_suffix
        )

    @classmethod
    def from_database(
        cls,
        project: str,
        database: str,
        namespace: Optional[str] = None,
        collection_suffix: Optional[str] = None,
    ) -> "FirestoreIndexStore":
        """
        Load a FirestoreIndexStore from a Firestore database.

        Args:
            project (str): The project which the client acts on behalf of.
            database (str): The database name that the client targets.
            namespace (str): namespace for the docstore.
            collection_suffix (str): suffix for the collection name

        """
        firestore_kvstore = FirestoreKVStore(project=project, database=database)
        return cls(firestore_kvstore, namespace, collection_suffix)

from_database classmethod #

from_database(project: str, database: str, namespace: Optional[str] = None, collection_suffix: Optional[str] = None) -> FirestoreIndexStore

从 Firestore 数据库加载一个 FirestoreIndexStore。

参数

名称 类型 描述 默认值
project str

客户端代表操作的项目。

必需
database str

客户端指向的数据库名称。

必需
namespace str

文档存储的命名空间。

collection_suffix str

集合名称的后缀

源代码位于 llama-index-integrations/storage/index_store/llama-index-storage-index-store-firestore/llama_index/storage/index_store/firestore/base.py
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
@classmethod
def from_database(
    cls,
    project: str,
    database: str,
    namespace: Optional[str] = None,
    collection_suffix: Optional[str] = None,
) -> "FirestoreIndexStore":
    """
    Load a FirestoreIndexStore from a Firestore database.

    Args:
        project (str): The project which the client acts on behalf of.
        database (str): The database name that the client targets.
        namespace (str): namespace for the docstore.
        collection_suffix (str): suffix for the collection name

    """
    firestore_kvstore = FirestoreKVStore(project=project, database=database)
    return cls(firestore_kvstore, namespace, collection_suffix)