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
agentMemoryPathstringThe file path containing the serialized AgentMemory data.
embeddingModelLMThe 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
agentMemoryPathis 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
databyte[]The binary data representing a serialized AgentMemory instance.
embeddingModelLMThe language model used during deserialization for configuration details.
Returns
- AgentMemory
A new AgentMemory instance reconstructed from the provided binary data.
Exceptions
- ArgumentNullException
Thrown if
dataorembeddingModelis 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
streamStreamA readable stream containing the serialized AgentMemory data.
embeddingModelLMThe 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
streamorembeddingModelis null.- ArgumentException
Thrown if
streamis not readable.- InvalidDataException
Thrown if the stream does not contain valid serialized AgentMemory data or if the version is unsupported.