Share via


ChatHistory Constructors

Definition

Overloads

ChatHistory()

Initializes an empty history.

ChatHistory(IEnumerable<ChatMessageContent>)

Initializes the history will all of the specified messages.

ChatHistory(String)

Creates a new instance of the ChatHistory class with a system message.

ChatHistory(String, AuthorRole)

Creates a new instance of the ChatHistory with a first message in the provided AuthorRole. If not role is provided then the first message will default to System role.

ChatHistory()

Initializes an empty history.

public ChatHistory();
Public Sub New ()

Applies to

ChatHistory(IEnumerable<ChatMessageContent>)

Initializes the history will all of the specified messages.

public ChatHistory(System.Collections.Generic.IEnumerable<Microsoft.SemanticKernel.ChatMessageContent> messages);
new Microsoft.SemanticKernel.ChatCompletion.ChatHistory : seq<Microsoft.SemanticKernel.ChatMessageContent> -> Microsoft.SemanticKernel.ChatCompletion.ChatHistory
Public Sub New (messages As IEnumerable(Of ChatMessageContent))

Parameters

messages
IEnumerable<ChatMessageContent>

The messages to copy into the history.

Exceptions

messages is null.

Applies to

ChatHistory(String)

Creates a new instance of the ChatHistory class with a system message.

public ChatHistory(string systemMessage);
new Microsoft.SemanticKernel.ChatCompletion.ChatHistory : string -> Microsoft.SemanticKernel.ChatCompletion.ChatHistory
Public Sub New (systemMessage As String)

Parameters

systemMessage
String

The system message to add to the history.

Applies to

ChatHistory(String, AuthorRole)

Creates a new instance of the ChatHistory with a first message in the provided AuthorRole. If not role is provided then the first message will default to System role.

public ChatHistory(string message, Microsoft.SemanticKernel.ChatCompletion.AuthorRole role);
new Microsoft.SemanticKernel.ChatCompletion.ChatHistory : string * Microsoft.SemanticKernel.ChatCompletion.AuthorRole -> Microsoft.SemanticKernel.ChatCompletion.ChatHistory
Public Sub New (message As String, role As AuthorRole)

Parameters

message
String

The text message to add to the first message in chat history.

role
AuthorRole

The role to add as the first message.

Applies to