ChatMessagePromptTemplate.custom constructor
ChatMessagePromptTemplate.custom(
- String template, {
- required String role,
- PartialValues? partialVariables,
- bool validateTemplate = true,
Creates a CustomChatMessagePromptTemplate from a string template.
This is a convenience factory equivalent to CustomChatMessagePromptTemplate.fromTemplate.
Example:
final msgTemplate = ChatMessagePromptTemplate.custom(
"I'm an assistant. I'm {foo}. I'm {bar}.",
role: 'assistant',
);
template
the template string.role
the role of the message.partialVariables
the partial variables to use for the template.validateTemplate
whether to validate the template.
Implementation
factory ChatMessagePromptTemplate.custom(
final String template, {
required final String role,
final PartialValues? partialVariables,
final bool validateTemplate = true,
}) {
return CustomChatMessagePromptTemplate.fromTemplate(
template,
role: role,
partialVariables: partialVariables,
validateTemplate: validateTemplate,
);
}