VectorStoreRetrieverMemory#

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

Bases: BaseMemory

Deprecated since version 0.3.1: Please see the migration guide at: https://python.langchain.com/docs/versions/migrating_memory/

Store the conversation history in a vector store and retrieves the relevant parts of past conversation based on the input.

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.