Principle:Promptfoo Promptfoo Configuration Rendering
| Knowledge Sources | |
|---|---|
| Domains | Templating, Developer_Experience |
| Last Updated | 2026-02-14 08:00 GMT |
Overview
A template rendering mechanism that generates YAML configuration files from user selections using Nunjucks templating.
Description
Configuration Rendering converts user selections (use case, language, providers) into a valid promptfooconfig.yaml file using Nunjucks template rendering. The CONFIG_TEMPLATE defines the YAML structure with conditional blocks for different use cases (comparison prompts, RAG context, agent tools, red team plugins).
This principle ensures that generated configs are always valid and follow best practices, even for complex multi-provider setups.
Usage
Use this principle when generating config files from templates. This is the final step of project initialization, producing the YAML config that drives all subsequent evaluations.
Theoretical Basis
Pseudo-code Logic:
1. Load CONFIG_TEMPLATE (Nunjucks YAML template)
2. Prepare template variables: { prompts, providers, type, language }
3. Render template with getNunjucksEngine().renderString()
4. Write rendered YAML to promptfooconfig.yaml
5. Wrap in initializeProject() for telemetry and UX