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)[源代码]

基类: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)[源代码]

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)[源代码]

Initialize the workflow with additional keyword arguments if needed.

参数:

**kwargs -- Additional parameters for initializing the workflow.

abstract run_operation(target_name: str, **kwargs)[源代码]

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

参数:
  • target_name (str) -- target_name(human name).

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

抛出:

NotImplementedError -- If the subclass does not implement this method.

start_operation_backend(**kwargs)[源代码]

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)[源代码]

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