RAGchain.utils.linker package

Submodules

RAGchain.utils.linker.base module

class RAGchain.utils.linker.base.BaseLinker(allow_multiple_instances=False, *args, **kwargs)

Bases: object

abstract delete_json(ids: List[UUID | str])
abstract flush_db()
abstract get_json(ids: List[UUID | str])
abstract put_json(ids: List[UUID | str], json_data_list: List[dict])
exception RAGchain.utils.linker.base.NoDataWarning

Bases: UserWarning

Warning to be raised when there is no data in Linker.

exception RAGchain.utils.linker.base.NoIdWarning

Bases: UserWarning

Warning to be raised when there is no id in Linker.

class RAGchain.utils.linker.base.Singleton

Bases: type

exception RAGchain.utils.linker.base.SingletonCreationError

Bases: Exception

Exception to be raised when trying to create another singleton instance.

RAGchain.utils.linker.dynamo_linker module

class RAGchain.utils.linker.dynamo_linker.DynamoLinker(allow_multiple_instances=False, *args, **kwargs)

Bases: BaseLinker

DynamoDBSingleton is a singleton class that manages DynamoDB.

static chunk(lst, n)
create_or_load_table(table_name)

Create a table if it does not exist, otherwise load it.

create_table(table_name)

Create a table in DynamoDB table that can be used to store DB origin.

delete_json(ids: List[UUID | str])
flush_db()
get_json(ids: List[UUID | str])
static handle_error(err, table_name, operation)
load_table(table_name)

Load a table in DynamoDB table that can be used to store DB origin.

put_json(ids: List[UUID | str], json_data_list: List[dict])

RAGchain.utils.linker.json_linker module

class RAGchain.utils.linker.json_linker.JsonLinker(allow_multiple_instances=False, *args, **kwargs)

Bases: BaseLinker

JsonLinker is a singleton class that allows the role of a linker to be played locally to use JSON file without using an external DB like redis or dynamo.

create_json()
create_or_load_json()
delete_json(ids: List[UUID | str])
flush_db()
get_json(ids: List[UUID | str])
load_json()
put_json(ids: List[UUID | str], json_data_list: List[dict])

RAGchain.utils.linker.redis_linker module

class RAGchain.utils.linker.redis_linker.RedisLinker(allow_multiple_instances=False, *args, **kwargs)

Bases: BaseLinker

RedisDBSingleton is a singleton class that manages redis. We use redis to link DB and passage ids that stores in retrievals.

connection_check()
delete_json(ids: List[UUID | str])
flush_db()
get_json(ids: List[UUID | str])
put_json(ids: List[UUID | str], json_data_list: List[dict])

Module contents