memoryscope.core.worker.frontend
- class memoryscope.core.worker.frontend.ExtractTimeWorker(embedding_model: str = '', generation_model: str = '', rank_model: str = '', **kwargs)[source]
Bases:
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)[source]
Bases:
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)[source]
Determines whether the node is relevant.
- class memoryscope.core.worker.frontend.PrintMemoryWorker(embedding_model: str = '', generation_model: str = '', rank_model: str = '', **kwargs)[source]
Bases:
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)[source]
Bases:
MemoryBaseWorker
Fetches unmemorized chat messages.
- class memoryscope.core.worker.frontend.RetrieveMemoryWorker(embedding_model: str = '', generation_model: str = '', rank_model: str = '', **kwargs)[source]
Bases:
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.
- Parameters:
*args – Variable length argument list for the decorated function.
**kwargs – Arbitrary keyword arguments for the decorated function.
- Returns:
The result of the decorated function.
- Return type:
Any
- retrieve_from_insight(**kwargs)
The wrapper function that manages the timing of the original function.
- Parameters:
*args – Variable length argument list for the decorated function.
**kwargs – Arbitrary keyword arguments for the decorated function.
- Returns:
The result of the decorated function.
- Return type:
Any
- retrieve_expired_memory(**kwargs)
The wrapper function that manages the timing of the original function.
- Parameters:
*args – Variable length argument list for the decorated function.
**kwargs – Arbitrary keyword arguments for the decorated function.
- Returns:
The result of the decorated function.
- Return type:
Any
- class memoryscope.core.worker.frontend.SemanticRankWorker(embedding_model: str = '', generation_model: str = '', rank_model: str = '', **kwargs)[source]
Bases:
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)[source]
Bases:
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.