Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion eval-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,29 @@ function isConcise(output) {
return wordCount >= 50 && wordCount <= 500;
}

module.exports = { hasCodeFormatting, explainsWhy, mentionsBestPractices, isConcise };
function hasPRDSections(output) {
const sections = [
'Vision',
'Goals',
'Personas',
'User Stories',
'Functional Requirements',
'Non-Functional Requirements',
'Metrics',
'Risks',
];

const missingSections = sections.filter(section => !output.includes(section));

const score = (sections.length - missingSections.length) / sections.length;

return {
pass: score >= 0.7,
score: score,
reason: missingSections.length === 0 ? 'All PRD sections present' : `Missing sections: ${missingSections.join(', ')}`,
}

return sections.every(section => output.includes(section));
}

module.exports = { hasCodeFormatting, explainsWhy, mentionsBestPractices, isConcise, hasPRDSections };
9 changes: 9 additions & 0 deletions trust-ai.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,13 @@ tests:
threshold: 0.7
metric: non-functional-requirements
weight: 1.50

- vars:
request: 'I want to extend an existing pomodoro app to ring with a customizable chime when the timer expires, and be able to change the chimes for the completion of a pomodoro, completion of rest, and indication when it is time for a long break.'
description: 'PRD Generation - Deterministic Scripts'
assert:
# PRD Sections
- type: javascript
value: file://eval-script.js:hasPRDSections

outputPath: trust-ai/results.html