Class ChatMLPromptTemplate
PromptTemplate for generating ChatML messages
Inheritance
object
ChatMLPromptTemplate
Implements
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 SourceChatMLPromptTemplate(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 |
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 SourceInputVariables
A list of the names of the variables the prompt template expects.
Declaration
public IList<string> InputVariables { get; }
Property Value
Type | Description |
---|---|
IList<string> |
Messages
List of ChatMessageTemplate
Declaration
public IList<ChatMessageTemplate> Messages { get; }
Property Value
Type | Description |
---|---|
IList<ChatMessageTemplate> |
Methods
| Improve this Doc View SourceAddPriorResponse(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 |
AddSystemMessage(string)
Add system message
Declaration
public ChatMLPromptTemplate AddSystemMessage(string systemMessage)
Parameters
Type | Name | Description |
---|---|---|
string | systemMessage |
Returns
Type | Description |
---|---|
ChatMLPromptTemplate |
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. |