DataStoreDocumentStorage#
- class langchain_google_vertexai.vectorstores.document_storage.DataStoreDocumentStorage(
- datastore_client: datastore.Client,
- kind: str = 'document_id',
- text_property_name: str = 'text',
- metadata_property_name: str = 'metadata',
- exclude_from_indexes: List[str] | None = None,
Stores documents in Google Cloud DataStore.
Constructor. :param bucket: Bucket where the documents will be stored. :param prefix: Prefix that is prepended to all document names.
Methods
__init__
(datastore_client[, kind, ...])Constructor.
amdelete
(keys)Async delete the given keys and their associated values.
amget
(keys)Async get the values associated with the given keys.
amset
(key_value_pairs)Async set the values for the given keys.
ayield_keys
(*[, prefix])Async get an iterator over keys that match the given prefix.
mdelete
(keys)Deletes a sequence of documents by key.
mget
(keys)Gets a batch of documents by id.
mset
(key_value_pairs)Stores a series of documents using each keys
yield_keys
(*[, prefix])Yields the keys of all documents in the storage.
- Parameters:
datastore_client (datastore.Client)
kind (str)
text_property_name (str)
metadata_property_name (str)
exclude_from_indexes (Optional[List[str]])
- __init__(
- datastore_client: datastore.Client,
- kind: str = 'document_id',
- text_property_name: str = 'text',
- metadata_property_name: str = 'metadata',
- exclude_from_indexes: List[str] | None = None,
Constructor. :param bucket: Bucket where the documents will be stored. :param prefix: Prefix that is prepended to all document names.
- Parameters:
datastore_client (datastore.Client)
kind (str)
text_property_name (str)
metadata_property_name (str)
exclude_from_indexes (Optional[List[str]])
- Return type:
None
- async amdelete(
- keys: Sequence[K],
Async delete the given keys and their associated values.
- Parameters:
keys (Sequence[K]) – A sequence of keys to delete.
- Return type:
None
- async amget(
- keys: Sequence[K],
Async get the values associated with the given keys.
- Parameters:
keys (Sequence[K]) – A sequence of keys.
- Returns:
A sequence of optional values associated with the keys. If a key is not found, the corresponding value will be None.
- Return type:
list[V | None]
- async amset(
- key_value_pairs: Sequence[tuple[K, V]],
Async set the values for the given keys.
- Parameters:
key_value_pairs (Sequence[tuple[K, V]]) – A sequence of key-value pairs.
- Return type:
None
- async ayield_keys(
- *,
- prefix: str | None = None,
Async get an iterator over keys that match the given prefix.
- Parameters:
prefix (str) – The prefix to match.
- Yields:
Iterator[K | str] – An iterator over keys that match the given prefix. This method is allowed to return an iterator over either K or str depending on what makes more sense for the given store.
- Return type:
AsyncIterator[K] | AsyncIterator[str]
- mdelete(
- keys: Sequence[str],
Deletes a sequence of documents by key.
- Parameters:
keys (Sequence[str]) – A sequence of keys to delete.
- Return type:
None
- mget(
- keys: Sequence[str],
Gets a batch of documents by id. :param ids: List of ids for the text.
- Returns:
- List of texts. If the key id is not found for any id record returns a None
instead.
- Parameters:
keys (Sequence[str])
- Return type:
List[Document | None]