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
model
LMLanguage model for this conversation (must include tensors/weights).
contextSize
intOptional override for token window size; -1 lets the runtime choose.
Exceptions
- ArgumentNullException
If
model
is 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
model
LMLanguage model.
chatHistory
ChatHistoryExisting history to clone and continue from.
contextSize
intOptional context override; -1 lets the runtime choose.
textGenerationSettings
ITextGenerationSettingsOptional default text generation settings.
Exceptions
- ArgumentNullException
If
model
orchatHistory
is null.
MultiTurnConversation(LM, string)
Restore a previous conversation from a session file.
public MultiTurnConversation(LM model, string sessionFile)
Parameters
model
LMLanguage model.
sessionFile
stringPath to a file produced by SaveSession(string).
Exceptions
- ArgumentNullException
If
model
is null.- InvalidModelException
If
model
is not suitable for conversation.
MultiTurnConversation(LM, byte[])
Restore a previous conversation from serialized bytes.
public MultiTurnConversation(LM model, byte[] sessionData)
Parameters
model
LMLanguage model.
sessionData
byte[]Bytes produced by SaveSession().
Exceptions
- ArgumentNullException
If
model
is null.- InvalidModelException
If
model
is not suitable for conversation.