@carlonicora/nestjs-neo4jsonapi 2.14.10 → 2.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/contextualiser/contexts/contextualiser.context.d.ts +41 -0
- package/dist/agents/contextualiser/contexts/contextualiser.context.d.ts.map +1 -1
- package/dist/agents/contextualiser/contexts/contextualiser.context.js +17 -0
- package/dist/agents/contextualiser/contexts/contextualiser.context.js.map +1 -1
- package/dist/agents/contextualiser/contexts/notebook.context.d.ts +22 -0
- package/dist/agents/contextualiser/contexts/notebook.context.d.ts.map +1 -1
- package/dist/agents/contextualiser/contexts/notebook.context.js +14 -0
- package/dist/agents/contextualiser/contexts/notebook.context.js.map +1 -1
- package/dist/agents/contextualiser/factories/contextualiser.context.factory.d.ts.map +1 -1
- package/dist/agents/contextualiser/factories/contextualiser.context.factory.js +2 -0
- package/dist/agents/contextualiser/factories/contextualiser.context.factory.js.map +1 -1
- package/dist/agents/contextualiser/nodes/atomicfacts.node.service.d.ts.map +1 -1
- package/dist/agents/contextualiser/nodes/atomicfacts.node.service.js +17 -5
- package/dist/agents/contextualiser/nodes/atomicfacts.node.service.js.map +1 -1
- package/dist/agents/contextualiser/nodes/chunk.node.service.d.ts +1 -14
- package/dist/agents/contextualiser/nodes/chunk.node.service.d.ts.map +1 -1
- package/dist/agents/contextualiser/nodes/chunk.node.service.js +56 -206
- package/dist/agents/contextualiser/nodes/chunk.node.service.js.map +1 -1
- package/dist/agents/contextualiser/nodes/chunk.vector.node.service.d.ts +3 -12
- package/dist/agents/contextualiser/nodes/chunk.vector.node.service.d.ts.map +1 -1
- package/dist/agents/contextualiser/nodes/chunk.vector.node.service.js +44 -133
- package/dist/agents/contextualiser/nodes/chunk.vector.node.service.js.map +1 -1
- package/dist/agents/contextualiser/nodes/keyconcepts.node.service.d.ts +1 -2
- package/dist/agents/contextualiser/nodes/keyconcepts.node.service.d.ts.map +1 -1
- package/dist/agents/contextualiser/nodes/keyconcepts.node.service.js +60 -60
- package/dist/agents/contextualiser/nodes/keyconcepts.node.service.js.map +1 -1
- package/dist/agents/contextualiser/nodes/question.refiner.node.service.d.ts.map +1 -1
- package/dist/agents/contextualiser/nodes/question.refiner.node.service.js +7 -2
- package/dist/agents/contextualiser/nodes/question.refiner.node.service.js.map +1 -1
- package/dist/agents/contextualiser/nodes/rational.node.service.js +2 -1
- package/dist/agents/contextualiser/nodes/rational.node.service.js.map +1 -1
- package/dist/agents/contextualiser/services/contextualiser.service.d.ts.map +1 -1
- package/dist/agents/contextualiser/services/contextualiser.service.js +30 -22
- package/dist/agents/contextualiser/services/contextualiser.service.js.map +1 -1
- package/dist/agents/prompts/index.d.ts +0 -2
- package/dist/agents/prompts/index.d.ts.map +1 -1
- package/dist/agents/prompts/index.js +7 -5
- package/dist/agents/prompts/index.js.map +1 -1
- package/dist/agents/responder/contexts/responder.context.d.ts +96 -0
- package/dist/agents/responder/contexts/responder.context.d.ts.map +1 -1
- package/dist/agents/responder/interfaces/unified.trace.interface.d.ts +9 -0
- package/dist/agents/responder/interfaces/unified.trace.interface.d.ts.map +1 -1
- package/dist/agents/responder/nodes/__tests__/helpers/answer-node.harness.d.ts +38 -0
- package/dist/agents/responder/nodes/__tests__/helpers/answer-node.harness.d.ts.map +1 -0
- package/dist/agents/responder/nodes/__tests__/helpers/answer-node.harness.js +36 -0
- package/dist/agents/responder/nodes/__tests__/helpers/answer-node.harness.js.map +1 -0
- package/dist/agents/responder/nodes/graph.node.service.d.ts.map +1 -1
- package/dist/agents/responder/nodes/graph.node.service.js +18 -3
- package/dist/agents/responder/nodes/graph.node.service.js.map +1 -1
- package/dist/agents/responder/nodes/planner.node.service.d.ts.map +1 -1
- package/dist/agents/responder/nodes/planner.node.service.js +9 -0
- package/dist/agents/responder/nodes/planner.node.service.js.map +1 -1
- package/dist/agents/responder/nodes/responder.answer.node.service.d.ts +26 -1
- package/dist/agents/responder/nodes/responder.answer.node.service.d.ts.map +1 -1
- package/dist/agents/responder/nodes/responder.answer.node.service.js +127 -13
- package/dist/agents/responder/nodes/responder.answer.node.service.js.map +1 -1
- package/dist/agents/responder/services/responder.service.d.ts.map +1 -1
- package/dist/agents/responder/services/responder.service.js +4 -0
- package/dist/agents/responder/services/responder.service.js.map +1 -1
- package/dist/common/utils/settled.d.ts +33 -0
- package/dist/common/utils/settled.d.ts.map +1 -0
- package/dist/common/utils/settled.js +66 -0
- package/dist/common/utils/settled.js.map +1 -0
- package/dist/config/interfaces/config.prompts.interface.d.ts +12 -0
- package/dist/config/interfaces/config.prompts.interface.d.ts.map +1 -1
- package/dist/core/llm/services/model.service.d.ts.map +1 -1
- package/dist/core/llm/services/model.service.js +5 -2
- package/dist/core/llm/services/model.service.js.map +1 -1
- package/dist/core/llm/services/reasoning-content-fetch.d.ts +41 -0
- package/dist/core/llm/services/reasoning-content-fetch.d.ts.map +1 -0
- package/dist/core/llm/services/reasoning-content-fetch.js +143 -0
- package/dist/core/llm/services/reasoning-content-fetch.js.map +1 -0
- package/dist/eval/retrieval/end-to-end-sweep.service.d.ts +52 -0
- package/dist/eval/retrieval/end-to-end-sweep.service.d.ts.map +1 -0
- package/dist/eval/retrieval/end-to-end-sweep.service.js +194 -0
- package/dist/eval/retrieval/end-to-end-sweep.service.js.map +1 -0
- package/dist/eval/retrieval/evidence.matcher.d.ts +23 -0
- package/dist/eval/retrieval/evidence.matcher.d.ts.map +1 -0
- package/dist/eval/retrieval/evidence.matcher.js +38 -0
- package/dist/eval/retrieval/evidence.matcher.js.map +1 -0
- package/dist/eval/retrieval/index.d.ts +10 -0
- package/dist/eval/retrieval/index.d.ts.map +1 -0
- package/dist/eval/retrieval/index.js +35 -0
- package/dist/eval/retrieval/index.js.map +1 -0
- package/dist/eval/retrieval/question-set.loader.d.ts +16 -0
- package/dist/eval/retrieval/question-set.loader.d.ts.map +1 -0
- package/dist/eval/retrieval/question-set.loader.js +73 -0
- package/dist/eval/retrieval/question-set.loader.js.map +1 -0
- package/dist/eval/retrieval/retrieval-eval.module.d.ts +14 -0
- package/dist/eval/retrieval/retrieval-eval.module.d.ts.map +1 -0
- package/dist/eval/retrieval/retrieval-eval.module.js +48 -0
- package/dist/eval/retrieval/retrieval-eval.module.js.map +1 -0
- package/dist/eval/retrieval/retrieval-eval.types.d.ts +84 -0
- package/dist/eval/retrieval/retrieval-eval.types.d.ts.map +1 -0
- package/dist/eval/retrieval/retrieval-eval.types.js +25 -0
- package/dist/eval/retrieval/retrieval-eval.types.js.map +1 -0
- package/dist/eval/retrieval/retrieval-sweep.service.d.ts +35 -0
- package/dist/eval/retrieval/retrieval-sweep.service.d.ts.map +1 -0
- package/dist/eval/retrieval/retrieval-sweep.service.js +93 -0
- package/dist/eval/retrieval/retrieval-sweep.service.js.map +1 -0
- package/dist/eval/retrieval/rubric-judge.service.d.ts +30 -0
- package/dist/eval/retrieval/rubric-judge.service.d.ts.map +1 -0
- package/dist/eval/retrieval/rubric-judge.service.js +138 -0
- package/dist/eval/retrieval/rubric-judge.service.js.map +1 -0
- package/dist/eval/retrieval/sweep-report.d.ts +11 -0
- package/dist/eval/retrieval/sweep-report.d.ts.map +1 -0
- package/dist/eval/retrieval/sweep-report.js +79 -0
- package/dist/eval/retrieval/sweep-report.js.map +1 -0
- package/dist/eval/retrieval/token-accounting.check.d.ts +39 -0
- package/dist/eval/retrieval/token-accounting.check.d.ts.map +1 -0
- package/dist/eval/retrieval/token-accounting.check.js +75 -0
- package/dist/eval/retrieval/token-accounting.check.js.map +1 -0
- package/dist/foundations/atomicfact/repositories/atomicfact.repository.d.ts.map +1 -1
- package/dist/foundations/atomicfact/repositories/atomicfact.repository.js +7 -0
- package/dist/foundations/atomicfact/repositories/atomicfact.repository.js.map +1 -1
- package/dist/foundations/chunk/repositories/chunk.repository.d.ts +87 -1
- package/dist/foundations/chunk/repositories/chunk.repository.d.ts.map +1 -1
- package/dist/foundations/chunk/repositories/chunk.repository.js +239 -50
- package/dist/foundations/chunk/repositories/chunk.repository.js.map +1 -1
- package/dist/foundations/chunk/repositories/retrieval.constants.d.ts +69 -0
- package/dist/foundations/chunk/repositories/retrieval.constants.d.ts.map +1 -0
- package/dist/foundations/chunk/repositories/retrieval.constants.js +72 -0
- package/dist/foundations/chunk/repositories/retrieval.constants.js.map +1 -0
- package/dist/foundations/keyconcept/repositories/keyconcept.repository.d.ts +2 -0
- package/dist/foundations/keyconcept/repositories/keyconcept.repository.d.ts.map +1 -1
- package/dist/foundations/keyconcept/repositories/keyconcept.repository.js +9 -5
- package/dist/foundations/keyconcept/repositories/keyconcept.repository.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evidence.matcher.js","sourceRoot":"","sources":["../../../src/eval/retrieval/evidence.matcher.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAE5C;;;;;;;GAOG;AAEI,IAAM,eAAe,GAArB,MAAM,eAAe;IAClB,SAAS,CAAC,KAAa;QAC7B,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACzD,CAAC;IAED,OAAO,CAAC,MAA6C;QACnD,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC9C,IAAI,MAAM,KAAK,EAAE;YAAE,OAAO,KAAK,CAAC;QAChC,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1D,CAAC;IAED,KAAK,CAAC,MAAgD;QACpD,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;QAC3G,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;IACrE,CAAC;CACF,CAAA;AAfY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;GACA,eAAe,CAe3B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./retrieval-eval.types";
|
|
2
|
+
export { QuestionSetLoader } from "./question-set.loader";
|
|
3
|
+
export { EvidenceMatcher } from "./evidence.matcher";
|
|
4
|
+
export { RetrievalSweepService } from "./retrieval-sweep.service";
|
|
5
|
+
export { EndToEndSweepService } from "./end-to-end-sweep.service";
|
|
6
|
+
export { RubricJudgeService } from "./rubric-judge.service";
|
|
7
|
+
export { TokenAccountingChecker } from "./token-accounting.check";
|
|
8
|
+
export { renderSweepReport } from "./sweep-report";
|
|
9
|
+
export { RetrievalEvalModule } from "./retrieval-eval.module";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/eval/retrieval/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.RetrievalEvalModule = exports.renderSweepReport = exports.TokenAccountingChecker = exports.RubricJudgeService = exports.EndToEndSweepService = exports.RetrievalSweepService = exports.EvidenceMatcher = exports.QuestionSetLoader = void 0;
|
|
18
|
+
__exportStar(require("./retrieval-eval.types"), exports);
|
|
19
|
+
var question_set_loader_1 = require("./question-set.loader");
|
|
20
|
+
Object.defineProperty(exports, "QuestionSetLoader", { enumerable: true, get: function () { return question_set_loader_1.QuestionSetLoader; } });
|
|
21
|
+
var evidence_matcher_1 = require("./evidence.matcher");
|
|
22
|
+
Object.defineProperty(exports, "EvidenceMatcher", { enumerable: true, get: function () { return evidence_matcher_1.EvidenceMatcher; } });
|
|
23
|
+
var retrieval_sweep_service_1 = require("./retrieval-sweep.service");
|
|
24
|
+
Object.defineProperty(exports, "RetrievalSweepService", { enumerable: true, get: function () { return retrieval_sweep_service_1.RetrievalSweepService; } });
|
|
25
|
+
var end_to_end_sweep_service_1 = require("./end-to-end-sweep.service");
|
|
26
|
+
Object.defineProperty(exports, "EndToEndSweepService", { enumerable: true, get: function () { return end_to_end_sweep_service_1.EndToEndSweepService; } });
|
|
27
|
+
var rubric_judge_service_1 = require("./rubric-judge.service");
|
|
28
|
+
Object.defineProperty(exports, "RubricJudgeService", { enumerable: true, get: function () { return rubric_judge_service_1.RubricJudgeService; } });
|
|
29
|
+
var token_accounting_check_1 = require("./token-accounting.check");
|
|
30
|
+
Object.defineProperty(exports, "TokenAccountingChecker", { enumerable: true, get: function () { return token_accounting_check_1.TokenAccountingChecker; } });
|
|
31
|
+
var sweep_report_1 = require("./sweep-report");
|
|
32
|
+
Object.defineProperty(exports, "renderSweepReport", { enumerable: true, get: function () { return sweep_report_1.renderSweepReport; } });
|
|
33
|
+
var retrieval_eval_module_1 = require("./retrieval-eval.module");
|
|
34
|
+
Object.defineProperty(exports, "RetrievalEvalModule", { enumerable: true, get: function () { return retrieval_eval_module_1.RetrievalEvalModule; } });
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/eval/retrieval/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,6DAA0D;AAAjD,wHAAA,iBAAiB,OAAA;AAC1B,uDAAqD;AAA5C,mHAAA,eAAe,OAAA;AACxB,qEAAkE;AAAzD,gIAAA,qBAAqB,OAAA;AAC9B,uEAAkE;AAAzD,gIAAA,oBAAoB,OAAA;AAC7B,+DAA4D;AAAnD,0HAAA,kBAAkB,OAAA;AAC3B,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAC/B,+CAAmD;AAA1C,iHAAA,iBAAiB,OAAA;AAC1B,iEAA8D;AAArD,4HAAA,mBAAmB,OAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EvalQuestionSet } from "./retrieval-eval.types";
|
|
2
|
+
/**
|
|
3
|
+
* Reads a question set from YAML and validates it.
|
|
4
|
+
*
|
|
5
|
+
* Fails loudly and specifically: a malformed ground truth that loads anyway
|
|
6
|
+
* would silently weaken every later comparison, which is the opposite of what
|
|
7
|
+
* this harness exists for.
|
|
8
|
+
*
|
|
9
|
+
* Mirrors the YAML-loading style of `core/model-manager/model-loader.ts`.
|
|
10
|
+
*/
|
|
11
|
+
export declare class QuestionSetLoader {
|
|
12
|
+
load(params: {
|
|
13
|
+
path: string;
|
|
14
|
+
}): EvalQuestionSet;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=question-set.loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question-set.loader.d.ts","sourceRoot":"","sources":["../../../src/eval/retrieval/question-set.loader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAyB,MAAM,wBAAwB,CAAC;AAEhF;;;;;;;;GAQG;AACH,qBACa,iBAAiB;IAC5B,IAAI,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,eAAe;CAWhD"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.QuestionSetLoader = void 0;
|
|
43
|
+
const common_1 = require("@nestjs/common");
|
|
44
|
+
const fs_1 = require("fs");
|
|
45
|
+
const yaml = __importStar(require("js-yaml"));
|
|
46
|
+
const retrieval_eval_types_1 = require("./retrieval-eval.types");
|
|
47
|
+
/**
|
|
48
|
+
* Reads a question set from YAML and validates it.
|
|
49
|
+
*
|
|
50
|
+
* Fails loudly and specifically: a malformed ground truth that loads anyway
|
|
51
|
+
* would silently weaken every later comparison, which is the opposite of what
|
|
52
|
+
* this harness exists for.
|
|
53
|
+
*
|
|
54
|
+
* Mirrors the YAML-loading style of `core/model-manager/model-loader.ts`.
|
|
55
|
+
*/
|
|
56
|
+
let QuestionSetLoader = class QuestionSetLoader {
|
|
57
|
+
load(params) {
|
|
58
|
+
const raw = yaml.load((0, fs_1.readFileSync)(params.path, "utf8"));
|
|
59
|
+
const parsed = retrieval_eval_types_1.evalQuestionSetSchema.safeParse(raw);
|
|
60
|
+
if (!parsed.success) {
|
|
61
|
+
const issues = parsed.error.issues
|
|
62
|
+
.map((issue) => `${issue.path.join(".") || "<root>"}: ${issue.message}`)
|
|
63
|
+
.join("; ");
|
|
64
|
+
throw new Error(`Invalid question set at ${params.path} — ${issues}`);
|
|
65
|
+
}
|
|
66
|
+
return parsed.data;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
exports.QuestionSetLoader = QuestionSetLoader;
|
|
70
|
+
exports.QuestionSetLoader = QuestionSetLoader = __decorate([
|
|
71
|
+
(0, common_1.Injectable)()
|
|
72
|
+
], QuestionSetLoader);
|
|
73
|
+
//# sourceMappingURL=question-set.loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question-set.loader.js","sourceRoot":"","sources":["../../../src/eval/retrieval/question-set.loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,2BAAkC;AAClC,8CAAgC;AAChC,iEAAgF;AAEhF;;;;;;;;GAQG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAC5B,IAAI,CAAC,MAAwB;QAC3B,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,IAAA,iBAAY,EAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QACzD,MAAM,MAAM,GAAG,4CAAqB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QACpD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM;iBAC/B,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,QAAQ,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;iBACvE,IAAI,CAAC,IAAI,CAAC,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,2BAA2B,MAAM,CAAC,IAAI,MAAM,MAAM,EAAE,CAAC,CAAC;QACxE,CAAC;QACD,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;CACF,CAAA;AAZY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;GACA,iBAAiB,CAY7B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evaluation tooling. NOT imported by AgentsModule or by bootstrap — a product
|
|
3
|
+
* that never runs a sweep must not pay for this module's dependency graph.
|
|
4
|
+
* Import it explicitly from a sweep entrypoint.
|
|
5
|
+
*
|
|
6
|
+
* The three imports carry exactly the providers this module's services inject:
|
|
7
|
+
* `LLMModule` exports `LLMService` (RubricJudgeService), `ChunkModule` exports
|
|
8
|
+
* `ChunkRepository` (RetrievalSweepService) and `ResponderModule` exports
|
|
9
|
+
* `ResponderService` (EndToEndSweepService). `TokenAccountingChecker`,
|
|
10
|
+
* `EvidenceMatcher` and `QuestionSetLoader` have no injected dependencies.
|
|
11
|
+
*/
|
|
12
|
+
export declare class RetrievalEvalModule {
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=retrieval-eval.module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retrieval-eval.module.d.ts","sourceRoot":"","sources":["../../../src/eval/retrieval/retrieval-eval.module.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;GAUG;AACH,qBAYa,mBAAmB;CAAG"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.RetrievalEvalModule = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const responder_module_1 = require("../../agents/responder/responder.module");
|
|
12
|
+
const llm_module_1 = require("../../core/llm/llm.module");
|
|
13
|
+
const chunk_module_1 = require("../../foundations/chunk/chunk.module");
|
|
14
|
+
const end_to_end_sweep_service_1 = require("./end-to-end-sweep.service");
|
|
15
|
+
const evidence_matcher_1 = require("./evidence.matcher");
|
|
16
|
+
const question_set_loader_1 = require("./question-set.loader");
|
|
17
|
+
const retrieval_sweep_service_1 = require("./retrieval-sweep.service");
|
|
18
|
+
const rubric_judge_service_1 = require("./rubric-judge.service");
|
|
19
|
+
const token_accounting_check_1 = require("./token-accounting.check");
|
|
20
|
+
/**
|
|
21
|
+
* Evaluation tooling. NOT imported by AgentsModule or by bootstrap — a product
|
|
22
|
+
* that never runs a sweep must not pay for this module's dependency graph.
|
|
23
|
+
* Import it explicitly from a sweep entrypoint.
|
|
24
|
+
*
|
|
25
|
+
* The three imports carry exactly the providers this module's services inject:
|
|
26
|
+
* `LLMModule` exports `LLMService` (RubricJudgeService), `ChunkModule` exports
|
|
27
|
+
* `ChunkRepository` (RetrievalSweepService) and `ResponderModule` exports
|
|
28
|
+
* `ResponderService` (EndToEndSweepService). `TokenAccountingChecker`,
|
|
29
|
+
* `EvidenceMatcher` and `QuestionSetLoader` have no injected dependencies.
|
|
30
|
+
*/
|
|
31
|
+
let RetrievalEvalModule = class RetrievalEvalModule {
|
|
32
|
+
};
|
|
33
|
+
exports.RetrievalEvalModule = RetrievalEvalModule;
|
|
34
|
+
exports.RetrievalEvalModule = RetrievalEvalModule = __decorate([
|
|
35
|
+
(0, common_1.Module)({
|
|
36
|
+
imports: [llm_module_1.LLMModule, chunk_module_1.ChunkModule, responder_module_1.ResponderModule],
|
|
37
|
+
providers: [
|
|
38
|
+
question_set_loader_1.QuestionSetLoader,
|
|
39
|
+
evidence_matcher_1.EvidenceMatcher,
|
|
40
|
+
retrieval_sweep_service_1.RetrievalSweepService,
|
|
41
|
+
end_to_end_sweep_service_1.EndToEndSweepService,
|
|
42
|
+
rubric_judge_service_1.RubricJudgeService,
|
|
43
|
+
token_accounting_check_1.TokenAccountingChecker,
|
|
44
|
+
],
|
|
45
|
+
exports: [question_set_loader_1.QuestionSetLoader, retrieval_sweep_service_1.RetrievalSweepService, end_to_end_sweep_service_1.EndToEndSweepService],
|
|
46
|
+
})
|
|
47
|
+
], RetrievalEvalModule);
|
|
48
|
+
//# sourceMappingURL=retrieval-eval.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retrieval-eval.module.js","sourceRoot":"","sources":["../../../src/eval/retrieval/retrieval-eval.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,8EAA0E;AAC1E,0DAAsD;AACtD,uEAAmE;AACnE,yEAAkE;AAClE,yDAAqD;AACrD,+DAA0D;AAC1D,uEAAkE;AAClE,iEAA4D;AAC5D,qEAAkE;AAElE;;;;;;;;;;GAUG;AAaI,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;CAAG,CAAA;AAAtB,kDAAmB;8BAAnB,mBAAmB;IAZ/B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,sBAAS,EAAE,0BAAW,EAAE,kCAAe,CAAC;QAClD,SAAS,EAAE;YACT,uCAAiB;YACjB,kCAAe;YACf,+CAAqB;YACrB,+CAAoB;YACpB,yCAAkB;YAClB,+CAAsB;SACvB;QACD,OAAO,EAAE,CAAC,uCAAiB,EAAE,+CAAqB,EAAE,+CAAoB,CAAC;KAC1E,CAAC;GACW,mBAAmB,CAAG"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** One question with its ground truth. Authored per repo, corrected by the owner. */
|
|
3
|
+
export declare const evalQuestionSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
corpus: z.ZodString;
|
|
6
|
+
question: z.ZodString;
|
|
7
|
+
mustRetrieve: z.ZodArray<z.ZodString>;
|
|
8
|
+
rubric: z.ZodString;
|
|
9
|
+
scopeId: z.ZodOptional<z.ZodString>;
|
|
10
|
+
scopeType: z.ZodOptional<z.ZodString>;
|
|
11
|
+
scopeLabel: z.ZodOptional<z.ZodString>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export type EvalQuestion = z.infer<typeof evalQuestionSchema>;
|
|
14
|
+
export declare const evalQuestionSetSchema: z.ZodObject<{
|
|
15
|
+
version: z.ZodLiteral<1>;
|
|
16
|
+
product: z.ZodString;
|
|
17
|
+
questions: z.ZodArray<z.ZodObject<{
|
|
18
|
+
id: z.ZodString;
|
|
19
|
+
corpus: z.ZodString;
|
|
20
|
+
question: z.ZodString;
|
|
21
|
+
mustRetrieve: z.ZodArray<z.ZodString>;
|
|
22
|
+
rubric: z.ZodString;
|
|
23
|
+
scopeId: z.ZodOptional<z.ZodString>;
|
|
24
|
+
scopeType: z.ZodOptional<z.ZodString>;
|
|
25
|
+
scopeLabel: z.ZodOptional<z.ZodString>;
|
|
26
|
+
}, z.core.$strip>>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
export type EvalQuestionSet = z.infer<typeof evalQuestionSetSchema>;
|
|
29
|
+
/** Why a question failed its rubric. Closed set — see spec §6.5. */
|
|
30
|
+
export type RubricFailureMode = "evidence-not-retrieved" | "retrieved-but-unused" | "contradicted-source" | "hedged-without-answering";
|
|
31
|
+
export interface RubricVerdict {
|
|
32
|
+
passed: boolean;
|
|
33
|
+
failureMode?: RubricFailureMode;
|
|
34
|
+
explanation: string;
|
|
35
|
+
}
|
|
36
|
+
/** One question's result in retrieval-only mode. */
|
|
37
|
+
export interface RetrievalSweepResult {
|
|
38
|
+
questionId: string;
|
|
39
|
+
evidenceRetrieved: number;
|
|
40
|
+
missingSnippets: string[];
|
|
41
|
+
chunksRead: number;
|
|
42
|
+
retrievalMs: number;
|
|
43
|
+
error?: string;
|
|
44
|
+
}
|
|
45
|
+
/** One question's result in end-to-end mode. Extends the retrieval facts with answer facts. */
|
|
46
|
+
export interface EndToEndSweepResult extends RetrievalSweepResult {
|
|
47
|
+
evidenceCited: number;
|
|
48
|
+
uncitedSnippets: string[];
|
|
49
|
+
verdict: RubricVerdict;
|
|
50
|
+
inputTokens: number;
|
|
51
|
+
outputTokens: number;
|
|
52
|
+
answerMs: number;
|
|
53
|
+
tokenAccounting: TokenAccountingCheck;
|
|
54
|
+
/** Snippets found in the entries the answer model actually received (post-trim). */
|
|
55
|
+
evidenceRead: number;
|
|
56
|
+
/** Notebook entries that survived the trim; 0 when readObserved is false. */
|
|
57
|
+
chunksKept: number;
|
|
58
|
+
/** Kept entries that reached the model in core (unwidened) form; 0 when readObserved is false. */
|
|
59
|
+
chunksKeptCore: number;
|
|
60
|
+
/** False when the turn produced no keptChunkIds (failed turn / node skipped). */
|
|
61
|
+
readObserved: boolean;
|
|
62
|
+
}
|
|
63
|
+
/** Spec §6.5 — the harness validates its own token accounting. */
|
|
64
|
+
export interface TokenAccountingCheck {
|
|
65
|
+
ledgerInput: number;
|
|
66
|
+
observedInput: number;
|
|
67
|
+
ledgerOutput: number;
|
|
68
|
+
observedOutput: number;
|
|
69
|
+
agrees: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Whether the comparison actually ran. A question that never produced a turn
|
|
72
|
+
* has nothing to compare — reporting `agrees: true` there would be the one
|
|
73
|
+
* direction this mechanism must never fail (§6.5).
|
|
74
|
+
*/
|
|
75
|
+
checked: boolean;
|
|
76
|
+
}
|
|
77
|
+
export interface SweepSummary<T extends RetrievalSweepResult> {
|
|
78
|
+
product: string;
|
|
79
|
+
mode: "retrieval-only" | "end-to-end";
|
|
80
|
+
model: string;
|
|
81
|
+
startedAt: string;
|
|
82
|
+
results: T[];
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=retrieval-eval.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retrieval-eval.types.d.ts","sourceRoot":"","sources":["../../../src/eval/retrieval/retrieval-eval.types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,qFAAqF;AACrF,eAAO,MAAM,kBAAkB;;;;;;;;;iBAc7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;iBAIhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,oEAAoE;AACpE,MAAM,MAAM,iBAAiB,GAC3B,wBAAwB,GAAG,sBAAsB,GAAG,qBAAqB,GAAG,0BAA0B,CAAC;AAEzG,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,oDAAoD;AACpD,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,+FAA+F;AAC/F,MAAM,WAAW,mBAAoB,SAAQ,oBAAoB;IAC/D,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,OAAO,EAAE,aAAa,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,oBAAoB,CAAC;IACtC,oFAAoF;IACpF,YAAY,EAAE,MAAM,CAAC;IACrB,6EAA6E;IAC7E,UAAU,EAAE,MAAM,CAAC;IACnB,kGAAkG;IAClG,cAAc,EAAE,MAAM,CAAC;IACvB,iFAAiF;IACjF,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,kEAAkE;AAClE,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,oBAAoB;IAC1D,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,gBAAgB,GAAG,YAAY,CAAC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,CAAC,EAAE,CAAC;CACd"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.evalQuestionSetSchema = exports.evalQuestionSchema = void 0;
|
|
4
|
+
// src/eval/retrieval/retrieval-eval.types.ts
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
/** One question with its ground truth. Authored per repo, corrected by the owner. */
|
|
7
|
+
exports.evalQuestionSchema = zod_1.z.object({
|
|
8
|
+
id: zod_1.z.string().describe("Stable identifier, unique within the set"),
|
|
9
|
+
corpus: zod_1.z.string().describe("Which corpus this question is asked against, e.g. 'a360ai/P10'"),
|
|
10
|
+
question: zod_1.z.string().describe("The question exactly as a user would ask it"),
|
|
11
|
+
mustRetrieve: zod_1.z.array(zod_1.z.string()).describe("Distinctive text snippets a correct answer must be grounded in"),
|
|
12
|
+
rubric: zod_1.z.string().describe("What a correct answer must assert, in one or two sentences"),
|
|
13
|
+
scopeId: zod_1.z.string().optional().describe("Scope root id when the turn is scope-confined"),
|
|
14
|
+
scopeType: zod_1.z.string().optional().describe("JSON:API type of the scope root"),
|
|
15
|
+
scopeLabel: zod_1.z
|
|
16
|
+
.string()
|
|
17
|
+
.optional()
|
|
18
|
+
.describe("Neo4j label of the scope root, e.g. 'Campaign'. Required whenever scopeId is set: the scope guard needs the label, and deriving it would pull the graph catalog into the runner."),
|
|
19
|
+
});
|
|
20
|
+
exports.evalQuestionSetSchema = zod_1.z.object({
|
|
21
|
+
version: zod_1.z.literal(1),
|
|
22
|
+
product: zod_1.z.string().describe("Which product this set belongs to, e.g. 'a360ai'"),
|
|
23
|
+
questions: zod_1.z.array(exports.evalQuestionSchema).min(1),
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=retrieval-eval.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retrieval-eval.types.js","sourceRoot":"","sources":["../../../src/eval/retrieval/retrieval-eval.types.ts"],"names":[],"mappings":";;;AAAA,6CAA6C;AAC7C,6BAAwB;AAExB,qFAAqF;AACxE,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0CAA0C,CAAC;IACnE,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gEAAgE,CAAC;IAC7F,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6CAA6C,CAAC;IAC5E,YAAY,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,gEAAgE,CAAC;IAC5G,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4DAA4D,CAAC;IACzF,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,+CAA+C,CAAC;IACxF,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;IAC5E,UAAU,EAAE,OAAC;SACV,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,kLAAkL,CACnL;CACJ,CAAC,CAAC;AAGU,QAAA,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5C,OAAO,EAAE,OAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACrB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kDAAkD,CAAC;IAChF,SAAS,EAAE,OAAC,CAAC,KAAK,CAAC,0BAAkB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;CAC9C,CAAC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ChunkRepository } from "../../foundations/chunk/repositories/chunk.repository";
|
|
2
|
+
import { EvidenceMatcher } from "./evidence.matcher";
|
|
3
|
+
import { EvalQuestionSet, RetrievalSweepResult, SweepSummary } from "./retrieval-eval.types";
|
|
4
|
+
/**
|
|
5
|
+
* The fast inner loop: asks the retrieval layer what it WOULD read for each
|
|
6
|
+
* question and stops there. No answer is generated, so the only provider call
|
|
7
|
+
* is embedding the question.
|
|
8
|
+
*
|
|
9
|
+
* Questions run SEQUENTIALLY on purpose — `retrievalMs` is a reported metric and
|
|
10
|
+
* concurrency would make it meaningless (spec §6.3).
|
|
11
|
+
*/
|
|
12
|
+
export declare class RetrievalSweepService {
|
|
13
|
+
private readonly chunkRepository;
|
|
14
|
+
private readonly evidence;
|
|
15
|
+
private readonly logger;
|
|
16
|
+
constructor(chunkRepository: ChunkRepository, evidence: EvidenceMatcher);
|
|
17
|
+
/**
|
|
18
|
+
* SCOPE COMES FROM CLS, NOT FROM A PARAMETER.
|
|
19
|
+
*
|
|
20
|
+
* `ChunkRepository` reads company scope from `ClsService` (via
|
|
21
|
+
* `Neo4jService.initQuery`, which pulls `companyId`/`userId` off CLS) and the
|
|
22
|
+
* run's scope root from `AGENT_SCOPE_CLS_KEY`
|
|
23
|
+
* (`common/repositories/agent-scope.filter.ts`), which fails closed. A caller
|
|
24
|
+
* that does not establish that context retrieves nothing — or, worse,
|
|
25
|
+
* retrieves unscoped. The entry point is responsible for it; see
|
|
26
|
+
* apps/api/src/eval/run-sweep.ts.
|
|
27
|
+
*
|
|
28
|
+
* This is why `run` takes no companyId: accepting one would imply it is
|
|
29
|
+
* honoured here, and it is not.
|
|
30
|
+
*/
|
|
31
|
+
run(params: {
|
|
32
|
+
set: EvalQuestionSet;
|
|
33
|
+
}): Promise<SweepSummary<RetrievalSweepResult>>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=retrieval-sweep.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retrieval-sweep.service.d.ts","sourceRoot":"","sources":["../../../src/eval/retrieval/retrieval-sweep.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE7F;;;;;;;GAOG;AACH,qBACa,qBAAqB;IAI9B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAJ3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0C;gBAG9C,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE,eAAe;IAG5C;;;;;;;;;;;;;OAaG;IACG,GAAG,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,eAAe,CAAA;KAAE,GAAG,OAAO,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;CA0CzF"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var RetrievalSweepService_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.RetrievalSweepService = void 0;
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
const chunk_repository_1 = require("../../foundations/chunk/repositories/chunk.repository");
|
|
16
|
+
const evidence_matcher_1 = require("./evidence.matcher");
|
|
17
|
+
/**
|
|
18
|
+
* The fast inner loop: asks the retrieval layer what it WOULD read for each
|
|
19
|
+
* question and stops there. No answer is generated, so the only provider call
|
|
20
|
+
* is embedding the question.
|
|
21
|
+
*
|
|
22
|
+
* Questions run SEQUENTIALLY on purpose — `retrievalMs` is a reported metric and
|
|
23
|
+
* concurrency would make it meaningless (spec §6.3).
|
|
24
|
+
*/
|
|
25
|
+
let RetrievalSweepService = RetrievalSweepService_1 = class RetrievalSweepService {
|
|
26
|
+
constructor(chunkRepository, evidence) {
|
|
27
|
+
this.chunkRepository = chunkRepository;
|
|
28
|
+
this.evidence = evidence;
|
|
29
|
+
this.logger = new common_1.Logger(RetrievalSweepService_1.name);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* SCOPE COMES FROM CLS, NOT FROM A PARAMETER.
|
|
33
|
+
*
|
|
34
|
+
* `ChunkRepository` reads company scope from `ClsService` (via
|
|
35
|
+
* `Neo4jService.initQuery`, which pulls `companyId`/`userId` off CLS) and the
|
|
36
|
+
* run's scope root from `AGENT_SCOPE_CLS_KEY`
|
|
37
|
+
* (`common/repositories/agent-scope.filter.ts`), which fails closed. A caller
|
|
38
|
+
* that does not establish that context retrieves nothing — or, worse,
|
|
39
|
+
* retrieves unscoped. The entry point is responsible for it; see
|
|
40
|
+
* apps/api/src/eval/run-sweep.ts.
|
|
41
|
+
*
|
|
42
|
+
* This is why `run` takes no companyId: accepting one would imply it is
|
|
43
|
+
* honoured here, and it is not.
|
|
44
|
+
*/
|
|
45
|
+
async run(params) {
|
|
46
|
+
const startedAt = new Date().toISOString();
|
|
47
|
+
const results = [];
|
|
48
|
+
for (const question of params.set.questions) {
|
|
49
|
+
const began = Date.now();
|
|
50
|
+
try {
|
|
51
|
+
const chunks = await this.chunkRepository.findPotentialChunks({
|
|
52
|
+
question: question.question,
|
|
53
|
+
dataLimits: {},
|
|
54
|
+
});
|
|
55
|
+
const haystack = chunks.map((chunk) => chunk.content ?? "").join("\n\n");
|
|
56
|
+
const scored = this.evidence.score({ snippets: question.mustRetrieve, haystack });
|
|
57
|
+
results.push({
|
|
58
|
+
questionId: question.id,
|
|
59
|
+
evidenceRetrieved: scored.found,
|
|
60
|
+
missingSnippets: scored.missing,
|
|
61
|
+
chunksRead: chunks.length,
|
|
62
|
+
retrievalMs: Date.now() - began,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
67
|
+
this.logger.warn(`retrieval sweep: question ${question.id} failed: ${message}`);
|
|
68
|
+
results.push({
|
|
69
|
+
questionId: question.id,
|
|
70
|
+
evidenceRetrieved: 0,
|
|
71
|
+
missingSnippets: question.mustRetrieve,
|
|
72
|
+
chunksRead: 0,
|
|
73
|
+
retrievalMs: Date.now() - began,
|
|
74
|
+
error: message,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
product: params.set.product,
|
|
80
|
+
mode: "retrieval-only",
|
|
81
|
+
model: "n/a — retrieval only",
|
|
82
|
+
startedAt,
|
|
83
|
+
results,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
exports.RetrievalSweepService = RetrievalSweepService;
|
|
88
|
+
exports.RetrievalSweepService = RetrievalSweepService = RetrievalSweepService_1 = __decorate([
|
|
89
|
+
(0, common_1.Injectable)(),
|
|
90
|
+
__metadata("design:paramtypes", [chunk_repository_1.ChunkRepository,
|
|
91
|
+
evidence_matcher_1.EvidenceMatcher])
|
|
92
|
+
], RetrievalSweepService);
|
|
93
|
+
//# sourceMappingURL=retrieval-sweep.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retrieval-sweep.service.js","sourceRoot":"","sources":["../../../src/eval/retrieval/retrieval-sweep.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,4FAAwF;AACxF,yDAAqD;AAGrD;;;;;;;GAOG;AAEI,IAAM,qBAAqB,6BAA3B,MAAM,qBAAqB;IAGhC,YACmB,eAAgC,EAChC,QAAyB;QADzB,oBAAe,GAAf,eAAe,CAAiB;QAChC,aAAQ,GAAR,QAAQ,CAAiB;QAJ3B,WAAM,GAAG,IAAI,eAAM,CAAC,uBAAqB,CAAC,IAAI,CAAC,CAAC;IAK9D,CAAC;IAEJ;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,GAAG,CAAC,MAAgC;QACxC,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAC3C,MAAM,OAAO,GAA2B,EAAE,CAAC;QAE3C,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;YAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YACzB,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,mBAAmB,CAAC;oBAC5D,QAAQ,EAAE,QAAQ,CAAC,QAAQ;oBAC3B,UAAU,EAAE,EAAE;iBACf,CAAC,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACzE,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,YAAY,EAAE,QAAQ,EAAE,CAAC,CAAC;gBAClF,OAAO,CAAC,IAAI,CAAC;oBACX,UAAU,EAAE,QAAQ,CAAC,EAAE;oBACvB,iBAAiB,EAAE,MAAM,CAAC,KAAK;oBAC/B,eAAe,EAAE,MAAM,CAAC,OAAO;oBAC/B,UAAU,EAAE,MAAM,CAAC,MAAM;oBACzB,WAAW,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK;iBAChC,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACvE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,6BAA6B,QAAQ,CAAC,EAAE,YAAY,OAAO,EAAE,CAAC,CAAC;gBAChF,OAAO,CAAC,IAAI,CAAC;oBACX,UAAU,EAAE,QAAQ,CAAC,EAAE;oBACvB,iBAAiB,EAAE,CAAC;oBACpB,eAAe,EAAE,QAAQ,CAAC,YAAY;oBACtC,UAAU,EAAE,CAAC;oBACb,WAAW,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK;oBAC/B,KAAK,EAAE,OAAO;iBACf,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO;YACL,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,OAAO;YAC3B,IAAI,EAAE,gBAAgB;YACtB,KAAK,EAAE,sBAAsB;YAC7B,SAAS;YACT,OAAO;SACR,CAAC;IACJ,CAAC;CACF,CAAA;AAhEY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,mBAAU,GAAE;qCAKyB,kCAAe;QACtB,kCAAe;GALjC,qBAAqB,CAgEjC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { LLMService } from "../../core/llm/services/llm.service";
|
|
2
|
+
import { RubricVerdict } from "./retrieval-eval.types";
|
|
3
|
+
export declare const RUBRIC_JUDGE_PROMPT = "\nYou are grading one answer produced by a retrieval-augmented assistant.\n\nYou are given the user's question, a rubric stating what a correct answer MUST\nassert, the answer that was produced, and how many pieces of required evidence\nthe answer cited.\n\nDecide ONE thing: does the answer satisfy the rubric?\n\nJudge only against the rubric. Do not reward length, tone, formatting or\nconfidence. An answer that is well written but does not assert what the rubric\nrequires has failed. An answer that asserts what the rubric requires in plain\nlanguage has passed, even if it is terse.\n\nWhen the answer FAILS, classify why, choosing exactly one:\n\n- evidence-not-retrieved: the answer could not have been written because the\n required material never reached it. Typically the citation count is zero.\n- retrieved-but-unused: the required material was cited or is clearly present,\n and the answer still does not assert what the rubric requires.\n- contradicted-source: the answer asserts something that conflicts with the\n material it cites.\n- hedged-without-answering: the answer declines, defers, or describes what it\n would need, instead of answering.\n\nBe strict and be consistent. Your explanation must be one sentence naming the\nspecific rubric requirement that was met or missed.\n";
|
|
4
|
+
/**
|
|
5
|
+
* Grades one answer against its rubric.
|
|
6
|
+
*
|
|
7
|
+
* A judging failure degrades to a FAILED verdict for that question rather than
|
|
8
|
+
* killing the sweep — the graceful-degradation rule in 06-llm-calls.md rule 8,
|
|
9
|
+
* applied deliberately: an ungraded question must never silently count as a pass.
|
|
10
|
+
*
|
|
11
|
+
* ATTRIBUTION EXCEPTION (06-llm-calls.md rule 5). `tokenUsageType` and
|
|
12
|
+
* `metadata` are set, but `relationshipId` / `relationshipType` are deliberately
|
|
13
|
+
* absent: a sweep grades the harness itself, so there is no tenant entity whose
|
|
14
|
+
* spend this is. LLMService skips usage persistence unless BOTH are set, which
|
|
15
|
+
* is the intended outcome here — eval spend must not land on a customer's
|
|
16
|
+
* ledger. The call is still fully identifiable in dumps and telemetry through
|
|
17
|
+
* metadata.agentName / metadata.nodeName.
|
|
18
|
+
*/
|
|
19
|
+
export declare class RubricJudgeService {
|
|
20
|
+
private readonly llmService;
|
|
21
|
+
private readonly logger;
|
|
22
|
+
constructor(llmService: LLMService);
|
|
23
|
+
judge(params: {
|
|
24
|
+
question: string;
|
|
25
|
+
rubric: string;
|
|
26
|
+
answer: string;
|
|
27
|
+
evidenceCited: number;
|
|
28
|
+
}): Promise<RubricVerdict>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=rubric-judge.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rubric-judge.service.d.ts","sourceRoot":"","sources":["../../../src/eval/retrieval/rubric-judge.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAqB,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE1E,eAAO,MAAM,mBAAmB,8xCA2B/B,CAAC;AAoCF;;;;;;;;;;;;;;GAcG;AACH,qBACa,kBAAkB;IAGjB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAFvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuC;gBAEjC,UAAU,EAAE,UAAU;IAE7C,KAAK,CAAC,MAAM,EAAE;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,aAAa,EAAE,MAAM,CAAC;KACvB,GAAG,OAAO,CAAC,aAAa,CAAC;CAuC3B"}
|