experiment(confidence-engine): expose reconstruction provider seam
This commit is contained in:
@@ -112,6 +112,35 @@ describe("normaliseAnalysisResponse", () => {
|
||||
});
|
||||
|
||||
describe("analyseScenario compatibility", () => {
|
||||
it("uses an injected reconstruction provider with the production prompt path", async () => {
|
||||
const injectedProvider = {
|
||||
generateReconstruction: vi.fn().mockResolvedValue({
|
||||
inputClassification: { primaryType: "other", classificationReason: "test", confidence: "low" },
|
||||
reconstruction: {
|
||||
summary: "summary", actors: [], systemsOrObjects: [], expectedStates: [], observedStates: [],
|
||||
differences: [], knownTransitions: [], unexplainedTransitions: [], contradictions: [],
|
||||
importantUnknowns: [], plausibleInterpretations: [],
|
||||
},
|
||||
evidence: [],
|
||||
nextQuestion: { id: "q1", question: "What next?", targets: [], reason: "test", expectedInformationValue: "low" },
|
||||
}),
|
||||
};
|
||||
const { analyseScenario } = await import("@/lib/analysis.js");
|
||||
|
||||
const result = await analyseScenario("Scenario text", {
|
||||
promptVersion: "v0.3",
|
||||
reconstructionProvider: injectedProvider,
|
||||
reconstructionModelName: "experiment-model",
|
||||
});
|
||||
|
||||
expect(result.success).toBe(true);
|
||||
expect(injectedProvider.generateReconstruction).toHaveBeenCalledWith(
|
||||
"prompt",
|
||||
"experiment-model",
|
||||
);
|
||||
expect(mockGenerateReconstruction).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("preserves an attempted provider API path on provider failure", async () => {
|
||||
const providerError = new Error("Provider failed");
|
||||
providerError.providerApiPath = "/api/chat";
|
||||
|
||||
Reference in New Issue
Block a user