feat(p7): FakeInference deterministic provider + golden eval registry
Task 7.2: FakeInference implements the InferencePort with keyword vocabulary mirroring the P6 RuleEngine; deterministic (no clock/random) so AI artifacts are replayable. Golden fixtures (AI_GOLDEN) + inference.spec.ts assert byte-identical replay, abstention, and Scenario-7 (EVENT never exceeds DISCUSSION certainty). Controls: abstain()/deny()/setCost(). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import type { AiJobType } from '@insignia/iios-contracts';
|
||||
|
||||
/**
|
||||
* The golden prompt/eval registry for the deterministic AI provider (P7). Each row
|
||||
* is an input + the invariant the eval asserts. This is the offline eval set the
|
||||
* atlas requires; it also pins the abstention / Scenario-7 behaviour.
|
||||
*/
|
||||
export interface AiGoldenCase {
|
||||
name: string;
|
||||
jobType: AiJobType;
|
||||
text: string;
|
||||
expect: {
|
||||
artifactType: string;
|
||||
claimTypes: string[];
|
||||
abstained: boolean;
|
||||
/** For EXTRACT event cases: the certainty must never exceed DISCUSSION (Scenario 7). */
|
||||
maxCertainty?: string;
|
||||
};
|
||||
}
|
||||
|
||||
export const AI_GOLDEN: AiGoldenCase[] = [
|
||||
{
|
||||
name: 'classify after-hours party',
|
||||
jobType: 'CLASSIFY',
|
||||
text: 'There is a party at 9 PM tonight!',
|
||||
expect: { artifactType: 'CLASSIFICATION', claimTypes: ['MODERATION_FLAG'], abstained: false },
|
||||
},
|
||||
{
|
||||
name: 'classify safe message',
|
||||
jobType: 'CLASSIFY',
|
||||
text: 'Community cleanup on Saturday morning.',
|
||||
expect: { artifactType: 'CLASSIFICATION', claimTypes: [], abstained: false },
|
||||
},
|
||||
{
|
||||
name: 'summarize',
|
||||
jobType: 'SUMMARIZE',
|
||||
text: 'The committee met today. We discussed the budget. Next steps to follow.',
|
||||
expect: { artifactType: 'SUMMARY', claimTypes: [], abstained: false },
|
||||
},
|
||||
{
|
||||
name: 'extract candidate event stays DISCUSSION',
|
||||
jobType: 'EXTRACT',
|
||||
text: 'Maybe we do a party at 9 PM?',
|
||||
expect: { artifactType: 'EXTRACTION', claimTypes: ['EVENT'], abstained: false, maxCertainty: 'DISCUSSION' },
|
||||
},
|
||||
{
|
||||
name: 'extract abstains when no claim',
|
||||
jobType: 'EXTRACT',
|
||||
text: 'Thanks everyone, appreciate it.',
|
||||
expect: { artifactType: 'EXTRACTION', claimTypes: [], abstained: true },
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user