@babav/knowledge-core-client 0.13.0 → 0.14.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/index.d.ts CHANGED
@@ -87,23 +87,31 @@ export interface Citation {
87
87
  custom_metadata: Record<string, unknown>;
88
88
  source_url: string | null;
89
89
  }
90
- export interface GroundednessSentence {
90
+ export interface GroundednessClaim {
91
91
  /** Char span into the RAW answer (concatenated tokens / `final.answer`). */
92
92
  text_span: [number, number];
93
- /** The exact sentence text highlight by matching this in the rendered output
94
- * (robust to markdown rendering + inserted citation markers) rather than offsets. */
93
+ /** The exact claim text (a verbatim substring of the answer) highlight by matching
94
+ * this in the rendered output rather than by offsets (robust to markdown + citation
95
+ * markers). Claims with `passed === false` are the unsupported spans to flag. */
95
96
  text: string;
97
+ /** Verdict from the LLM verifier: 1.0 = supported, 0.5 = partially supported,
98
+ * 0.0 = unsupported/contradicted (by the retrieved sources). */
96
99
  score: number;
97
100
  passed: boolean | null;
101
+ /** The verifier's brief justification for the verdict (why supported/partial/unsupported). */
102
+ reason?: string | null;
98
103
  }
104
+ /** @deprecated Alias — groundedness entries are now per-claim. Use GroundednessClaim. */
105
+ export type GroundednessSentence = GroundednessClaim;
99
106
  export interface Groundedness {
100
- /** Headline faithfulness of the whole answer vs. the full context. */
107
+ /** Headline faithfulness of the whole answer = mean of the per-claim scores. */
101
108
  overall: {
102
109
  score: number | null;
103
110
  passed: boolean | null;
104
111
  };
105
- /** Per-sentence faithfulness flag low-`score` sentences as weakly grounded. */
106
- sentences: GroundednessSentence[];
112
+ /** Per-CLAIM faithfulness from an independent Claude (Haiku) verifier that checks each
113
+ * extracted claim against the retrieved sources. `model` reports the verifier. */
114
+ sentences: GroundednessClaim[];
107
115
  model: string;
108
116
  threshold: number | null;
109
117
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babav/knowledge-core-client",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "TypeScript client for the Babav Knowledge Core API (Deno + Node 18+, zero deps).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/index.ts CHANGED
@@ -102,20 +102,28 @@ export interface Citation {
102
102
  source_url: string | null;
103
103
  }
104
104
 
105
- export interface GroundednessSentence {
105
+ export interface GroundednessClaim {
106
106
  /** Char span into the RAW answer (concatenated tokens / `final.answer`). */
107
107
  text_span: [number, number];
108
- /** The exact sentence text highlight by matching this in the rendered output
109
- * (robust to markdown rendering + inserted citation markers) rather than offsets. */
108
+ /** The exact claim text (a verbatim substring of the answer) highlight by matching
109
+ * this in the rendered output rather than by offsets (robust to markdown + citation
110
+ * markers). Claims with `passed === false` are the unsupported spans to flag. */
110
111
  text: string;
112
+ /** Verdict from the LLM verifier: 1.0 = supported, 0.5 = partially supported,
113
+ * 0.0 = unsupported/contradicted (by the retrieved sources). */
111
114
  score: number;
112
115
  passed: boolean | null;
116
+ /** The verifier's brief justification for the verdict (why supported/partial/unsupported). */
117
+ reason?: string | null;
113
118
  }
119
+ /** @deprecated Alias — groundedness entries are now per-claim. Use GroundednessClaim. */
120
+ export type GroundednessSentence = GroundednessClaim;
114
121
  export interface Groundedness {
115
- /** Headline faithfulness of the whole answer vs. the full context. */
122
+ /** Headline faithfulness of the whole answer = mean of the per-claim scores. */
116
123
  overall: { score: number | null; passed: boolean | null };
117
- /** Per-sentence faithfulness flag low-`score` sentences as weakly grounded. */
118
- sentences: GroundednessSentence[];
124
+ /** Per-CLAIM faithfulness from an independent Claude (Haiku) verifier that checks each
125
+ * extracted claim against the retrieved sources. `model` reports the verifier. */
126
+ sentences: GroundednessClaim[];
119
127
  model: string;
120
128
  threshold: number | null;
121
129
  }