Search Results for

    Show / Hide Table of Contents

    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
    object
    PromptBase
    PromptBase<string>
    PromptTemplate
    Implements
    IPrompt
    IValidatable
    IEquatable<PromptBase>
    IModeratable
    Inherited Members
    PromptBase<string>.Value
    PromptBase<string>.GetHashCode()
    PromptBase<string>.Equals(object)
    PromptBase<string>.Equals(PromptBase)
    PromptBase.Validate()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Glitch9.AIDevKit
    Assembly: Glitch9.AIDevKit.dll
    Syntax
    public sealed class PromptTemplate : PromptBase<string>, IPrompt, IValidatable, IEquatable<PromptBase>, IModeratable

    Constructors

    | Edit this page View Source

    PromptTemplate()

    Declaration
    public PromptTemplate()
    | Edit this page View Source

    PromptTemplate(string, Dictionary<string, object>)

    Declaration
    public PromptTemplate(string template, Dictionary<string, object> variables)
    Parameters
    Type Name Description
    string template
    Dictionary<string, object> variables
    | Edit this page View Source

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

    Declaration
    public PromptTemplate(string version, string template, Dictionary<string, object> variables)
    Parameters
    Type Name Description
    string version
    string template
    Dictionary<string, object> variables

    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
    Type Description
    string
    | 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
    Type Description
    Dictionary<string, object>
    | Edit this page View Source

    Version

    Optional. Optional version of the prompt template.

    Declaration
    [JsonProperty("version")]
    public string Version { get; set; }
    Property Value
    Type Description
    string

    Methods

    | Edit this page View Source

    GetPromptText()

    Declaration
    public override string GetPromptText()
    Returns
    Type Description
    string
    Overrides
    PromptBase.GetPromptText()
    | Edit this page View Source

    IsValid()

    Declaration
    public override bool IsValid()
    Returns
    Type Description
    bool
    Overrides
    PromptBase.IsValid()
    | Edit this page View Source

    ToModerationPrompt()

    Declaration
    public ModerationPrompt ToModerationPrompt()
    Returns
    Type Description
    ModerationPrompt
    | Edit this page View Source

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    object.ToString()

    Operators

    | Edit this page View Source

    implicit operator string(PromptTemplate)

    Declaration
    public static implicit operator string(PromptTemplate prompt)
    Parameters
    Type Name Description
    PromptTemplate prompt
    Returns
    Type Description
    string

    Implements

    IPrompt
    IValidatable
    IEquatable<T>
    IModeratable

    Extension Methods

    UnifiedApiCallerExtensions.GENModeration(IModeratable, IEnumerable<SafetySetting>)
    ArrayExtensions.ToArrayOrEmpty<T>(T)
    ArrayExtensions.ToArrayOrNull<T>(T)
    EventExtensions.ToDelta<T>(T, string, int, string, bool)
    EventExtensions.ToDone<T>(T, string, int, string)
    EventExtensions.ToEvent<T>(T)
    EventExtensions.UpcastDelta<T1, T2>(T1, string, int, string, bool)
    FallbackExtensions.IsOr<TParent, TChild>(TParent, TChild)
    ResponseCastingExtensions.GetResult<T>(T)
    SystemExtensions.GetName(object)
    • Edit this page
    • View Source
    In this article
    Back to top AI DevKit Documentation