DocumentStorage#

class langchain_google_vertexai.vectorstores.document_storage.DocumentStorage[source]#

Abstract interface of a key, text storage for retrieving documents.

Methods

__init__()

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)

Delete the given keys and their associated values.

mget(keys)

Get the values associated with the given keys.

mset(key_value_pairs)

Set the values for the given keys.

yield_keys(*[,Β prefix])

Get an iterator over keys that match the given prefix.

__init__()#
async amdelete(keys: Sequence[K]) β†’ None#

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]) β†’ list[V | None]#

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]]) β†’ None#

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) β†’ AsyncIterator[K] | AsyncIterator[str]#

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]

abstract mdelete(keys: Sequence[K]) β†’ None#

Delete the given keys and their associated values.

Parameters:

keys (Sequence[K]) – A sequence of keys to delete.

Return type:

None

abstract mget(keys: Sequence[K]) β†’ list[V | None]#

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]

abstract mset(key_value_pairs: Sequence[tuple[K, V]]) β†’ None#

Set the values for the given keys.

Parameters:

key_value_pairs (Sequence[Tuple[K, V]]) – A sequence of key-value pairs.

Return type:

None

abstract yield_keys(*, prefix: str | None = None) β†’ Iterator[K] | Iterator[str]#

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:

Iterator[K] | Iterator[str]