Source code for evofabric.core.mem._base_mem

# -*- coding: utf-8 -*-
# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.


from abc import ABC, abstractmethod
from typing import List

from ..factory import BaseComponent
from ..typing import StateMessage


[docs] class MemBase(ABC, BaseComponent): """The basic memory interface define, can be used for opensource adaption"""
[docs] @abstractmethod async def retrieval_update(self, messages: List[StateMessage], **kwargs) -> List[StateMessage]: """ retrival memory and update context messages. :param messages: context messages :return: updated context messages based on memory """ ...
[docs] @abstractmethod async def add_messages(self, messages: List[StateMessage], **kwargs) -> None: """ add context messages to memory vectorstore :param messages: context messages :return: """ ...
[docs] @abstractmethod async def clear(self) -> None: """ clear all memories :return: """ ...