RecordManager#
- class langchain_community.indexes.base.RecordManager(namespace: str)[source]#
Abstract base class for a record manager.
Initialize the record manager.
- Parameters:
namespace (str) β The namespace for the record manager.
Methods
__init__
(namespace)Initialize the record manager.
Create the database schema for the record manager.
adelete_keys
(keys)Delete specified records from the database.
aexists
(keys)Check if the provided keys exist in the database.
Get the current server time as a high resolution timestamp!
alist_keys
(*[, before, after, group_ids, limit])List records in the database based on the provided filters.
aupdate
(keys, *[, group_ids, time_at_least])Upsert records into the database.
Create the database schema for the record manager.
delete_keys
(keys)Delete specified records from the database.
exists
(keys)Check if the provided keys exist in the database.
get_time
()Get the current server time as a high resolution timestamp!
list_keys
(*[, before, after, group_ids, limit])List records in the database based on the provided filters.
update
(keys, *[, group_ids, time_at_least])Upsert records into the database.
- __init__(namespace: str) None [source]#
Initialize the record manager.
- Parameters:
namespace (str) β The namespace for the record manager.
- Return type:
None
- abstractmethod async acreate_schema() None [source]#
Create the database schema for the record manager.
- Return type:
None
- abstractmethod async adelete_keys(keys: Sequence[str]) None [source]#
Delete specified records from the database.
- Parameters:
keys (Sequence[str]) β A list of keys to delete.
- Return type:
None
- abstractmethod async aexists(keys: Sequence[str]) List[bool] [source]#
Check if the provided keys exist in the database.
- Parameters:
keys (Sequence[str]) β A list of keys to check.
- Returns:
A list of boolean values indicating the existence of each key.
- Return type:
List[bool]
- abstractmethod async aget_time() float [source]#
Get the current server time as a high resolution timestamp!
Itβs important to get this from the server to ensure a monotonic clock, otherwise there may be data loss when cleaning up old documents!
- Returns:
The current server time as a float timestamp.
- Return type:
float
- abstractmethod async alist_keys(*, before: float | None = None, after: float | None = None, group_ids: Sequence[str] | None = None, limit: int | None = None) List[str] [source]#
List records in the database based on the provided filters.
- Parameters:
before (float | None) β Filter to list records updated before this time.
after (float | None) β Filter to list records updated after this time.
group_ids (Sequence[str] | None) β Filter to list records with specific group IDs.
limit (int | None) β optional limit on the number of records to return.
- Returns:
A list of keys for the matching records.
- Return type:
List[str]
- abstractmethod async aupdate(keys: Sequence[str], *, group_ids: Sequence[str | None] | None = None, time_at_least: float | None = None) None [source]#
Upsert records into the database.
- Parameters:
keys (Sequence[str]) β A list of record keys to upsert.
group_ids (Sequence[str | None] | None) β A list of group IDs corresponding to the keys.
time_at_least (float | None) β if provided, updates should only happen if the updated_at field is at least this time.
- Raises:
ValueError β If the length of keys doesnβt match the length of group_ids.
- Return type:
None
- abstractmethod create_schema() None [source]#
Create the database schema for the record manager.
- Return type:
None
- abstractmethod delete_keys(keys: Sequence[str]) None [source]#
Delete specified records from the database.
- Parameters:
keys (Sequence[str]) β A list of keys to delete.
- Return type:
None
- abstractmethod exists(keys: Sequence[str]) List[bool] [source]#
Check if the provided keys exist in the database.
- Parameters:
keys (Sequence[str]) β A list of keys to check.
- Returns:
A list of boolean values indicating the existence of each key.
- Return type:
List[bool]
- abstractmethod get_time() float [source]#
Get the current server time as a high resolution timestamp!
Itβs important to get this from the server to ensure a monotonic clock, otherwise there may be data loss when cleaning up old documents!
- Returns:
The current server time as a float timestamp.
- Return type:
float
- abstractmethod list_keys(*, before: float | None = None, after: float | None = None, group_ids: Sequence[str] | None = None, limit: int | None = None) List[str] [source]#
List records in the database based on the provided filters.
- Parameters:
before (float | None) β Filter to list records updated before this time.
after (float | None) β Filter to list records updated after this time.
group_ids (Sequence[str] | None) β Filter to list records with specific group IDs.
limit (int | None) β optional limit on the number of records to return.
- Returns:
A list of keys for the matching records.
- Return type:
List[str]
- abstractmethod update(keys: Sequence[str], *, group_ids: Sequence[str | None] | None = None, time_at_least: float | None = None) None [source]#
Upsert records into the database.
- Parameters:
keys (Sequence[str]) β A list of record keys to upsert.
group_ids (Sequence[str | None] | None) β A list of group IDs corresponding to the keys.
time_at_least (float | None) β if provided, updates should only happen if the updated_at field is at least this time.
- Raises:
ValueError β If the length of keys doesnβt match the length of group_ids.
- Return type:
None