CoolFace
Apppublic

coding-alt/AutoGPT

sourceHugging Facemitupdated 3y agoView on Hugging Face
0likes
no_memory.py74 linesDownload Raw Back to memory
1"""A class that does not store any data. This is the default memory provider."""2from __future__ import annotations3 4from typing import Any5 6from autogpt.memory.base import MemoryProviderSingleton7 8 9class NoMemory(MemoryProviderSingleton):10    """11    A class that does not store any data. This is the default memory provider.12    """13 14    def __init__(self, cfg):15        """16        Initializes the NoMemory provider.17 18        Args:19            cfg: The config object.20 21        Returns: None22        """23        pass24 25    def add(self, data: str) -> str:26        """27        Adds a data point to the memory. No action is taken in NoMemory.28 29        Args:30            data: The data to add.31 32        Returns: An empty string.33        """34        return ""35 36    def get(self, data: str) -> list[Any] | None:37        """38        Gets the data from the memory that is most relevant to the given data.39        NoMemory always returns None.40 41        Args:42            data: The data to compare to.43 44        Returns: None45        """46        return None47 48    def clear(self) -> str:49        """50        Clears the memory. No action is taken in NoMemory.51 52        Returns: An empty string.53        """54        return ""55 56    def get_relevant(self, data: str, num_relevant: int = 5) -> list[Any] | None:57        """58        Returns all the data in the memory that is relevant to the given data.59        NoMemory always returns None.60 61        Args:62            data: The data to compare to.63            num_relevant: The number of relevant data to return.64 65        Returns: None66        """67        return None68 69    def get_stats(self):70        """71        Returns: An empty dictionary as there are no stats in NoMemory.72        """73        return {}74