memoryscope.core.operation.base_operation

class memoryscope.core.operation.base_operation.BaseOperation(name: str, user_name: str, target_names: List[str], chat_messages: List[List[Message]], description: str)[source]

Bases: object

An abstract base class representing an operation that can be categorized as either frontend or backend.

operation_type

Specifies the type of operation, defaulting to “frontend”.

Type:

OPERATION_TYPE

name

The name of the operation.

Type:

str

description

A description of the operation.

Type:

str

operation_type: Literal['frontend', 'backend'] = 'frontend'
__init__(name: str, user_name: str, target_names: List[str], chat_messages: List[List[Message]], description: str)[source]

Initializes a new instance of the BaseOperation.

name: str
user_name: str
target_names: List[str]
chat_messages: List[List[Message]]
description: str
init_workflow(**kwargs)[source]

Initialize the workflow with additional keyword arguments if needed.

Parameters:

**kwargs – Additional parameters for initializing the workflow.

abstract run_operation(target_name: str, **kwargs)[source]

Abstract method to define the operation to be run. Subclasses must implement this method.

Parameters:
  • target_name (str) – target_name(human name).

  • **kwargs – Keyword arguments for running the operation.

Raises:

NotImplementedError – If the subclass does not implement this method.

start_operation_backend(**kwargs)[source]

Placeholder method for running an operation specific to the backend. Intended to be overridden by subclasses if backend operations are required.

stop_operation_backend(wait_operation: bool = False)[source]

Placeholder method to stop any ongoing backend operations. Should be implemented in subclasses where backend operations are managed.