private String loadPromptTemplate(LanguageModelFieldGeneratorConfig config) {
        if (config.promptTemplate() != null && !config.promptTemplate().isEmpty()) {
            return config.promptTemplate();
        }
        
        if (config.promptTemplateFile().isPresent()) {
            Path path = config.promptTemplateFile().get();

            try {
                String promptTemplate = new String(Files.readAllBytes(path));

                if (promptTemplate.isEmpty()) {
                    throw new IllegalArgumentException("Prompt template file is empty: " + path);
                }
                
                return promptTemplate;
            } catch (IOException e) {
                throw new IllegalArgumentException("Could not read prompt template file: " + path, e);
            }
        }

        return null;
    }
Component for generating field values with a language model.

@author glebashnik
model-integration/src/main/java/ai/vespa/llm/generation/LanguageModelFieldGenerator.java