Table of Contents

Method Deserialize

Namespace
LMKit.Agents
Assembly
LM-Kit.NET.dll

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.

public static AgentMemory Deserialize(string agentMemoryPath, LM embeddingModel)

Parameters

agentMemoryPath string

The path to the binary file containing the serialized AgentMemory. Must not be null or empty, and the file must be in a valid format produced by this class.

embeddingModel LM

The language model used to assist in deserialization, providing configuration and schema details required for reconstructing the AgentMemory 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 (provided as 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. This data must be in a valid format as produced by the Serialize method.

embeddingModel LM

The language model used to assist in deserialization, providing necessary configuration details.

Returns

AgentMemory

A new AgentMemory instance reconstructed from the provided binary data.

Exceptions

ArgumentNullException

Thrown if data or embeddingModel is null.

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.

public static AgentMemory Deserialize(Stream stream, LM embeddingModel)

Parameters

stream Stream

The stream containing the binary data of a serialized AgentMemory. Must be readable and not null.

embeddingModel LM

The language model used during deserialization to interpret or configure the reconstructed data.

Returns

AgentMemory

A new AgentMemory instance reconstructed from the data in the stream.

Exceptions

ArgumentNullException

Thrown if either stream or embeddingModel is null.

ArgumentException

Thrown if the stream is not readable.

InvalidDataException

Thrown when the stream data does not represent a valid serialized AgentMemory, or if errors occur during deserialization.