VectorStoreRetrieverMemory#

class langchain.memory.vectorstore.VectorStoreRetrieverMemory[source]#

Bases: BaseMemory

VectorStoreRetriever-backed memory.

param exclude_input_keys: Sequence[str] [Optional]#

Input keys to exclude in addition to memory key when constructing the document

param input_key: str | None = None#

Key name to index the inputs to load_memory_variables.

param memory_key: str = 'history'#

Key name to locate the memories in the result of load_memory_variables.

param retriever: VectorStoreRetriever [Required]#

VectorStoreRetriever object to connect to.

param return_docs: bool = False#

Whether or not to return the result of querying the database directly.

async aclear() None[source]#

Nothing to clear.

Return type:

None

async aload_memory_variables(inputs: Dict[str, Any]) Dict[str, List[Document] | str][source]#

Return history buffer.

Parameters:

inputs (Dict[str, Any]) –

Return type:

Dict[str, List[Document] | str]

async asave_context(inputs: Dict[str, Any], outputs: Dict[str, str]) None[source]#

Save context from this conversation to buffer.

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

  • outputs (Dict[str, str]) –

Return type:

None

clear() None[source]#

Nothing to clear.

Return type:

None

load_memory_variables(inputs: Dict[str, Any]) Dict[str, List[Document] | str][source]#

Return history buffer.

Parameters:

inputs (Dict[str, Any]) –

Return type:

Dict[str, List[Document] | str]

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

Save context from this conversation to buffer.

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

  • outputs (Dict[str, str]) –

Return type:

None

property memory_variables: List[str]#

The list of keys emitted from the load_memory_variables method.