wauldo 0.7.1 → 0.7.2
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/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +28 -0
- package/dist/index.mjs +28 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -593,6 +593,7 @@ declare class MockHttpClient {
|
|
|
593
593
|
system?: string;
|
|
594
594
|
model?: string;
|
|
595
595
|
}): Conversation;
|
|
596
|
+
guard(text: string, sourceContext: string, mode?: GuardMode, _options?: RequestOptions): Promise<GuardResponse>;
|
|
596
597
|
ragAsk(question: string, text: string, source?: string): Promise<string>;
|
|
597
598
|
private record;
|
|
598
599
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -593,6 +593,7 @@ declare class MockHttpClient {
|
|
|
593
593
|
system?: string;
|
|
594
594
|
model?: string;
|
|
595
595
|
}): Conversation;
|
|
596
|
+
guard(text: string, sourceContext: string, mode?: GuardMode, _options?: RequestOptions): Promise<GuardResponse>;
|
|
596
597
|
ragAsk(question: string, text: string, source?: string): Promise<string>;
|
|
597
598
|
private record;
|
|
598
599
|
}
|
package/dist/index.js
CHANGED
|
@@ -1235,6 +1235,34 @@ var MockHttpClient = class {
|
|
|
1235
1235
|
this.record("conversation", options);
|
|
1236
1236
|
return new Conversation(this, options);
|
|
1237
1237
|
}
|
|
1238
|
+
async guard(text, sourceContext, mode = "lexical", _options) {
|
|
1239
|
+
this.record("guard", text, sourceContext, mode);
|
|
1240
|
+
const textNums = new Set(text.match(/\b\d+(?:\.\d+)?\b/g) ?? []);
|
|
1241
|
+
const srcNums = new Set(sourceContext.match(/\b\d+(?:\.\d+)?\b/g) ?? []);
|
|
1242
|
+
const mismatch = textNums.size > 0 && srcNums.size > 0 && [...textNums].some((n) => !srcNums.has(n));
|
|
1243
|
+
if (mismatch) {
|
|
1244
|
+
return {
|
|
1245
|
+
verdict: "rejected",
|
|
1246
|
+
action: "block",
|
|
1247
|
+
hallucination_rate: 1,
|
|
1248
|
+
mode,
|
|
1249
|
+
total_claims: 1,
|
|
1250
|
+
supported_claims: 0,
|
|
1251
|
+
confidence: 0,
|
|
1252
|
+
claims: [{ text, supported: false, confidence: 0.3, verdict: "rejected", action: "block", reason: "numerical_mismatch" }]
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
1255
|
+
return {
|
|
1256
|
+
verdict: "verified",
|
|
1257
|
+
action: "allow",
|
|
1258
|
+
hallucination_rate: 0,
|
|
1259
|
+
mode,
|
|
1260
|
+
total_claims: 1,
|
|
1261
|
+
supported_claims: 1,
|
|
1262
|
+
confidence: 0.95,
|
|
1263
|
+
claims: [{ text, supported: true, confidence: 0.95, verdict: "verified", action: "allow" }]
|
|
1264
|
+
};
|
|
1265
|
+
}
|
|
1238
1266
|
async ragAsk(question, text, source = "document") {
|
|
1239
1267
|
this.record("ragAsk", question, text, source);
|
|
1240
1268
|
await this.ragUpload(text, source);
|
package/dist/index.mjs
CHANGED
|
@@ -1197,6 +1197,34 @@ var MockHttpClient = class {
|
|
|
1197
1197
|
this.record("conversation", options);
|
|
1198
1198
|
return new Conversation(this, options);
|
|
1199
1199
|
}
|
|
1200
|
+
async guard(text, sourceContext, mode = "lexical", _options) {
|
|
1201
|
+
this.record("guard", text, sourceContext, mode);
|
|
1202
|
+
const textNums = new Set(text.match(/\b\d+(?:\.\d+)?\b/g) ?? []);
|
|
1203
|
+
const srcNums = new Set(sourceContext.match(/\b\d+(?:\.\d+)?\b/g) ?? []);
|
|
1204
|
+
const mismatch = textNums.size > 0 && srcNums.size > 0 && [...textNums].some((n) => !srcNums.has(n));
|
|
1205
|
+
if (mismatch) {
|
|
1206
|
+
return {
|
|
1207
|
+
verdict: "rejected",
|
|
1208
|
+
action: "block",
|
|
1209
|
+
hallucination_rate: 1,
|
|
1210
|
+
mode,
|
|
1211
|
+
total_claims: 1,
|
|
1212
|
+
supported_claims: 0,
|
|
1213
|
+
confidence: 0,
|
|
1214
|
+
claims: [{ text, supported: false, confidence: 0.3, verdict: "rejected", action: "block", reason: "numerical_mismatch" }]
|
|
1215
|
+
};
|
|
1216
|
+
}
|
|
1217
|
+
return {
|
|
1218
|
+
verdict: "verified",
|
|
1219
|
+
action: "allow",
|
|
1220
|
+
hallucination_rate: 0,
|
|
1221
|
+
mode,
|
|
1222
|
+
total_claims: 1,
|
|
1223
|
+
supported_claims: 1,
|
|
1224
|
+
confidence: 0.95,
|
|
1225
|
+
claims: [{ text, supported: true, confidence: 0.95, verdict: "verified", action: "allow" }]
|
|
1226
|
+
};
|
|
1227
|
+
}
|
|
1200
1228
|
async ragAsk(question, text, source = "document") {
|
|
1201
1229
|
this.record("ragAsk", question, text, source);
|
|
1202
1230
|
await this.ragUpload(text, source);
|