Table of Contents

Constructor MultiTurnConversation

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

MultiTurnConversation(LLM, int)

Initializes a new instance of the MultiTurnConversation class with a specified language model.

public MultiTurnConversation(LLM model, int contextSize = 2048)

Parameters

model LLM

The LLM object that defines the language model for this conversation.

contextSize int

An optional integer specifying the size of the context buffer, defaulting to 2048 tokens.

Exceptions

ArgumentNullException

Thrown when the provided model argument is null.

InvalidModelException

Thrown when the provided model is invalid for conversation. This occurs if:

  • The model is an embedding model, which is not suitable for this operation.
  • The model is loaded without weights. Ensure the LoadTensors property of the LLM.LoadingOptions class is set to true.

MultiTurnConversation(LLM, ChatHistory, int)

Initializes a new instance of the MultiTurnConversation class with a specified language model and existing chat history.

public MultiTurnConversation(LLM model, ChatHistory chatHistory, int contextSize = 2048)

Parameters

model LLM

The LLM object that defines the language model for this conversation.

chatHistory ChatHistory

A ChatHistory object containing prior conversation history.

contextSize int

An optional integer specifying the size of the context buffer, defaulting to 2048 tokens.

Exceptions

ArgumentNullException

Thrown when the provided model or chatHistory argument is null.

MultiTurnConversation(LLM, string)

Initializes a new instance of the MultiTurnConversation class, restoring a previous conversation session from a file.

public MultiTurnConversation(LLM model, string sessionFile)

Parameters

model LLM

The LLM object that defines the language model for this conversation.

sessionFile string

The file path to the session file, created using SaveSession(string), to restore the chat session state.

Exceptions

ArgumentNullException

Thrown when the provided model argument is null.

InvalidModelException

Thrown when the provided model does not meet the required specifications for conversation. This can occur if:

  • The model is an embedding model, which is not suitable for conversation.
  • The model is loaded without weights. Ensure the LoadTensors property of the LLM.LoadingOptions class is set to true.

MultiTurnConversation(LLM, byte[])

Initializes a new instance of the MultiTurnConversation class, restoring a previous conversation session from session data.

public MultiTurnConversation(LLM model, byte[] sessionData)

Parameters

model LLM

The LLM object that defines the language model for this conversation.

sessionData byte[]

The session data, created using SaveSession(), to restore the chat session state.

Exceptions

ArgumentNullException

Thrown when the provided model argument is null.

InvalidModelException

Thrown when the provided model does not meet the required specifications for conversation. This can occur if:

  • The model is an embedding model, which is not suitable for conversation.
  • The model is loaded without weights. Ensure the LoadTensors property of the LLM.LoadingOptions class is set to true.