Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
readonly.py25 linesDownload Raw Back to memory
1from typing import Any2 3from langchain_classic.base_memory import BaseMemory4 5 6class ReadOnlySharedMemory(BaseMemory):7    """Memory wrapper that is read-only and cannot be changed."""8 9    memory: BaseMemory10 11    @property12    def memory_variables(self) -> list[str]:13        """Return memory variables."""14        return self.memory.memory_variables15 16    def load_memory_variables(self, inputs: dict[str, Any]) -> dict[str, str]:17        """Load memory variables from memory."""18        return self.memory.load_memory_variables(inputs)19 20    def save_context(self, inputs: dict[str, Any], outputs: dict[str, str]) -> None:21        """Nothing should be saved or changed."""22 23    def clear(self) -> None:24        """Nothing to clear, got a memory like a vault."""25 
codekingpro/portable-devtools · Team Ai