langchain.memory.combined.CombinedMemory

class langchain.memory.combined.CombinedMemory(*, memories: List[BaseMemory])[source]

Bases: BaseMemory

Combining multiple memories’ data together.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

param memories: List[langchain.schema.memory.BaseMemory] [Required]

For tracking all the memories that should be accessed.

validator check_input_key  »  memories[source]

Check that if memories are of type BaseChatMemory that input keys exist.

validator check_repeated_memory_variable  »  memories[source]
clear() None[source]

Clear context from this session for every memory.

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

Load all vars from sub-memories.

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

Save context from this session for every memory.

to_json() Union[SerializedConstructor, SerializedNotImplemented]
to_json_not_implemented() SerializedNotImplemented
property lc_attributes: Dict

Return a list of attribute names that should be included in the serialized kwargs. These attributes must be accepted by the constructor.

property lc_namespace: List[str]

Return the namespace of the langchain object. eg. [“langchain”, “llms”, “openai”]

property lc_secrets: Dict[str, str]

Return a map of constructor argument names to secret ids. eg. {“openai_api_key”: “OPENAI_API_KEY”}

property lc_serializable: bool

Return whether or not the class is serializable.

property memory_variables: List[str]

All the memory variables that this instance provides.

model Config

Bases: object

Configuration for this pydantic object.

arbitrary_types_allowed = True

Examples using CombinedMemory