fromTemplateFile static method

Future<SystemChatMessagePromptTemplate> fromTemplateFile(
  1. String templateFile, {
  2. PartialValues? partialVariables,
  3. bool validateTemplate = true,
})

Load a prompt from a file. It considers the prompt a SystemChatMessage.

  • 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<SystemChatMessagePromptTemplate> fromTemplateFile(
  final String templateFile, {
  final PartialValues? partialVariables,
  final bool validateTemplate = true,
}) async {
  final file = XFile(templateFile);
  final template = await file.readAsString();
  return SystemChatMessagePromptTemplate.fromTemplate(
    template,
    partialVariables: partialVariables,
    validateTemplate: validateTemplate,
  );
}