Class AgentMemory
Provides persistent memory storage and retrieval capabilities for conversational agents.
The AgentMemory
class leverages a retrieval-augmented generation (RAG) engine to store text-based information and later recall relevant partitions based on input messages.
This mechanism enhances multi-turn conversations by integrating additional context or previously stored information.
public sealed class AgentMemory : ISerializableData
- Inheritance
-
AgentMemory
- Implements
- Inherited Members
Constructors
- AgentMemory(LM)
Initializes a new instance of the AgentMemory class with the specified language model.
Properties
- DataSources
Gets the collection of data sources currently managed by the agent memory.
Methods
- Clear()
Clears all stored memory data by removing all data sources.
- Deserialize(byte[], LM)
Deserializes binary data (provided as a byte array) into an AgentMemory instance.
- Deserialize(Stream, LM)
Deserializes an AgentMemory instance from the provided stream.
The stream should contain binary data in the format produced by the Serialize(Stream) method.
- Deserialize(string, LM)
Deserializes binary data from the specified file path into an AgentMemory instance.
The method reconstructs an AgentMemory object from its binary form, using the provided language model for context.
- IsEmpty()
Determines whether the agent memory currently contains any stored information.
- RemoveDataSource(DataSource)
Removes a specific data source from the agent memory.
- SaveInformation(string, string, string, MetadataCollection, CancellationToken)
Synchronously saves text information into the specified memory collection.
- SaveInformationAsync(string, string, string, MetadataCollection, CancellationToken)
Asynchronously saves text information into the specified memory collection.
- Serialize()
Serializes the current instance into a binary format and returns the resulting data as a byte array.
- Serialize(Stream)
Serializes the current instance into a binary format and writes it to the provided stream.
- Serialize(string)
Serializes the current instance into a binary format and writes the data to the specified file.