Search Results for

    Show / Hide Table of Contents

    Class ChatMLPromptTemplate

    PromptTemplate for generating ChatML messages

    Inheritance
    object
    ChatMLPromptTemplate
    Implements
    IPromptTemplate
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: DotnetPrompt.Prompts
    Assembly: DotnetPrompt.dll
    Syntax
    public class ChatMLPromptTemplate : IPromptTemplate

    Constructors

    | Improve this Doc View Source

    ChatMLPromptTemplate(IPromptTemplate, string?, IList<(string userMessage, string assistantMessage)>?)

    ctor

    Declaration
    public ChatMLPromptTemplate(IPromptTemplate content, string? system = null, IList<(string userMessage, string assistantMessage)>? priorMessages = null)
    Parameters
    Type Name Description
    IPromptTemplate content

    PromptTemplate for content string

    string system

    System string

    IList<(string userMessage, string assistantMessage)> priorMessages
    | Improve this Doc View Source

    ChatMLPromptTemplate(string, string?, IList<(string userMessage, string assistantMessage)>?)

    ctor

    Declaration
    public ChatMLPromptTemplate(string content, string? system = null, IList<(string userMessage, string assistantMessage)>? priorMessages = null)
    Parameters
    Type Name Description
    string content

    Content string

    string system

    System string

    IList<(string userMessage, string assistantMessage)> priorMessages

    Properties

    | Improve this Doc View Source

    InputVariables

    A list of the names of the variables the prompt template expects.

    Declaration
    public IList<string> InputVariables { get; }
    Property Value
    Type Description
    IList<string>
    | Improve this Doc View Source

    Messages

    List of ChatMessageTemplate

    Declaration
    public IList<ChatMessageTemplate> Messages { get; }
    Property Value
    Type Description
    IList<ChatMessageTemplate>

    Methods

    | Improve this Doc View Source

    AddPriorResponse(string, string)

    Add prior response pair

    Declaration
    public ChatMLPromptTemplate AddPriorResponse(string userMessage, string assistantMessage)
    Parameters
    Type Name Description
    string userMessage
    string assistantMessage
    Returns
    Type Description
    ChatMLPromptTemplate
    | Improve this Doc View Source

    AddSystemMessage(string)

    Add system message

    Declaration
    public ChatMLPromptTemplate AddSystemMessage(string systemMessage)
    Parameters
    Type Name Description
    string systemMessage
    Returns
    Type Description
    ChatMLPromptTemplate
    | Improve this Doc View Source

    Format(IDictionary<string, string>?)

    Build a prompt from current template and a list of values.

    Declaration
    public string Format(IDictionary<string, string>? values = null)
    Parameters
    Type Name Description
    IDictionary<string, string> values

    Key-Value list of values to use to build prompt.

    Returns
    Type Description
    string

    String prompt

    Exceptions
    Type Condition
    System.ArgumentException

    Throws when provided list of keys does not match InputVariables.

    Implements

    IPromptTemplate
    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright 2023 © Pavel «xakpc» Osadchuk for DotnetPrompt