Constructor MultiTurnConversation
- Namespace
- LMKit.TextGeneration
- Assembly
- LM-Kit.NET.dll
MultiTurnConversation(LM, int)
Create a new conversation with an LM and optional custom context size.
Pass contextSize = -1 (default) to let LM-Kit pick an optimal size based on hardware
and model settings. Otherwise, the value is bounded by model limits and minimal configuration.
public MultiTurnConversation(LM model, int contextSize = -1)
Parameters
modelLMLanguage model for this conversation (must include tensors/weights).
contextSizeintOptional override for token window size; -1 lets the runtime choose.
Exceptions
- ArgumentNullException
If
modelis null.- InvalidModelException
If the model is embedding-only or was loaded without tensors.
MultiTurnConversation(LM, ChatHistory, int, ITextGenerationSettings)
Continue a conversation from an existing ChatHistory.
Use this when you want to resume an earlier interaction without loading a serialized session file. The provided history is cloned, and the model reference is normalized for this instance.
public MultiTurnConversation(LM model, ChatHistory chatHistory, int contextSize = -1, ITextGenerationSettings textGenerationSettings = null)
Parameters
modelLMLanguage model.
chatHistoryChatHistoryExisting history to clone and continue from.
contextSizeintOptional context override; -1 lets the runtime choose.
textGenerationSettingsITextGenerationSettingsOptional default text generation settings.
Exceptions
- ArgumentNullException
If
modelorchatHistoryis null.
MultiTurnConversation(LM, string)
Restore a previous conversation from a session file.
public MultiTurnConversation(LM model, string sessionFile)
Parameters
modelLMLanguage model.
sessionFilestringPath to a file produced by SaveSession(string).
Exceptions
- ArgumentNullException
If
modelis null.- InvalidModelException
If
modelis not suitable for conversation.
MultiTurnConversation(LM, byte[])
Restore a previous conversation from serialized bytes.
public MultiTurnConversation(LM model, byte[] sessionData)
Parameters
modelLMLanguage model.
sessionDatabyte[]Bytes produced by SaveSession().
Exceptions
- ArgumentNullException
If
modelis null.- InvalidModelException
If
modelis not suitable for conversation.