fromFile static method
Future<PromptTemplate>
fromFile(
- String templateFile, {
- PartialValues? partialVariables,
- bool validateTemplate = true,
Loads a prompt from a file.
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<PromptTemplate> fromFile(
final String templateFile, {
final PartialValues? partialVariables,
final bool validateTemplate = true,
}) async {
final file = XFile(templateFile);
final template = await file.readAsString();
return PromptTemplate.fromTemplate(
template,
partialVariables: partialVariables,
validateTemplate: validateTemplate,
);
}