Source code for langchain.memory.readonly
from typing import Any
from langchain_core.memory import BaseMemory
[docs]
class ReadOnlySharedMemory(BaseMemory):
"""Memory wrapper that is read-only and cannot be changed."""
memory: BaseMemory
@property
def memory_variables(self) -> list[str]:
"""Return memory variables."""
return self.memory.memory_variables
[docs]
def load_memory_variables(self, inputs: dict[str, Any]) -> dict[str, str]:
"""Load memory variables from memory."""
return self.memory.load_memory_variables(inputs)
[docs]
def save_context(self, inputs: dict[str, Any], outputs: dict[str, str]) -> None:
"""Nothing should be saved or changed"""
pass