memoryscope.core.service.base_memory_service

class memoryscope.core.service.base_memory_service.BaseMemoryService(memory_operations: ~typing.Dict[str, dict], context: ~memoryscope.core.utils.singleton.singleton.<locals>._singleton, assistant_name: str | None = None, human_name: str | None = None, **kwargs)[源代码]

基类:object

An abstract base class for managing memory operations within a multithreaded context. It sets up the infrastructure for operation handling, message storage, and synchronization, along with logging capabilities and customizable configurations.

__init__(memory_operations: ~typing.Dict[str, dict], context: ~memoryscope.core.utils.singleton.singleton.<locals>._singleton, assistant_name: str | None = None, human_name: str | None = None, **kwargs)[源代码]

Initializes the BaseMemoryService with operation definitions, keys for memory access, and additional keyword arguments for flexibility.

参数:
  • memory_operations (Dict[str, dict]) -- A dictionary defining available memory operations.

  • context (MemoryscopeContext) -- runtime context.

  • human_name (str) -- human name.

  • assistant_name (str) -- assistant name.

  • **kwargs -- Additional parameters to customize service behavior.

property human_name: str
property assistant_name: str
get_chat_messages_scatter(recent_n_pair: int) List[Message][源代码]
property op_description_dict: Dict[str, str]

Property to retrieve a dictionary mapping operation keys to their descriptions. :returns: A dictionary where keys are operation identifiers and values are their descriptions. :rtype: Dict[str, str]

abstract add_messages_pair(messages: List[Message])[源代码]
abstract register_operation(name: str, operation_config: dict, **kwargs)[源代码]
abstract init_service(**kwargs)[源代码]
start_backend_service(name: str | None = None, **kwargs)[源代码]
stop_backend_service(wait_service: bool = False)[源代码]
abstract run_operation(name: str, role_name: str = '', **kwargs)[源代码]