memoryscope.core.worker.backend.update_insight_worker

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

基类:MemoryBaseWorker

This class is responsible for updating insight value in a memory system. It filters insight nodes based on their association with observed nodes, utilizes a ranking model to prioritize them, generates refreshed insights via an LLM, and manages node statuses and content updates, incorporating features for concurrent execution and logging.

FILE_PATH: str = '/home/runner/work/MemoryScope/MemoryScope/memoryscope/core/worker/backend/update_insight_worker.py'
filter_obs_nodes(insight_node: ~memoryscope.scheme.memory_node.MemoryNode, obs_nodes: ~typing.List[~memoryscope.scheme.memory_node.MemoryNode]) -> (<class 'memoryscope.scheme.memory_node.MemoryNode'>, typing.List[memoryscope.scheme.memory_node.MemoryNode], <class 'float'>)[源代码]

Filters observed nodes based on their relevance to a given insight node using a ranking model.

参数:
  • insight_node (MemoryNode) -- The insight node used as the basis for filtering.

  • obs_nodes (List[MemoryNode]) -- A list of observed nodes to be filtered.

返回:

A tuple containing:
  • The original insight node.

  • A list of filtered observed nodes that are relevant to the insight node.

  • The maximum relevance score among the filtered nodes.

返回类型:

tuple

update_insight_node(insight_node: MemoryNode, insight_value: str)[源代码]

Updates the MemoryNode with the new insight value.

参数:
  • insight_node (MemoryNode) -- The MemoryNode whose insight value needs to be updated.

  • insight_value (str) -- The new insight value.

返回:

The updated MemoryNode with potentially revised insight value.

返回类型:

MemoryNode

update_insight(insight_node: MemoryNode, filtered_nodes: List[MemoryNode]) MemoryNode[源代码]

Updates the insight value of a given MemoryNode based on the context from a list of filtered MemoryNodes.

参数:
  • insight_node (MemoryNode) -- The MemoryNode whose insight value needs to be updated.

  • filtered_nodes (List[MemoryNode]) -- A list of MemoryNodes used as context for updating the insight.

返回:

The updated MemoryNode with potentially revised insight value.

返回类型:

MemoryNode

name: str
workflow_context: Dict[str, Any]
memoryscope_context: MemoryscopeContext
raise_exception: bool
is_multi_thread: bool
thread_pool: ThreadPoolExecutor
enable_parallel: bool
kwargs: dict
continue_run: bool
async_task_list: list
thread_task_list: list
logger: Logger