Optionalconfig: GenerativeAgentMemoryConfigOptionalreflectionMethod that adds a memory to the agent's memory.
The content of the memory to add.
Optionalnow: DateThe current date.
Optionalmetadata: Record<string, unknown>The metadata for the memory.
Optionalcallbacks: anyThe Callbacks to use for adding the memory.
The result of the memory addition.
Method that clears the memory contents.
Nothing.
Method that formats the given relevant memories in detail.
The relevant memories to format.
The formatted memories as a string.
Method that formats the given relevant memories in a simple manner.
The relevant memories to format.
The formatted memories as a string.
Method that returns the key for adding a memory.
The key for adding a memory as a string.
Method that returns the key for the current time.
The key for the current time as a string.
Method that retrieves memories until a token limit is reached.
The number of tokens consumed so far.
The memories as a string.
Method that returns the key for the most recent memories token.
The key for the most recent memories token as a string.
Method that returns the key for relevant memories.
The key for relevant memories as a string.
Method that loads memory variables based on the given inputs.
The inputs to use for loading memory variables.
An object containing the loaded memory variables.
Method that saves the context of a model run to memory.
The inputs of the model run.
The outputs of the model run.
Nothing.
Class that manages the memory of a generative agent in LangChain. It extends the
BaseMemoryclass and has methods for adding a memory, formatting memories, getting memories until a token limit is reached, loading memory variables, saving the context of a model run to memory, and clearing memory contents.Example