Table of Contents

Enum PromptTemplateSyntax

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

Specifies the placeholder syntax used by a PromptTemplate.

public enum PromptTemplateSyntax

Fields

Mustache = 0

Mustache-style placeholders: {{variable}}, {{#if}}, {{#each}}. This is the default syntax.

Dollar = 1

Dollar-style placeholders: ${variable} or $variable. Block constructs are not supported in this syntax.

Percent = 2

Percent-style placeholders: %variable%. Block constructs are not supported in this syntax.

Examples

Choosing a syntax for template parsing:

using LMKit.TextGeneration.Prompts;

// Mustache (default): {{variable}}
var t1 = PromptTemplate.Parse("Hello {{name}}!");

// Dollar: ${variable} or $variable
var t2 = PromptTemplate.Parse(
    "Hello ${name}!",
    new PromptTemplateOptions { Syntax = PromptTemplateSyntax.Dollar }
);

// Percent: %variable%
var t3 = PromptTemplate.Parse(
    "Hello %name%!",
    new PromptTemplateOptions { Syntax = PromptTemplateSyntax.Percent }
);