Table of Contents

Class PromptTemplate

Namespace
Glitch9.AIDevKit

A reference to a predefined prompt template stored on the AI provider's servers.
This allows you to use complex prompt templates without having to include the full text of the prompt in your request.
Instead, you can simply reference the prompt by its unique identifier and provide any necessary variables for substitution.
This can help to keep your requests smaller and more manageable, especially when working with large or complex prompts.

Example Template: "Write a daily report for ${name} about today's sales. Include top 3 products."

public sealed class PromptTemplate : PromptBase<string>, IPrompt, IEquatable<PromptBase<string>>, IModeratable
Inheritance
object
PromptBase<string>
PromptTemplate
Implements
IEquatable<PromptBase<string>>
Inherited Members
Extension Methods

Constructors

PromptTemplate()

public PromptTemplate()

PromptTemplate(string, Dictionary<string, object>, float?)

public PromptTemplate(string template, Dictionary<string, object> variables, float? weight)

Parameters

template string
variables Dictionary<string, object>
weight float?

PromptTemplate(string, string, Dictionary<string, object>, float?)

public PromptTemplate(string version, string template, Dictionary<string, object> variables, float? weight)

Parameters

version string
template string
variables Dictionary<string, object>
weight float?

Properties

Id

Required. The unique identifier of the prompt template to use.

public string Id { get; set; }

Property Value

string

PromptType

[LocalProperty("type")]
public override PromptType PromptType { get; }

Property Value

PromptType

Variables

Optional. Optional map of values to substitute in for variables in your prompt. The substitution values can either be strings, or other Response input types like images or files.

public Dictionary<string, object> Variables { get; set; }

Property Value

Dictionary<string, object>

Version

Optional. Optional version of the prompt template.

public string Version { get; set; }

Property Value

string

Methods

GetInputText()

public override string GetInputText()

Returns

string

IsValid()

public override bool IsValid()

Returns

bool

ToModerationPrompt()

public ModerationPrompt ToModerationPrompt()

Returns

ModerationPrompt

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

Operators

implicit operator string(PromptTemplate)

public static implicit operator string(PromptTemplate prompt)

Parameters

prompt PromptTemplate

Returns

string