Class PromptTemplate
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."
Inheritance
PromptTemplate
Assembly: Glitch9.AIDevKit.dll
Syntax
public sealed class PromptTemplate : PromptBase<string>, IPrompt, IValidatable, IEquatable<PromptBase>, IModeratable
Constructors
|
Edit this page
View Source
PromptTemplate()
Declaration
|
Edit this page
View Source
PromptTemplate(string, Dictionary<string, object>)
Declaration
public PromptTemplate(string template, Dictionary<string, object> variables)
Parameters
|
Edit this page
View Source
PromptTemplate(string, string, Dictionary<string, object>)
Declaration
public PromptTemplate(string version, string template, Dictionary<string, object> variables)
Parameters
Properties
|
Edit this page
View Source
Id
Required. The unique identifier of the prompt template to use.
Declaration
[JsonProperty("id")]
public string Id { get; set; }
Property Value
|
Edit this page
View Source
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.
Declaration
[JsonProperty("variables")]
public Dictionary<string, object> Variables { get; set; }
Property Value
|
Edit this page
View Source
Version
Optional. Optional version of the prompt template.
Declaration
[JsonProperty("version")]
public string Version { get; set; }
Property Value
Methods
|
Edit this page
View Source
GetPromptText()
Declaration
public override string GetPromptText()
Returns
Overrides
|
Edit this page
View Source
IsValid()
Declaration
public override bool IsValid()
Returns
Overrides
|
Edit this page
View Source
ToModerationPrompt()
Declaration
public ModerationPrompt ToModerationPrompt()
Returns
|
Edit this page
View Source
ToString()
Declaration
public override string ToString()
Returns
Overrides
Operators
|
Edit this page
View Source
implicit operator string(PromptTemplate)
Declaration
public static implicit operator string(PromptTemplate prompt)
Parameters
Returns
Implements
Extension Methods