Optional
config: GenerativeAgentMemoryConfigOptional
reflectionMethod that adds a memory to the agent's memory.
The content of the memory to add.
Optional
now: DateThe current date.
Optional
metadata: Record<string, unknown>The metadata for the memory.
Optional
callbacks: CallbacksThe Callbacks to use for adding the memory.
The result of the memory addition.
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
BaseMemory
class 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