Principle:Promptfoo Promptfoo Result Output
| Knowledge Sources | |
|---|---|
| Domains | Reporting, Evaluation |
| Last Updated | 2026-02-14 08:00 GMT |
Overview
A multi-format output mechanism that serializes evaluation results to CSV, JSON, YAML, HTML, or Google Sheets.
Description
Result Output is the final step of the evaluation pipeline, responsible for persisting evaluation results in user-specified formats. This is critical for both human review (HTML reports, CSV for spreadsheets) and machine consumption (JSON for CI/CD pipelines, YAML for config round-tripping).
The mechanism supports format detection from file extension, streaming for memory efficiency (especially for large CSV outputs), and integration with Google Sheets for collaborative review.
Usage
Use this principle whenever evaluation results need to be saved to disk or shared. This is triggered by the `-o` / `--output` CLI flag or programmatic calls to `writeOutput`.
Theoretical Basis
Pseudo-code Logic:
1. Detect output format from file extension or URL pattern
2. If Google Sheets URL → convert to CSV rows, write via Sheets API
3. Else based on extension:
a. .csv → stream eval results as CSV with headers
b. .json → serialize full Eval record as JSON
c. .yaml/.yml → serialize as YAML
d. .html → generate standalone HTML report
e. .jsonl → one JSON line per result
f. .txt → generate ASCII table
4. Create output directory if needed
5. Write file to disk