Table of Contents

Method ToText

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

ToText()

Converts the complete chat history, including the formatting provided by the chat template, into a single string.

public string ToText()

Returns

string

A string representing the content of the chat history with all messages and formatting applied.

Examples

history.AddMessage(AuthorRole.User, "Hello!");
history.AddMessage(AuthorRole.Assistant, "Hi there!");

// Get the full formatted prompt as seen by the model
string prompt = history.ToText();
Console.WriteLine(prompt);
Share