Represents a template for language modeling, detailing the structure and interaction elements of a conversation.

Example

const sampleTemplate: LmTemplate = {
id: "alapaca",
name: "Alpaca",
system: {
schema: "{system}",
message: "Below is an instruction that describes a task. Write a response that appropriately completes the request.",
},
user: "### Instruction:\n{prompt}",
assistant: "### Response:",
linebreaks: {
system: 2,
user: 2,
}
};

Hierarchy

  • LmTemplate

Properties

afterShot?: string

String to display after a shot

assistant: string

The default message template for the assistant.

id: string

The id slug of the template.

linebreaks?: SpacingSlots

Optional specifications for line breaks between different message types.

This can be used to format the rendered conversation.

name: string

The name of the template.

prefix?: string

A prefix like a bos token to insert before content

shots?: TurnBlock[]

Optional array of turn blocks representing back-and-forths between the user and the assistant.

Useful for simulating multi-turn interactions.

stop?: string[]

Optional array of strings that signal the end of a conversation.

These strings can be used to detect when a conversation should be terminated.

system?: PromptBlock

Optional prompt block that represents system-level messages or instructions.

user: string

The default message template for the user.

Includes a {prompt} placeholder which can be programmatically replaced later.

Generated using TypeDoc