Method Deserialize
- Namespace
- LMKit.TextGeneration.Chat
- Assembly
- LM-Kit.NET.dll
Deserialize(string, LLM)
Deserializes the binary data from the specified file path into a ChatHistory instance using the provided model for context. This method reconstructs a ChatHistory object from its binary form, applying the model to interpret or configure the data appropriately.
public static ChatHistory Deserialize(string chatHistoryPath, LLM model = null)
Parameters
chatHistoryPath
stringThe path to the binary file containing the serialized ChatHistory. The path must not be null or empty, and the file should be in a valid binary format produced by a corresponding serialization method.
model
LLMThe model used to assist in the deserialization process, including configuration settings or schema definitions necessary for correctly rebuilding the ChatHistory instance.
Returns
- ChatHistory
A new instance of ChatHistory reconstructed from the provided binary data. Returns null if deserialization fails.
Exceptions
- ArgumentNullException
Thrown if
chatHistoryPath
is null or empty.- FileNotFoundException
Thrown if the file specified by
chatHistoryPath
does not exist.
Deserialize(byte[], LLM)
Deserializes the given binary data into a ChatHistory instance using the specified model for context.
This method reconstructs a ChatHistory object from its binary form, applying the model to interpret or configure the data appropriately.
public static ChatHistory Deserialize(byte[] data, LLM model = null)
Parameters
data
byte[]The binary data representing a serialized ChatHistory. This data must not be null and should be a valid binary format previously produced by a corresponding serialize method.
model
LLMThe model used to assist in the deserialization process. This might include configuration settings or schema definitions needed to correctly rebuild the ChatHistory instance.
Returns
- ChatHistory
A new instance of ChatHistory that has been reconstructed from the provided binary data. Returns null if deserialization fails.
Exceptions
- ArgumentNullException
Thrown if either
data
ormodel
is null.
Deserialize(Stream, LLM)
Deserializes a ChatHistory from a stream using the provided model for context.
This method reconstructs a ChatHistory object from its binary form, applying the model to interpret or configure the data appropriately.
public static ChatHistory Deserialize(Stream stream, LLM model)
Parameters
stream
StreamThe stream containing the binary data of a serialized ChatHistory. The stream must be readable and must not be null.
model
LLMThe model used to assist in the deserialization process, which may include settings or definitions essential for reconstructing the ChatHistory accurately. This parameter must not be null.
Returns
- ChatHistory
A new instance of ChatHistory reconstructed from the data in the stream. If deserialization fails, it may return null or throw an exception, depending on the failure condition.
Exceptions
- ArgumentNullException
Thrown if either
stream
ormodel
is null, as both are required for successful deserialization.- ArgumentException
Thrown if the stream is not readable.
- InvalidDataException
Thrown when the data in the stream does not represent a valid serialized ChatHistory, or if errors occur during the deserialization process.