memoryscope.core.worker.frontend

class memoryscope.core.worker.frontend.ExtractTimeWorker(embedding_model: str = '', generation_model: str = '', rank_model: str = '', **kwargs)[源代码]

基类:MemoryBaseWorker

A specialized worker class designed to identify and extract time-related information from text generated by an LLM, translating date-time keywords based on the set language, and storing this extracted data within a shared context.

EXTRACT_TIME_PATTERN = '-\\s*(\\S+)[::]\\s*(\\S+)'
FILE_PATH: str = '/home/runner/work/MemoryScope/MemoryScope/memoryscope/core/worker/frontend/extract_time_worker.py'
class memoryscope.core.worker.frontend.FuseRerankWorker(embedding_model: str = '', generation_model: str = '', rank_model: str = '', **kwargs)[源代码]

基类:MemoryBaseWorker

Reranks the memory nodes by scores, types, and temporal relevance. Formats the top-K reranked nodes to print.

static match_node_time(extract_time_dict: Dict[str, str], node: MemoryNode)[源代码]

Determines whether the node is relevant.

class memoryscope.core.worker.frontend.PrintMemoryWorker(embedding_model: str = '', generation_model: str = '', rank_model: str = '', **kwargs)[源代码]

基类:MemoryBaseWorker

Formats the memories to print.

FILE_PATH: str = '/home/runner/work/MemoryScope/MemoryScope/memoryscope/core/worker/frontend/print_memory_worker.py'
class memoryscope.core.worker.frontend.ReadMessageWorker(embedding_model: str = '', generation_model: str = '', rank_model: str = '', **kwargs)[源代码]

基类:MemoryBaseWorker

Fetches unmemorized chat messages.

class memoryscope.core.worker.frontend.RetrieveMemoryWorker(embedding_model: str = '', generation_model: str = '', rank_model: str = '', **kwargs)[源代码]

基类:MemoryBaseWorker

Retrieves memories based on specified criteria such as status, type, and timestamp. Processes these memories concurrently, sorts them by similarity, and logs the activity, facilitating efficient memory retrieval operations within a given scope.

retrieve_from_observation(**kwargs)

The wrapper function that manages the timing of the original function.

参数:
  • *args -- Variable length argument list for the decorated function.

  • **kwargs -- Arbitrary keyword arguments for the decorated function.

返回:

The result of the decorated function.

返回类型:

Any

retrieve_from_insight(**kwargs)

The wrapper function that manages the timing of the original function.

参数:
  • *args -- Variable length argument list for the decorated function.

  • **kwargs -- Arbitrary keyword arguments for the decorated function.

返回:

The result of the decorated function.

返回类型:

Any

retrieve_expired_memory(**kwargs)

The wrapper function that manages the timing of the original function.

参数:
  • *args -- Variable length argument list for the decorated function.

  • **kwargs -- Arbitrary keyword arguments for the decorated function.

返回:

The result of the decorated function.

返回类型:

Any

class memoryscope.core.worker.frontend.SemanticRankWorker(embedding_model: str = '', generation_model: str = '', rank_model: str = '', **kwargs)[源代码]

基类:MemoryBaseWorker

The SemanticRankWorker class processes queries by retrieving memory nodes, removing duplicates, ranking them based on semantic relevance using a model, assigning scores, sorting the nodes, and storing the ranked nodes back, while logging relevant information.

class memoryscope.core.worker.frontend.SetQueryWorker(embedding_model: str = '', generation_model: str = '', rank_model: str = '', **kwargs)[源代码]

基类:MemoryBaseWorker

The SetQueryWorker class is responsible for setting a query and its associated timestamp into the context, utilizing either provided chat parameters or details from the most recent chat message.