Table of Contents

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 LM

Language model for this conversation (must include tensors/weights).

contextSize int

Optional 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 LM

Language model.

chatHistory ChatHistory

Existing history to clone and continue from.

contextSize int

Optional context override; -1 lets the runtime choose.

textGenerationSettings ITextGenerationSettings

Optional default text generation settings.

Exceptions

ArgumentNullException

If model or chatHistory is null.

MultiTurnConversation(LM, string)

Restore a previous conversation from a session file.

public MultiTurnConversation(LM model, string sessionFile)

Parameters

model LM

Language model.

sessionFile string

Path 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 LM

Language model.

sessionData byte[]

Bytes produced by SaveSession().

Exceptions

ArgumentNullException

If model is null.

InvalidModelException

If model is not suitable for conversation.