marvin.memory.memory

Classes

Memory

class Memory(key: str, instructions: str | None = None, provider: MemoryProvider = lambda: marvin.defaults.memory_provider(), auto_use: bool = False, prompt: str | Path = Path('memory.jinja'))

A memory module is a partitioned collection of memories that are stored in a vector database, configured by a MemoryProvider.

Methods:

  • add
    def add(self, content: str) -> str
    
  • delete
    def delete(self, memory_id: str)
    
  • friendly_name
    def friendly_name(self) -> str
    
  • get_prompt
    def get_prompt(self) -> str
    
  • get_tools
    def get_tools(self) -> list[Callable[..., Any]]
    
  • search
    def search(self, query: str, n: int = 20) -> dict[str, str]
    

MemoryProvider

class MemoryProvider()

Methods:

  • add
    def add(self, memory_key: str, content: str) -> str
    
    Create a new memory and return its ID.
  • configure
    def configure(self, memory_key: str)
    
    Configure the provider for a specific memory.
  • delete
    def delete(self, memory_key: str, memory_id: str)
    
    Delete a memory by its ID.
  • search
    def search(self, memory_key: str, query: str, n: int = 20) -> dict[str, str]
    
    Search for n memories using a string query.

Functions

get_memory_provider

def get_memory_provider(provider: str) -> MemoryProvider

sanitize_memory_key

def sanitize_memory_key(key: str) -> str

Parent Module: memory