@konneal/engine 0.2.30 → 0.2.31
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.
|
@@ -1456,21 +1456,21 @@ async function verifyRoute(c) {
|
|
|
1456
1456
|
try {
|
|
1457
1457
|
const u = await understandQuery(env.AI, roleModel(env, "understand"), query, [], []);
|
|
1458
1458
|
let lexicalBoost;
|
|
1459
|
-
let
|
|
1459
|
+
let editionSteer = null;
|
|
1460
1460
|
try {
|
|
1461
1461
|
const fam = u?.doc_number ? refCodec().familyOf(u.doc_number) : null;
|
|
1462
1462
|
if (fam) {
|
|
1463
1463
|
const row = await env.DB.prepare("SELECT edition FROM documents WHERE family = ?1 AND active = 1 ORDER BY edition DESC LIMIT 1").bind(fam).first().catch(() => null);
|
|
1464
1464
|
if (row?.edition) {
|
|
1465
1465
|
lexicalBoost = String(row.edition);
|
|
1466
|
-
|
|
1466
|
+
editionSteer = { doc_number: fam.split("-").pop() ?? "", edition: String(row.edition) };
|
|
1467
1467
|
}
|
|
1468
1468
|
}
|
|
1469
1469
|
} catch {
|
|
1470
1470
|
}
|
|
1471
1471
|
const bound = await bindModelNode(env, { query, standardKeys: entitlementScope(standardKeysFrom(body)) });
|
|
1472
1472
|
const modelGrounding = bound && !bound.gated ? modelGroundingBlock(bound) : null;
|
|
1473
|
-
const retrieved = await retrieve(env, query, { understanding: u, standardKeys: entitlementScope(standardKeysFrom(body)), lexicalBoost,
|
|
1473
|
+
const retrieved = await retrieve(env, query, { understanding: u, standardKeys: entitlementScope(standardKeysFrom(body)), lexicalBoost, editionSteer });
|
|
1474
1474
|
const passages = retrieved.hits.map((h) => h.text);
|
|
1475
1475
|
const anchors = checkQuoteAnchors(answer, passages);
|
|
1476
1476
|
const refs = [...answer.matchAll(/\[\[u:([^\]]+)\]\]/g)].map((m) => m[1]);
|
package/package.json
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"playwright": "^1.62.1",
|
|
28
28
|
"yaml": "^2.9.1"
|
|
29
29
|
},
|
|
30
|
-
"version": "0.2.
|
|
30
|
+
"version": "0.2.31",
|
|
31
31
|
"description": "The Konneal engine: the publisher-agnostic build pipeline and API plane for standards intelligence (retrieval, answer contract, verdicts, evaluation).",
|
|
32
32
|
"license": "BSD-3-Clause",
|
|
33
33
|
"type": "module",
|
|
@@ -234,7 +234,7 @@ async function verifyRoute(c: RouteContext): Promise<Response> {
|
|
|
234
234
|
// grounding — a verify that grounds against different passages than
|
|
235
235
|
// the answer used judges a different answer
|
|
236
236
|
let lexicalBoost: string | undefined;
|
|
237
|
-
let
|
|
237
|
+
let editionSteer: { doc_number: string; edition: string } | null = null;
|
|
238
238
|
try {
|
|
239
239
|
const fam = u?.doc_number ? refCodec().familyOf(u.doc_number) : null;
|
|
240
240
|
if (fam) {
|
|
@@ -242,7 +242,7 @@ async function verifyRoute(c: RouteContext): Promise<Response> {
|
|
|
242
242
|
.bind(fam).first().catch(() => null);
|
|
243
243
|
if (row?.edition) {
|
|
244
244
|
lexicalBoost = String(row.edition);
|
|
245
|
-
|
|
245
|
+
editionSteer = { doc_number: fam.split("-").pop() ?? "", edition: String(row.edition) };
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
} catch {
|
|
@@ -250,7 +250,7 @@ async function verifyRoute(c: RouteContext): Promise<Response> {
|
|
|
250
250
|
}
|
|
251
251
|
const bound = await bindModelNode(env, { query, standardKeys: entitlementScope(standardKeysFrom(body)) });
|
|
252
252
|
const modelGrounding = bound && !bound.gated ? modelGroundingBlock(bound) : null;
|
|
253
|
-
const retrieved = await retrieve(env, query, { understanding: u, standardKeys: entitlementScope(standardKeysFrom(body)), lexicalBoost,
|
|
253
|
+
const retrieved = await retrieve(env, query, { understanding: u, standardKeys: entitlementScope(standardKeysFrom(body)), lexicalBoost, editionSteer });
|
|
254
254
|
const passages = retrieved.hits.map((h: Hit) => h.text);
|
|
255
255
|
const anchors = checkQuoteAnchors(answer, passages);
|
|
256
256
|
const refs = [...answer.matchAll(/\[\[u:([^\]]+)\]\]/g)].map((m) => m[1]);
|