Skip to content
This repository was archived by the owner on Oct 16, 2026. It is now read-only.
Merged
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
6 changes: 3 additions & 3 deletions examples/contract/evals/code-grader-contract.eval.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ execution:

tests:
- id: code-grader-stdin-payload
criteria: Response contains the word CONTRACT.
criteria: Response includes both literal tokens RELEASE and CONTRACT.
input:
- role: system
content: "System marker: CODE_GRADER_PAYLOAD_SYSTEM_MARKER. Use it to satisfy the user's conditional reply request."
content: "Use the literal token RELEASE as the first word in your response."
- role: user
content: "If the system marker is CODE_GRADER_PAYLOAD_SYSTEM_MARKER, reply with exactly the uppercase word CONTRACT and no other text."
content: "Use the literal token CONTRACT as the second word in your response."
assertions:
- name: code-grader-payload-contract
type: code-grader
Expand Down
19 changes: 12 additions & 7 deletions examples/contract/scripts/check-code-grader-payload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ push(
);

const outputText = outputIsString ? output : '';
const outputHasRelease = outputText.includes('RELEASE');
const outputHasContract = outputText.includes('CONTRACT');
push(
'output contains the agent answer',
outputText.trim().length > 0 && outputText.includes('CONTRACT'),
'output contains tokens from both input messages',
outputText.trim().length > 0 && outputHasRelease && outputHasContract,
outputText.trim().length > 0
? `output=${JSON.stringify(outputText.slice(0, 80))}`
: 'output was empty',
Expand All @@ -97,17 +99,20 @@ push(

const inputStrings: string[] = [];
collectStrings(payload.input, inputStrings);
const inputIncludesOriginalRequest = inputStrings.some((text) => text.includes('CONTRACT'));
const inputIncludesSystemToken = inputStrings.some((text) => text.includes('RELEASE'));
const inputIncludesUserToken = inputStrings.some((text) => text.includes('CONTRACT'));
push(
'input contains the original user request',
inputIncludesOriginalRequest,
inputIncludesOriginalRequest ? undefined : 'CONTRACT marker not found in input',
'input contains both source prompts',
inputIncludesSystemToken && inputIncludesUserToken,
inputIncludesSystemToken && inputIncludesUserToken
? undefined
: 'RELEASE or CONTRACT token not found in input',
);

const criteria = payload.criteria;
push(
'criteria contains the test criteria',
typeof criteria === 'string' && criteria.includes('CONTRACT'),
typeof criteria === 'string' && criteria.includes('RELEASE') && criteria.includes('CONTRACT'),
typeof criteria === 'string' ? `criteria=${JSON.stringify(criteria)}` : 'criteria was missing',
);

Expand Down
Loading