fromTemplateFile static method
Future<CustomChatMessagePromptTemplate>
fromTemplateFile(
- String templateFile, {
- required String role,
- PartialValues? partialVariables,
- bool validateTemplate = true,
Load a prompt from a file. It considers the prompt a CustomChatMessage.
templateFile
the path to the file containing the prompt template.partialVariables
the partial variables to use for the template.validateTemplate
whether to validate the template.
Implementation
static Future<CustomChatMessagePromptTemplate> fromTemplateFile(
final String templateFile, {
required final String role,
final PartialValues? partialVariables,
final bool validateTemplate = true,
}) async {
final file = XFile(templateFile);
final template = await file.readAsString();
return CustomChatMessagePromptTemplate.fromTemplate(
template,
role: role,
partialVariables: partialVariables,
validateTemplate: validateTemplate,
);
}