SimpleMemory#

class langchain.memory.simple.SimpleMemory[source]#

Bases: BaseMemory

Simple memory for storing context or other information that shouldn’t ever change between prompts.

param memories: Dict[str, Any] = {}#
async aclear() → None#

Async clear memory contents.

Return type:

None

async aload_memory_variables(inputs: dict[str, Any]) → dict[str, Any]#

Async return key-value pairs given the text input to the chain.

Parameters:

inputs (dict[str, Any]) – The inputs to the chain.

Returns:

A dictionary of key-value pairs.

Return type:

dict[str, Any]

async asave_context(inputs: dict[str, Any], outputs: dict[str, str]) → None#

Async save the context of this chain run to memory.

Parameters:
  • inputs (dict[str, Any]) – The inputs to the chain.

  • outputs (dict[str, str]) – The outputs of the chain.

Return type:

None

clear() → None[source]#

Nothing to clear, got a memory like a vault.

Return type:

None

load_memory_variables(inputs: Dict[str, Any]) → Dict[str, str][source]#

Return key-value pairs given the text input to the chain.

Parameters:

inputs (Dict[str, Any]) – The inputs to the chain.

Returns:

A dictionary of key-value pairs.

Return type:

Dict[str, str]

save_context(inputs: Dict[str, Any], outputs: Dict[str, str]) → None[source]#

Nothing should be saved or changed, my memory is set in stone.

Parameters:
  • inputs (Dict[str, Any])

  • outputs (Dict[str, str])

Return type:

None

property memory_variables: List[str]#

The string keys this memory class will add to chain inputs.