Table of Contents

Class PromptTemplateException

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

The exception that is thrown when a prompt template cannot be parsed or rendered.

public sealed class PromptTemplateException : Exception, ISerializable
Inheritance
PromptTemplateException
Implements
Inherited Members

Examples

Handling template parse errors:

using LMKit.TextGeneration.Prompts;

try
{
    var template = PromptTemplate.Parse("Hello {{#if}}unclosed");
}
catch (PromptTemplateException ex)
{
    Console.WriteLine($"Error at line {ex.Line}, column {ex.Column}: {ex.Message}");
}

Constructors

PromptTemplateException(string)

Initializes a new instance of the PromptTemplateException class with the specified error message.

PromptTemplateException(string, Exception)

Initializes a new instance of the PromptTemplateException class with the specified error message and inner exception.

PromptTemplateException(string, int, int)

Initializes a new instance of the PromptTemplateException class with the specified error message, line, and column.

Properties

Column

Gets the column number where the error occurred, or -1 if unknown.

Line

Gets the line number where the error occurred, or -1 if unknown.