Method Deserialize
Deserialize(string, LM)
Deserializes binary data from the specified file into an AgentMemory instance.
The file must be in a valid format as produced by the Serialize(string) method.
public static AgentMemory Deserialize(string agentMemoryPath, LM embeddingModel)
Parameters
agentMemoryPath
stringThe file path containing the serialized AgentMemory data.
embeddingModel
LMThe language model used during deserialization to configure the reconstructed instance.
Returns
- AgentMemory
A new AgentMemory instance reconstructed from the binary data.
Exceptions
- ArgumentNullException
Thrown if
agentMemoryPath
is null or empty.- FileNotFoundException
Thrown if the specified file does not exist.
Deserialize(byte[], LM)
Deserializes binary data from a byte array into an AgentMemory instance.
public static AgentMemory Deserialize(byte[] data, LM embeddingModel)
Parameters
data
byte[]The binary data representing a serialized AgentMemory instance.
embeddingModel
LMThe language model used during deserialization for configuration details.
Returns
- AgentMemory
A new AgentMemory instance reconstructed from the provided binary data.
Exceptions
- ArgumentNullException
Thrown if
data
orembeddingModel
is null.
Deserialize(Stream, LM)
Deserializes an AgentMemory instance from the provided stream.
The stream must contain binary data in the format produced by the Serialize(Stream) method.
public static AgentMemory Deserialize(Stream stream, LM embeddingModel)
Parameters
stream
StreamA readable stream containing the serialized AgentMemory data.
embeddingModel
LMThe language model used during deserialization to interpret configuration details.
Returns
- AgentMemory
A new AgentMemory instance reconstructed from the data in the stream.
Exceptions
- ArgumentNullException
Thrown if
stream
orembeddingModel
is null.- ArgumentException
Thrown if
stream
is not readable.- InvalidDataException
Thrown if the stream does not contain valid serialized AgentMemory data or if the version is unsupported.