> ## Documentation Index
> Fetch the complete documentation index at: https://askmarvin.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# memory

# `marvin.memory.memory`

## Classes

### `Memory`

```python theme={null}
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`**
  ```python theme={null}
  def add(self, content: str) -> str
  ```
* **`delete`**
  ```python theme={null}
  def delete(self, memory_id: str)
  ```
* **`friendly_name`**
  ```python theme={null}
  def friendly_name(self) -> str
  ```
* **`get_prompt`**
  ```python theme={null}
  def get_prompt(self) -> str
  ```
* **`get_tools`**
  ```python theme={null}
  def get_tools(self) -> list[Callable[..., Any]]
  ```
* **`search`**
  ```python theme={null}
  def search(self, query: str, n: int = 20) -> dict[str, str]
  ```

### `MemoryProvider`

```python theme={null}
class MemoryProvider()
```

**Methods:**

* **`add`**
  ```python theme={null}
  def add(self, memory_key: str, content: str) -> str
  ```
  Create a new memory and return its ID.
* **`configure`**
  ```python theme={null}
  def configure(self, memory_key: str)
  ```
  Configure the provider for a specific memory.
* **`delete`**
  ```python theme={null}
  def delete(self, memory_key: str, memory_id: str)
  ```
  Delete a memory by its ID.
* **`search`**
  ```python theme={null}
  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`

```python theme={null}
def get_memory_provider(provider: str) -> MemoryProvider
```

### `sanitize_memory_key`

```python theme={null}
def sanitize_memory_key(key: str) -> str
```

***

**Parent Module:** [`memory`](marvin-memory)
