veriquote 0.2.0 → 0.2.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/CITATION.cff +1 -1
- package/README.md +205 -157
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +30 -4
- package/dist/cli/main.js.map +1 -1
- package/dist/gate.d.ts +12 -2
- package/dist/gate.d.ts.map +1 -1
- package/dist/gate.js +6 -2
- package/dist/gate.js.map +1 -1
- package/dist/judge/chat-judge.d.ts +7 -0
- package/dist/judge/chat-judge.d.ts.map +1 -1
- package/dist/judge/chat-judge.js +2 -0
- package/dist/judge/chat-judge.js.map +1 -1
- package/dist/source/html.d.ts.map +1 -1
- package/dist/source/html.js +3 -0
- package/dist/source/html.js.map +1 -1
- package/package.json +4 -2
- package/src/cli/main.ts +28 -4
- package/src/gate.ts +14 -4
- package/src/judge/chat-judge.ts +11 -1
- package/src/source/html.ts +3 -0
package/CITATION.cff
CHANGED
package/README.md
CHANGED
|
@@ -6,14 +6,24 @@
|
|
|
6
6
|
**Make an LLM quote its sources, then check every quote twice: is it really in
|
|
7
7
|
the source, and does it support the claim?**
|
|
8
8
|
|
|
9
|
-
A `[1]` after a sentence looks like evidence
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
A `[1]` after a sentence looks like evidence, but checking it means opening the
|
|
10
|
+
source and finding the passage. VeriQuote makes the answering model attach a
|
|
11
|
+
verbatim quote to every citation and then checks each quote twice: a
|
|
12
|
+
deterministic matcher confirms that the quote is in the source, and an LLM
|
|
13
|
+
judge decides whether the quote supports the claim.
|
|
14
|
+
|
|
15
|
+
Both checks are needed. Strong models copy quotes reliably: the best open
|
|
16
|
+
models in my tests quoted verbatim in over 99% of cases, and a recent study
|
|
17
|
+
measured 98% for a frontier model. But a real quote is not a supported claim;
|
|
18
|
+
in that study, only 37% of the model's claims were fully supported by their
|
|
19
|
+
quotes.[^zhang] Weaker models also leave citations without any quote, and a
|
|
20
|
+
judge asked whether a quote supports a claim is not built to notice that the
|
|
21
|
+
quote was made up. VeriQuote is written in TypeScript, has no dependencies and
|
|
22
|
+
runs in Node and in the browser.
|
|
23
|
+
|
|
24
|
+
**Try it in the browser:** [rickinto.place/veriquote](https://rickinto.place/veriquote)
|
|
25
|
+
has eight worked examples, a box for your own text, and the benchmark results as
|
|
26
|
+
interactive charts.
|
|
17
27
|
|
|
18
28
|
```console
|
|
19
29
|
$ curl -s https://raw.githubusercontent.com/rickintoplace/veriquote/main/examples/ozone-answer.md \
|
|
@@ -37,20 +47,19 @@ $ curl -s https://raw.githubusercontent.com/rickintoplace/veriquote/main/example
|
|
|
37
47
|
REVISE — 3 failed citation(s), 1 uncited sentence(s)
|
|
38
48
|
```
|
|
39
49
|
|
|
40
|
-
`c2`
|
|
41
|
-
|
|
42
|
-
|
|
50
|
+
Look at `c2` and `c4`. The quote in `c2` is copied correctly, but the claim
|
|
51
|
+
names the wrong person; only the judge can see that. The quote in `c4` is made
|
|
52
|
+
up, and the judge still calls it supported; only the matcher can see that.
|
|
53
|
+
Without an API key the CLI checks the quotes alone. Set
|
|
43
54
|
`VERIQUOTE_JUDGE_API_KEY` and `VERIQUOTE_JUDGE_MODEL` (any OpenAI-compatible
|
|
44
|
-
endpoint)
|
|
45
|
-
|
|
46
|
-
**Try both checks in the browser:** [`demo/index.html`](demo/index.html) — eight
|
|
47
|
-
examples with recorded judge verdicts, or your own text with your own key.
|
|
55
|
+
endpoint) to add the judge.
|
|
48
56
|
|
|
49
57
|
## How it works
|
|
50
58
|
|
|
51
|
-
The answering model gets `veriquote prompt` (or
|
|
52
|
-
in its system prompt. Every cited sentence
|
|
53
|
-
and the answer ends with a plain-text quote
|
|
59
|
+
The answering model gets the output of `veriquote prompt` (or
|
|
60
|
+
`buildCitationInstructions()`) in its system prompt. Every cited sentence then
|
|
61
|
+
ends with source and claim markers, and the answer ends with a plain-text quote
|
|
62
|
+
appendix:
|
|
54
63
|
|
|
55
64
|
```
|
|
56
65
|
Vitamin D supplementation reduced fall risk in older adults.[1]{c1}
|
|
@@ -63,137 +72,171 @@ c2|3|"BMD improved with \"high-dose\" regimens"
|
|
|
63
72
|
END_EVI1
|
|
64
73
|
```
|
|
65
74
|
|
|
66
|
-
|
|
67
|
-
weak models, and the `[n]` markers stay readable if nothing
|
|
68
|
-
|
|
75
|
+
The format is plain text rather than JSON, so it survives streaming, Markdown
|
|
76
|
+
renderers and weak models, and the `[n]` markers stay readable if nothing
|
|
77
|
+
checks them. Each citation then goes through three steps:
|
|
69
78
|
|
|
70
|
-
1. **Parse
|
|
71
|
-
2. **Match
|
|
72
|
-
tolerates whitespace, typography, OCR noise and
|
|
73
|
-
|
|
79
|
+
1. **Parse.** Every cited claim must carry a quote. Missing quotes are reported.
|
|
80
|
+
2. **Match.** Is the quote in the source? Deterministic fuzzy matching that
|
|
81
|
+
tolerates whitespace, typography, OCR noise and elisions, and reports where
|
|
82
|
+
the quote was found.
|
|
83
|
+
3. **Judge.** Does the quote support the claim? An LLM at temperature 0 answers
|
|
74
84
|
`entailed`, `partially_entailed`, `overstated`, `insufficient` or
|
|
75
85
|
`contradicted`, with a support score.
|
|
76
86
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
87
|
+
A citation's combined score is the lower of its match score and its support
|
|
88
|
+
score. A judge error can therefore never lift a citation above what the matcher
|
|
89
|
+
found, and a failed judge call is reported as an error, never counted as
|
|
90
|
+
support. The quote format is not meant to make a model more accurate; it makes
|
|
91
|
+
every claim checkable.
|
|
81
92
|
|
|
82
|
-
##
|
|
93
|
+
## Benchmarks
|
|
83
94
|
|
|
84
|
-
|
|
85
|
-
pipeline would hide the failures it exists to separate.
|
|
86
|
-
[`bench/`](bench), including how to reproduce it.
|
|
95
|
+
There are three benchmarks, kept separate on purpose: one blended number for a
|
|
96
|
+
two-stage pipeline would hide exactly the failures it exists to separate.
|
|
97
|
+
Everything is in [`bench/`](bench), including how to reproduce it.
|
|
87
98
|
|
|
88
99
|
<picture>
|
|
89
100
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/rickintoplace/veriquote/main/bench/figures/tango-dark.svg">
|
|
90
|
-
<img alt="
|
|
101
|
+
<img alt="The matcher blocks all 187 quotes that are not in the source and none of the 586 real quotes whose meaning was changed; the judge blocks 84% of unsupported citations but does not check whether a quote exists; together they cover both kinds of failure." src="https://raw.githubusercontent.com/rickintoplace/veriquote/main/bench/figures/tango-light.svg">
|
|
91
102
|
</picture>
|
|
92
103
|
|
|
93
|
-
The two checks are blind in opposite places. The matcher
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
source. That is why the combined score is `min(textMatchScore, judgeConfidence)`.
|
|
104
|
+
The two checks are blind in opposite places. The matcher never reads the claim,
|
|
105
|
+
so it cannot tell whether a real quote supports it. The judge is asked whether
|
|
106
|
+
the quote supports the claim, not whether the quote exists. It sees a little of
|
|
107
|
+
the source as context, but an invented quote that fits the claim can still pass
|
|
108
|
+
it: in the example above, it rates the made-up quote in `c4` as "entailed 0.90".
|
|
99
109
|
|
|
100
110
|
### Matcher
|
|
101
111
|
|
|
102
112
|
<picture>
|
|
103
113
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/rickintoplace/veriquote/main/bench/figures/matcher-dark.svg">
|
|
104
|
-
<img alt="Matcher score ranges
|
|
114
|
+
<img alt="Matcher score ranges for fifteen kinds of quote damage: faithful quotes score between 0.66 and 1.0, quotes that are not in the source between 0.14 and 0.40, and quotes whose meaning was changed score high because they are still near-verbatim." src="https://raw.githubusercontent.com/rickintoplace/veriquote/main/bench/figures/matcher-light.svg">
|
|
105
115
|
</picture>
|
|
106
116
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
The matcher benchmark needs no API key and no labels, because the right answer
|
|
118
|
+
is known by construction: 2,061 quotes built from five Wikipedia articles, then
|
|
119
|
+
copied faithfully, reformatted, altered or replaced in fifteen different ways. `npm run bench:matcher` reproduces it in
|
|
120
|
+
about two seconds. Faithfully copied quotes never score below 0.660, quotes
|
|
121
|
+
that are not in the source never above 0.396, and the default threshold of 0.4
|
|
122
|
+
sits in that gap. The amber rows are there on purpose: a quote whose meaning was
|
|
123
|
+
changed is still near-verbatim, and catching it is the judge's job.
|
|
124
|
+
|
|
125
|
+
There are two honest limits. Invented prose built from the source's own words
|
|
126
|
+
(an adversarial case) scores high, and so can a hand-written fabrication that
|
|
127
|
+
reuses the source's vocabulary, like `c3` above at 0.48. The CLI therefore
|
|
128
|
+
fails every citation below 0.5 and leaves the rest to the judge.
|
|
116
129
|
|
|
117
130
|
### Judge
|
|
118
131
|
|
|
119
132
|
<picture>
|
|
120
133
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/rickintoplace/veriquote/main/bench/figures/judges-dark.svg">
|
|
121
|
-
<img alt="Five open judge models against
|
|
134
|
+
<img alt="Five open judge models against the human labels of ALCE: they catch between 75% and 84% of unsupported citations, and agree with the annotators on 76.7% to 80.3% of pairs, around the 77.6% of the TRUE NLI model." src="https://raw.githubusercontent.com/rickintoplace/veriquote/main/bench/figures/judges-light.svg">
|
|
122
135
|
</picture>
|
|
123
136
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
137
|
+
The judge is measured against the human annotators of ALCE[^alce], with the
|
|
138
|
+
mapping from VeriQuote's classes to ALCE's labels fixed before any model ran.
|
|
139
|
+
*Caught* is the share of citations the annotators marked as unsupported that
|
|
140
|
+
the judge did not call fully supported. On ALCE's yes-or-no question ("does the
|
|
141
|
+
source fully support the claim?"), general-purpose open models agree with the
|
|
142
|
+
annotators about as often as TRUE[^true], the specialised 11B NLI model that
|
|
143
|
+
ALCE uses for its own automatic scores (77.6%). The best of them, `glm-5.3-flash`,
|
|
144
|
+
reaches Cohen's κ 0.53 on the three-way labels (full, partial or no support).
|
|
145
|
+
For comparison, ALCE reports κ 0.525 between its automatic metric and the
|
|
146
|
+
annotators on citation precision.
|
|
147
|
+
|
|
148
|
+
Before trusting any of this, look at the left panel: even the best judge lets
|
|
149
|
+
one unsupported citation in six through as fully supported. No judge should be
|
|
150
|
+
the only check. With only 56 unsupported pairs per run the intervals are wide,
|
|
151
|
+
so neighbouring models are not really separated. With reasoning switched off,
|
|
152
|
+
all three hybrid models caught less and agreed less while answering five to ten
|
|
153
|
+
times faster; each difference is within the sampling error, but all three point
|
|
154
|
+
the same way. These pairs come from ALCE, where the judge gets a whole passage
|
|
155
|
+
rather than a quote, which makes its task harder than in normal use.
|
|
156
|
+
|
|
157
|
+
### Answering models
|
|
136
158
|
|
|
137
159
|
<picture>
|
|
138
160
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/rickintoplace/veriquote/main/bench/figures/protocol-dark.svg">
|
|
139
|
-
<img alt="Protocol compliance: gpt-oss-120b complete in
|
|
161
|
+
<img alt="Protocol compliance for eight answering models: qwen3.6, qwen3.5, deepseek-v4-flash and glm-5.3-flash are close to 100% complete and verbatim; gpt-oss-120b is complete in 33.3% of answers; mistral-medium quotes verbatim in 81.0% of citations; llama-3.1-8b manages about half." src="https://raw.githubusercontent.com/rickintoplace/veriquote/main/bench/figures/protocol-light.svg">
|
|
140
162
|
</picture>
|
|
141
163
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
164
|
+
Each model answered 18 questions twice, with the citation instructions in its
|
|
165
|
+
system prompt, and `parseAnswer()` decided mechanically whether it complied.
|
|
166
|
+
Every raw answer is in
|
|
167
|
+
[`bench/results/protocol-answers.jsonl`](bench/results/protocol-answers.jsonl).
|
|
168
|
+
The strongest open models tested follow the format almost perfectly. Two
|
|
169
|
+
others show failures a reader would not notice: `gpt-oss-120b` almost always
|
|
170
|
+
prints the appendix, yet only a third of its answers give every citation a
|
|
171
|
+
quote. `mistral-medium` is nearly always complete, but only 81% of its quotes
|
|
172
|
+
are exact copies; the rest mostly join passages with "..." or change a few
|
|
173
|
+
words, and the matcher still finds them at a lower score. On the three
|
|
174
|
+
questions the sources cannot answer, no model attached a citation without a
|
|
175
|
+
real quote.
|
|
149
176
|
|
|
150
177
|
<details>
|
|
151
178
|
<summary>The numbers behind the figures</summary>
|
|
152
179
|
|
|
153
|
-
| judge model |
|
|
180
|
+
| judge model | caught ↑ | agreement | Cohen's κ |
|
|
154
181
|
| --- | ---: | ---: | ---: |
|
|
155
|
-
| `glm-5.3-flash` |
|
|
156
|
-
| `
|
|
157
|
-
| `qwen3.6-35b-a3b` |
|
|
158
|
-
| `
|
|
159
|
-
| `gpt-oss-120b` |
|
|
160
|
-
|
|
|
182
|
+
| `glm-5.3-flash` | 83.9% | 80.3% | 0.529 |
|
|
183
|
+
| `deepseek-v4-flash` | 81.8% | 78.7% | 0.435 |
|
|
184
|
+
| `qwen3.6-35b-a3b` | 81.8% | 78.1% | 0.454 |
|
|
185
|
+
| `qwen3.5-397b-a17b` | 79.2% | 79.7% | 0.483 |
|
|
186
|
+
| `gpt-oss-120b` | 75.0% | 76.7% | 0.394 |
|
|
187
|
+
| `qwen3.5-397b-a17b`, no reasoning | 78.6% | 77.7% | 0.410 |
|
|
188
|
+
| `qwen3.6-35b-a3b`, no reasoning | 78.6% | 77.3% | 0.397 |
|
|
189
|
+
| `glm-5.3-flash`, no reasoning | 75.6% | 74.0% | 0.373 |
|
|
190
|
+
| TRUE (T5-11B), as reported by ALCE[^alce] | | 77.6% | |
|
|
161
191
|
|
|
162
192
|
| quote family | n | median score | accepted at 0.4 |
|
|
163
193
|
| --- | ---: | ---: | ---: |
|
|
164
194
|
| faithful but reformatted | 1,121 | 1.000 | 100.0% |
|
|
165
195
|
| near-verbatim, meaning changed | 586 | 0.932 | 100.0% |
|
|
166
|
-
|
|
|
196
|
+
| not in the source | 187 | 0.249 | 0.0% |
|
|
167
197
|
|
|
168
198
|
| answering model | appendix | complete | verbatim | warning-free |
|
|
169
199
|
| --- | ---: | ---: | ---: | ---: |
|
|
170
|
-
|
|
|
171
|
-
|
|
|
172
|
-
|
|
|
173
|
-
|
|
|
174
|
-
|
|
175
|
-
|
|
200
|
+
| qwen3.6-35b-a3b | 100.0% | 100.0% | 100.0% | 100.0% |
|
|
201
|
+
| qwen3.5-397b-a17b | 100.0% | 100.0% | 100.0% | 100.0% |
|
|
202
|
+
| deepseek-v4-flash | 100.0% | 100.0% | 99.2% | 93.3% |
|
|
203
|
+
| glm-5.3-flash | 96.6% | 96.6% | 99.6% | 96.6% |
|
|
204
|
+
| gemma-4-31b-it | 80.0% | 80.0% | 96.6% | 80.0% |
|
|
205
|
+
| mistral-medium-3.5-128b | 96.7% | 93.3% | 81.0% | 96.7% |
|
|
206
|
+
| gpt-oss-120b | 96.7% | 33.3% | 91.1% | 33.3% |
|
|
207
|
+
| llama-3.1-8b-instruct | 66.7% | 43.3% | 50.3% | 20.0% |
|
|
208
|
+
|
|
209
|
+
The figures are rendered from `bench/results/*.json` by
|
|
176
210
|
[`bench/figures/render.mjs`](bench/figures/render.mjs).
|
|
177
211
|
</details>
|
|
178
212
|
|
|
179
213
|
## Use from an agent
|
|
180
214
|
|
|
181
|
-
An agent that reads sources and writes conclusions is exactly the case
|
|
182
|
-
built for.
|
|
183
|
-
[Agent Skill](integrations/verify-citations/SKILL.md)
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
215
|
+
An agent that reads sources and writes conclusions is exactly the case
|
|
216
|
+
VeriQuote was built for. [`verify-citations`](integrations/verify-citations) is
|
|
217
|
+
an [Agent Skill](integrations/verify-citations/SKILL.md) for Claude Code and
|
|
218
|
+
other hosts that read Agent Skills. With it, a research answer goes like this:
|
|
219
|
+
|
|
220
|
+
1. The agent reads each source with `veriquote source <url>`, which prints the
|
|
221
|
+
exact text the check will use. Web-fetch tools often summarize or reformat
|
|
222
|
+
pages, so quotes copied from them may not match.
|
|
223
|
+
2. It writes the answer in the checkable format and runs
|
|
224
|
+
`veriquote check answer.md --source <url> … --json`. The CLI fetches every
|
|
225
|
+
URL itself, so a truncated or misremembered copy of a page cannot pass.
|
|
226
|
+
3. The exit code says what to do next:
|
|
188
227
|
|
|
189
228
|
```
|
|
190
|
-
exit 0 verdict "pass"
|
|
191
|
-
exit 2 verdict "revise"
|
|
192
|
-
exit 1
|
|
229
|
+
exit 0 verdict "pass" present cleanAnswer, the sources and one line on the check
|
|
230
|
+
exit 2 verdict "revise" follow instructionsForModel, then check again
|
|
231
|
+
exit 1 verdict "unverified" the judge failed; check again before claiming anything
|
|
232
|
+
exit 1 (no verdict) bad input or unreachable source
|
|
193
233
|
```
|
|
194
234
|
|
|
195
|
-
|
|
196
|
-
|
|
235
|
+
The user sees only the final answer, with `[n]` markers, the list of sources
|
|
236
|
+
and a line such as "Checked with VeriQuote: all 6 quotes were found in the
|
|
237
|
+
sources and judged to support their claims." The quote appendix, the JSON and
|
|
238
|
+
any revision rounds stay with the agent. The CLI works in anything that can run
|
|
239
|
+
a shell command.
|
|
197
240
|
|
|
198
241
|
## Use as a library
|
|
199
242
|
|
|
@@ -208,7 +251,6 @@ const systemPrompt = `${yourAssistantPrompt}\n\n${buildCitationInstructions()}`;
|
|
|
208
251
|
// Give the sources to the model as numbered blocks [1], [2], …
|
|
209
252
|
```
|
|
210
253
|
|
|
211
|
-
|
|
212
254
|
```ts
|
|
213
255
|
import { ChatCompletionsJudge, verifyAnswer } from 'veriquote';
|
|
214
256
|
|
|
@@ -224,7 +266,7 @@ const report = await verifyAnswer({
|
|
|
224
266
|
{ title: 'Trial A', url: 'https://…', text: extractedFullText1 },
|
|
225
267
|
{ title: 'Trial B', url: 'https://…', text: extractedFullText2 },
|
|
226
268
|
],
|
|
227
|
-
judge, // omit
|
|
269
|
+
judge, // omit to check the quotes only
|
|
228
270
|
});
|
|
229
271
|
|
|
230
272
|
console.log(report.summary);
|
|
@@ -237,93 +279,99 @@ for (const c of report.citations) {
|
|
|
237
279
|
}
|
|
238
280
|
```
|
|
239
281
|
|
|
240
|
-
`report.cleanText` is the answer
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
each citation's match score, judge class and combined score next to its
|
|
245
|
-
footnote, so a reader can see which sentence is load-bearing without opening a
|
|
246
|
-
source.
|
|
282
|
+
`report.cleanText` is the answer without the `{cX}` markers, ready to render.
|
|
283
|
+
Show each citation's match score, judge class and combined score next to its
|
|
284
|
+
footnote, so a reader can see which sentence carries weight without opening a
|
|
285
|
+
single source.
|
|
247
286
|
|
|
248
287
|
| Export | Purpose |
|
|
249
288
|
| --- | --- |
|
|
250
|
-
| `buildCitationInstructions(options?)` | Prompt block for the answering model
|
|
251
|
-
| `verifyAnswer(options)` |
|
|
252
|
-
| `parseAnswer(answer)` |
|
|
253
|
-
| `parseEvi1Appendix` / `stripEvi1Appendix` / `serializeEvi1Appendix` | Low-level
|
|
254
|
-
| `matchQuoteAgainstSource(quote, source, options?)` |
|
|
255
|
-
| `ChatCompletionsJudge` |
|
|
256
|
-
| `EntailmentJudge` (interface) | Bring your own judge
|
|
257
|
-
| `gateReport(report, answer)` | Pass
|
|
289
|
+
| `buildCitationInstructions(options?)` | Prompt block for the answering model; budgets and quote lengths are configurable. |
|
|
290
|
+
| `verifyAnswer(options)` | The full pipeline: parse, match, judge, report. |
|
|
291
|
+
| `parseAnswer(answer)` | Claims, quotes and protocol warnings, without verifying anything. |
|
|
292
|
+
| `parseEvi1Appendix` / `stripEvi1Appendix` / `serializeEvi1Appendix` | Low-level handling of the appendix. |
|
|
293
|
+
| `matchQuoteAgainstSource(quote, source, options?)` | The deterministic matcher on its own. |
|
|
294
|
+
| `ChatCompletionsJudge` | Judge for any OpenAI-compatible API. |
|
|
295
|
+
| `EntailmentJudge` (interface) | Bring your own judge, such as a local NLI model. |
|
|
296
|
+
| `gateReport(report, answer)` | Pass or revise, the list of problems, uncited sentences and a correction prompt. |
|
|
258
297
|
| `fetchSource(url)` / `htmlToText(html)` | Fetch a source independently of the model and extract its text. |
|
|
259
298
|
|
|
260
|
-
All inputs and outputs are plain, serializable data
|
|
261
|
-
[`src/types.ts`](src/types.ts)
|
|
262
|
-
[`docs/DESIGN.md`](docs/DESIGN.md).
|
|
299
|
+
All inputs and outputs are plain, serializable data. See
|
|
300
|
+
[`src/types.ts`](src/types.ts) for the data model and
|
|
301
|
+
[`docs/DESIGN.md`](docs/DESIGN.md) for scoring and thresholds.
|
|
263
302
|
|
|
264
|
-
| Class |
|
|
303
|
+
| Class | Support score | Meaning |
|
|
265
304
|
| --- | --- | --- |
|
|
266
|
-
| `entailed` | 0.9–1.0 |
|
|
267
|
-
| `partially_entailed` | 0.5–0.8 |
|
|
268
|
-
| `overstated` | 0.3–0.6 |
|
|
269
|
-
| `insufficient` | 0.1–0.4 |
|
|
270
|
-
| `contradicted` | 0.0 |
|
|
271
|
-
| `error` |
|
|
305
|
+
| `entailed` | 0.9–1.0 | The quote fully covers the claim. |
|
|
306
|
+
| `partially_entailed` | 0.5–0.8 | The core is supported, details are missing. |
|
|
307
|
+
| `overstated` | 0.3–0.6 | The claim is stronger or more general than the quote. |
|
|
308
|
+
| `insufficient` | 0.1–0.4 | The quote is related but does not confirm the claim. |
|
|
309
|
+
| `contradicted` | 0.0 | The quote says the opposite. |
|
|
310
|
+
| `error` | none | The judge failed for this item; it is reported, never dropped. |
|
|
272
311
|
|
|
273
312
|
## How this differs from the alternatives
|
|
274
313
|
|
|
275
314
|
| | verbatim quote checked | claim↔evidence checked | model-agnostic | runtime |
|
|
276
315
|
| --- | --- | --- | --- | --- |
|
|
277
|
-
| **VeriQuote** | yes, deterministic | yes, pluggable judge | yes |
|
|
278
|
-
| [Anthropic Citations API](https://platform.claude.com/docs/en/build-with-claude/citations) |
|
|
279
|
-
| [LettuceDetect](https://github.com/KRLabsOrg/LettuceDetect) | no
|
|
280
|
-
| [RAGAS](https://github.com/explodinggradients/ragas) and eval frameworks | no | yes, as an offline metric | yes | Python, offline
|
|
316
|
+
| **VeriQuote** | yes, deterministic | yes, pluggable judge | yes | TypeScript, no dependencies, browser and edge |
|
|
317
|
+
| [Anthropic Citations API](https://platform.claude.com/docs/en/build-with-claude/citations) | not needed: spans are extracted, so they are real by construction | no | Claude only | hosted |
|
|
318
|
+
| [LettuceDetect](https://github.com/KRLabsOrg/LettuceDetect) | no quote protocol | yes, span-level model | yes | Python and model weights |
|
|
319
|
+
| [RAGAS](https://github.com/explodinggradients/ragas) and eval frameworks | no | yes, as an offline metric | yes | Python, offline evaluation |
|
|
281
320
|
|
|
282
321
|
**Use the Citations API instead** if you are on Claude and only need to know
|
|
283
|
-
that a span is real
|
|
322
|
+
that a span is real. It guarantees that by construction, which is stronger than
|
|
284
323
|
any matcher. It does not tell you whether the span supports the sentence built
|
|
285
|
-
on it
|
|
324
|
+
on it; for that, pair it with VeriQuote's judge and skip the matcher.
|
|
286
325
|
|
|
287
326
|
**Use LettuceDetect instead** if you want unsupported spans flagged in an
|
|
288
|
-
answer that
|
|
289
|
-
in Python. It solves the
|
|
290
|
-
model commits to in the first place.
|
|
291
|
-
|
|
292
|
-
VeriQuote's own niche is narrow and worth stating plainly: you want the
|
|
293
|
-
answering model pinned to a quote *before* it
|
|
294
|
-
deterministic half of the check to run anywhere including a browser
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
verbatim
|
|
302
|
-
|
|
303
|
-
labels.
|
|
327
|
+
answer that follows no citation protocol at all, and you are happy to run a
|
|
328
|
+
model in Python. It solves the problem after the fact; VeriQuote changes what
|
|
329
|
+
the answering model commits to in the first place.
|
|
330
|
+
|
|
331
|
+
VeriQuote's own niche is narrow, and worth stating plainly: you want the
|
|
332
|
+
answering model pinned to a quote *before* it writes, you want the
|
|
333
|
+
deterministic half of the check to run anywhere, including a browser, and you
|
|
334
|
+
want per-claim results you can show a reader rather than one score on a
|
|
335
|
+
dashboard.
|
|
336
|
+
|
|
337
|
+
The closest related work is a recent study by Zhang et al.[^zhang], which
|
|
338
|
+
evaluates the same design (inline verbatim quotes, tiered verbatim matching and
|
|
339
|
+
an LLM judge) on clinical guidelines. It found that `claude-opus-5` quoted
|
|
340
|
+
verbatim for 98.0% of its claims but fully substantiated only 37.1% of them.
|
|
341
|
+
VeriQuote is the reusable library, CLI and agent skill for that kind of check,
|
|
342
|
+
with its judge measured against human labels.
|
|
304
343
|
|
|
305
344
|
## Security
|
|
306
345
|
|
|
307
346
|
- **Keep your key on the server.** `ChatCompletionsJudge` needs an API key; in
|
|
308
|
-
your own app, call `verifyAnswer` from a backend.
|
|
309
|
-
the browser only with a key the visitor enters.
|
|
347
|
+
your own app, call `verifyAnswer` from a backend. The demo runs the judge in
|
|
348
|
+
the browser only with a key the visitor enters.
|
|
310
349
|
- **Source text is untrusted.** Judge inputs are length-capped, stripped of
|
|
311
|
-
control characters and HTML, and
|
|
312
|
-
|
|
313
|
-
and invented item IDs are rejected. Nothing is ever `eval`ed.
|
|
350
|
+
control characters and HTML, and marked as data in the prompt. The judge's
|
|
351
|
+
output is checked against a closed vocabulary: unknown classes, out-of-range
|
|
352
|
+
scores and invented item IDs are rejected. Nothing is ever `eval`ed.
|
|
314
353
|
|
|
315
354
|
## Reproducibility
|
|
316
355
|
|
|
317
|
-
The matcher is pure: same inputs
|
|
318
|
-
(pass `seed` where the provider supports it), but hosted
|
|
319
|
-
|
|
320
|
-
|
|
356
|
+
The matcher is pure: the same inputs always give the same score. The judge
|
|
357
|
+
runs at temperature 0 (pass `seed` where the provider supports it), but hosted
|
|
358
|
+
models are only deterministic on a best-effort basis. For strict
|
|
359
|
+
reproducibility, pin the model version or put a self-hosted model behind the
|
|
360
|
+
`EntailmentJudge` interface.
|
|
321
361
|
|
|
322
362
|
## Citing
|
|
323
363
|
|
|
324
|
-
If you use VeriQuote in academic work, please cite the
|
|
325
|
-
`CITATION.cff`).
|
|
364
|
+
If you use VeriQuote in academic work, please cite it[^veriquote]; the details
|
|
365
|
+
are also in [`CITATION.cff`](CITATION.cff).
|
|
326
366
|
|
|
327
367
|
## License
|
|
328
368
|
|
|
329
369
|
[MIT](LICENSE)
|
|
370
|
+
|
|
371
|
+
[^alce]: Gao, T., Yen, H., Yu, J., & Chen, D. (2023). Enabling large language models to generate text with citations. In *Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing* (pp. 6465–6488). Association for Computational Linguistics. https://doi.org/10.18653/v1/2023.emnlp-main.398
|
|
372
|
+
|
|
373
|
+
[^true]: Honovich, O., Aharoni, R., Herzig, J., Taitelbaum, H., Kukliansy, D., Cohen, V., Scialom, T., Szpektor, I., Hassidim, A., & Matias, Y. (2022). TRUE: Re-evaluating factual consistency evaluation. In *Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies* (pp. 3905–3920). Association for Computational Linguistics. https://doi.org/10.18653/v1/2022.naacl-main.287
|
|
374
|
+
|
|
375
|
+
[^zhang]: Zhang, J., Chen, Y., Commodore-Mensah, Y., & Oberst, M. (2026). *Verifiable by construction: Claim-level evaluation of verbatim citation in clinical question answering* (Version 2) [Preprint]. arXiv. https://doi.org/10.48550/arXiv.2609.15964
|
|
376
|
+
|
|
377
|
+
[^veriquote]: Heilmann, E. (2026). *VeriQuote: Deterministic and semantic verification of quote-grounded LLM citations* (Version 0.2.2) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.21552379
|
package/dist/cli/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAsC,MAAM,aAAa,CAAC;AAOvF,MA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uCAAuC;IACvC,KAAK,EAAE,OAAO,CAAC;IACf,oDAAoD;IACpD,KAAK,CAAC,EAAE,eAAe,CAAC;CACzB;AAED,eAAO,MAAM,IAAI;;;;CAA4C,CAAC;AAmG9D,wBAAsB,IAAI,CAAC,EAAE,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAsCrD"}
|
package/dist/cli/main.js
CHANGED
|
@@ -12,6 +12,7 @@ const HELP = `veriquote — check that an LLM answer's quotes exist in its sourc
|
|
|
12
12
|
|
|
13
13
|
Usage
|
|
14
14
|
veriquote prompt print the citation instructions for the answering model
|
|
15
|
+
veriquote source <url|file> print the text a source is checked against (quote from this)
|
|
15
16
|
veriquote check <answer> --source <url|file> [--source …]
|
|
16
17
|
veriquote check --job <file|-> JSON job: {"answer": "...", "sources": [{"text": "..."}]}
|
|
17
18
|
|
|
@@ -34,7 +35,7 @@ Judge (semantic support check), from the environment:
|
|
|
34
35
|
VERIQUOTE_JUDGE_MODEL required when a key is set
|
|
35
36
|
VERIQUOTE_JUDGE_BASE_URL default https://openrouter.ai/api/v1
|
|
36
37
|
|
|
37
|
-
Exit status: 0 pass · 2 revise · 1 error`;
|
|
38
|
+
Exit status: 0 pass · 2 revise · 1 error, or the judge failed (unverified)`;
|
|
38
39
|
class UsageError extends Error {
|
|
39
40
|
}
|
|
40
41
|
function parseArgs(argv) {
|
|
@@ -117,6 +118,13 @@ export async function main(io) {
|
|
|
117
118
|
return EXIT.pass;
|
|
118
119
|
case 'check':
|
|
119
120
|
return await check(args, io);
|
|
121
|
+
case 'source': {
|
|
122
|
+
if (args.positional.length !== 1)
|
|
123
|
+
throw new UsageError('source needs exactly one URL or file');
|
|
124
|
+
const src = await loadSource(args.positional[0], io);
|
|
125
|
+
io.stdout(`${src.text}\n`);
|
|
126
|
+
return EXIT.pass;
|
|
127
|
+
}
|
|
120
128
|
default:
|
|
121
129
|
throw new UsageError(`unknown command "${args.command}"`);
|
|
122
130
|
}
|
|
@@ -162,9 +170,21 @@ async function check(args, io) {
|
|
|
162
170
|
io.stdout(`${JSON.stringify({
|
|
163
171
|
verdict: gate.verdict,
|
|
164
172
|
judge: judgeSetup.model ?? null,
|
|
173
|
+
// The answer as the user should see it: [n] markers kept, {cX} markers and the appendix removed.
|
|
174
|
+
cleanAnswer: report.cleanText,
|
|
165
175
|
summary: report.summary,
|
|
166
176
|
problems: gate.problems,
|
|
167
177
|
uncited: gate.uncited,
|
|
178
|
+
unjudged: gate.unjudged,
|
|
179
|
+
citations: report.citations.map((c) => ({
|
|
180
|
+
claimId: c.claimId,
|
|
181
|
+
sourceIndex: c.sourceIndex,
|
|
182
|
+
match: { method: c.textMatch.method, score: round2(c.textMatch.score) },
|
|
183
|
+
judge: c.entailment
|
|
184
|
+
? { class: c.entailment.class, support: c.entailment.confidence === null ? null : round2(c.entailment.confidence) }
|
|
185
|
+
: null,
|
|
186
|
+
score: c.score === null ? null : round2(c.score),
|
|
187
|
+
})),
|
|
168
188
|
warnings: report.warnings,
|
|
169
189
|
sources: sources.map((s, i) => ({ index: i + 1, url: s.url, title: s.title, chars: s.text.length })),
|
|
170
190
|
instructionsForModel: gate.instructionsForModel,
|
|
@@ -173,8 +193,9 @@ async function check(args, io) {
|
|
|
173
193
|
else {
|
|
174
194
|
io.stdout(renderHuman(report, gate, sources, judgeSetup.model, io.color, args.minScore ?? 0.5));
|
|
175
195
|
}
|
|
176
|
-
return gate.verdict === 'pass' ? EXIT.pass : EXIT.revise;
|
|
196
|
+
return gate.verdict === 'pass' ? EXIT.pass : gate.verdict === 'revise' ? EXIT.revise : EXIT.error;
|
|
177
197
|
}
|
|
198
|
+
const round2 = (x) => Math.round(x * 100) / 100;
|
|
178
199
|
async function loadSource(ref, io) {
|
|
179
200
|
if (/^https?:\/\//i.test(ref)) {
|
|
180
201
|
return fetchSource(ref, {
|
|
@@ -242,14 +263,19 @@ function renderHuman(report, gate, sources, model, color, minScore) {
|
|
|
242
263
|
out.push(dim(`warning: ${w}`));
|
|
243
264
|
out.push('');
|
|
244
265
|
if (gate.verdict === 'pass') {
|
|
245
|
-
out.push(green(report.citations.length ? 'PASS' : 'PASS
|
|
266
|
+
out.push(green(report.citations.length ? 'PASS' : 'PASS, but the answer cites nothing'));
|
|
267
|
+
}
|
|
268
|
+
else if (gate.verdict === 'unverified') {
|
|
269
|
+
out.push(yellow(`UNVERIFIED: the judge failed on ${gate.unjudged.length} citation(s), so their support was not checked. Run the check again.`));
|
|
246
270
|
}
|
|
247
271
|
else {
|
|
248
272
|
const parts = [
|
|
249
273
|
gate.problems.length && `${gate.problems.length} failed citation(s)`,
|
|
250
274
|
gate.uncited.length && `${gate.uncited.length} uncited sentence(s)`,
|
|
251
275
|
].filter(Boolean);
|
|
252
|
-
out.push(red(`REVISE
|
|
276
|
+
out.push(red(`REVISE: ${parts.join(', ')}`));
|
|
277
|
+
if (gate.unjudged.length)
|
|
278
|
+
out.push(yellow(`The judge also failed on ${gate.unjudged.length} citation(s).`));
|
|
253
279
|
}
|
|
254
280
|
if (!model)
|
|
255
281
|
out.push(dim('Only checked that quotes exist in their sources. Set VERIQUOTE_JUDGE_API_KEY to check support.'));
|
package/dist/cli/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAmB,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAiBjE,MAAM,CAAC,MAAM,IAAI,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAW,CAAC;AAE9D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AC,CAAC;IAClJ,CAAC;SAAM,CAAC;QACN,MAAM,KAAK,GAAG;YACZ,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,qBAAqB;YACpE,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,sBAAsB;SACpE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAClB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QAC7C,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM;YAAE,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,4BAA4B,IAAI,CAAC,QAAQ,CAAC,MAAM,eAAe,CAAC,CAAC,CAAC;IAC9G,CAAC;IACD,IAAI,CAAC,KAAK;QAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,gGAAgG,CAAC,CAAC,CAAC;IAC5H,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AAC/B,CAAC;AAED,SAAS,QAAQ,CAAC,CAAS,EAAE,CAAS;IACpC,MAAM,IAAI,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAC3C,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC;AAC9D,CAAC"}
|
package/dist/gate.d.ts
CHANGED
|
@@ -30,11 +30,21 @@ export interface GateProblem {
|
|
|
30
30
|
score: number | null;
|
|
31
31
|
}
|
|
32
32
|
export interface GateResult {
|
|
33
|
-
|
|
33
|
+
/**
|
|
34
|
+
* `unverified`: nothing failed, but the judge could not rate some citations,
|
|
35
|
+
* so support was not checked for them. Never report that as a pass.
|
|
36
|
+
*/
|
|
37
|
+
verdict: 'pass' | 'revise' | 'unverified';
|
|
34
38
|
problems: GateProblem[];
|
|
35
39
|
/** Factual-looking sentences without any `[n]` marker. Heuristic. */
|
|
36
40
|
uncited: string[];
|
|
37
|
-
/**
|
|
41
|
+
/** Citations the judge failed on (only when a judge ran). */
|
|
42
|
+
unjudged: {
|
|
43
|
+
claimId: string;
|
|
44
|
+
sourceIndex: number;
|
|
45
|
+
reason: string;
|
|
46
|
+
}[];
|
|
47
|
+
/** Ready-to-send correction prompt; `null` unless the verdict is `revise`. */
|
|
38
48
|
instructionsForModel: string | null;
|
|
39
49
|
}
|
|
40
50
|
/** Apply the gate to a report produced by `verifyAnswer` for `answer`. */
|
package/dist/gate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../src/gate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAwB,eAAe,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAG5F,MAAM,WAAW,cAAc;IAC7B,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mEAAmE;IACnE,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,WAAW,GACnB,qBAAqB,GACrB,wBAAwB,GACxB,YAAY,GACZ,kBAAkB,CAAC;AAEvB,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7C,UAAU,EAAE;QAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC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O,EAAE,MAAM,EAAE,CAAC;IAClB,6DAA6D;IAC7D,QAAQ,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACrE,8EAA8E;IAC9E,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAID,0EAA0E;AAC1E,wBAAgB,UAAU,CACxB,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,MAAM,EACd,UAAU,GAAE,cAAmB,GAC9B,UAAU,CAgCZ"}
|
package/dist/gate.js
CHANGED
|
@@ -28,12 +28,16 @@ export function gateReport(report, answer, thresholds = {}) {
|
|
|
28
28
|
score: c.score === null ? null : round(c.score),
|
|
29
29
|
}));
|
|
30
30
|
const uncited = findUncitedSentences(stripEvi1Appendix(answer), t.minUncitedChars);
|
|
31
|
-
const
|
|
31
|
+
const unjudged = report.citations
|
|
32
|
+
.filter((c) => c.entailment?.class === 'error')
|
|
33
|
+
.map((c) => ({ claimId: c.claimId, sourceIndex: c.sourceIndex, reason: c.entailment?.reasons.join('; ') || 'judge error' }));
|
|
34
|
+
const verdict = problems.length || uncited.length ? 'revise' : unjudged.length ? 'unverified' : 'pass';
|
|
32
35
|
return {
|
|
33
36
|
verdict,
|
|
34
37
|
problems,
|
|
35
38
|
uncited,
|
|
36
|
-
|
|
39
|
+
unjudged,
|
|
40
|
+
instructionsForModel: verdict === 'revise' ? correctionInstructions(problems, uncited) : null,
|
|
37
41
|
};
|
|
38
42
|
}
|
|
39
43
|
function isProblem(c, minScore) {
|
package/dist/gate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate.js","sourceRoot":"","sources":["../src/gate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"gate.js","sourceRoot":"","sources":["../src/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;AAED,SAAS,QAAQ,CAAC,CAAS,EAAE,CAAS;IACpC,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC;AACrD,CAAC;AAED,SAAS,KAAK,CAAC,CAAS;IACtB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AACnC,CAAC"}
|
|
@@ -35,6 +35,13 @@ export interface ChatJudgeOptions {
|
|
|
35
35
|
quote?: number;
|
|
36
36
|
context?: number;
|
|
37
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* Extra fields merged into every request body, for provider-specific switches,
|
|
40
|
+
* e.g. `{ chat_template_kwargs: { enable_thinking: false } }` to turn off
|
|
41
|
+
* reasoning on vLLM-served hybrid models. Cannot override model, messages,
|
|
42
|
+
* temperature or response format.
|
|
43
|
+
*/
|
|
44
|
+
extraBody?: Record<string, unknown>;
|
|
38
45
|
/** Custom fetch (for testing or non-standard runtimes). Default globalThis.fetch. */
|
|
39
46
|
fetch?: typeof globalThis.fetch;
|
|
40
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-judge.d.ts","sourceRoot":"","sources":["../../src/judge/chat-judge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAIvG,eAAO,MAAM,kBAAkB,EAAE,SAAS,eAAe,EAMxD,CAAC;AAsBF,MAAM,WAAW,gBAAgB;IAC/B,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;IACd,iFAAiF;IACjF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,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4D;IAC5D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,IAAI,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACzE;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,qFAAqF;IACrF,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC;AAWD,qBAAa,oBAAqB,YAAW,eAAe;IAC1D,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAkB;gBAE3B,OAAO,EAAE,gBAAgB;IAiB/B,KAAK,CACT,KAAK,EAAE,eAAe,EAAE,EACxB,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GACjC,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAa9B,OAAO,CAAC,QAAQ;YAcF,UAAU;YAaV,gBAAgB;YAchB,OAAO;IAiDrB,OAAO,CAAC,YAAY;CAYrB"}
|
package/dist/judge/chat-judge.js
CHANGED
|
@@ -51,6 +51,7 @@ export class ChatCompletionsJudge {
|
|
|
51
51
|
maxRetries: options.maxRetries ?? 2,
|
|
52
52
|
seed: options.seed,
|
|
53
53
|
caps: { id: 80, claim: 700, quote: 700, context: 1200, ...options.caps },
|
|
54
|
+
extraBody: options.extraBody ?? {},
|
|
54
55
|
fetch: options.fetch ?? globalThis.fetch.bind(globalThis),
|
|
55
56
|
};
|
|
56
57
|
}
|
|
@@ -121,6 +122,7 @@ export class ChatCompletionsJudge {
|
|
|
121
122
|
},
|
|
122
123
|
signal: controller.signal,
|
|
123
124
|
body: JSON.stringify({
|
|
125
|
+
...this.opts.extraBody,
|
|
124
126
|
model: this.opts.model,
|
|
125
127
|
temperature: 0,
|
|
126
128
|
...(this.opts.seed !== undefined ? { seed: this.opts.seed } : {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-judge.js","sourceRoot":"","sources":["../../src/judge/chat-judge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,CAAC,MAAM,kBAAkB,GAA+B;IAC5D,UAAU;IACV,oBAAoB;IACpB,YAAY;IACZ,cAAc;IACd,cAAc;CACf,CAAC;AAEF,MAAM,aAAa,GAAG;IACpB,4DAA4D;IAC5D,kCAAkC;IAClC,sJAAsJ;IACtJ,sEAAsE;IACtE,+FAA+F;IAC/F,2FAA2F;CAC5F,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,MAAM,UAAU,GAAG;IACjB,uIAAuI;IACvI,gEAAgE;IAChE,kEAAkE;IAClE,uFAAuF;IACvF,sGAAsG;IACtG,wFAAwF;IACxF,uEAAuE;IACvE,8GAA8G;CAC/G,CAAC;
|
|
1
|
+
{"version":3,"file":"chat-judge.js","sourceRoot":"","sources":["../../src/judge/chat-judge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,CAAC,MAAM,kBAAkB,GAA+B;IAC5D,UAAU;IACV,oBAAoB;IACpB,YAAY;IACZ,cAAc;IACd,cAAc;CACf,CAAC;AAEF,MAAM,aAAa,GAAG;IACpB,4DAA4D;IAC5D,kCAAkC;IAClC,sJAAsJ;IACtJ,sEAAsE;IACtE,+FAA+F;IAC/F,2FAA2F;CAC5F,CAAC,IAAI,CAAC,GAAG,CAAC,C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C,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QAChF,CAAC,EACD,EAAE,IAAI,EAAE,IAAI,EAAE,CACf,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/source/html.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/source/html.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA0BH,mFAAmF;AACnF,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAQhD;AAED,0CAA0C;AAC1C,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAI1D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAMhE;AAED,mEAAmE;AACnE,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAc/C"}
|
package/dist/source/html.js
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
const DROP_ELEMENTS = /<(script|style|noscript|template|svg|iframe|head|object|canvas)\b[\s\S]*?<\/\1\s*>/gi;
|
|
8
8
|
const COMMENTS = /<!--[\s\S]*?-->/g;
|
|
9
|
+
/** Reference markers such as Wikipedia's [12]: models quoting the page leave them out. */
|
|
10
|
+
const REF_MARKERS = /<sup\b[^>]*class="[^"]*\breference\b[^"]*"[^>]*>[\s\S]*?<\/sup\s*>/gi;
|
|
9
11
|
const BLOCK_TAGS = /<\/?(?:p|div|br|hr|li|ul|ol|dl|dt|dd|h[1-6]|tr|table|thead|tbody|tfoot|section|article|aside|main|header|footer|nav|blockquote|pre|figure|figcaption|details|summary|form|fieldset|address)\b[^>]*>/gi;
|
|
10
12
|
const CELL_TAGS = /<\/?(?:td|th)\b[^>]*>/gi;
|
|
11
13
|
const ANY_TAG = /<[^>]+>/g;
|
|
@@ -55,6 +57,7 @@ export function htmlMainContent(html) {
|
|
|
55
57
|
export function htmlToText(html) {
|
|
56
58
|
const text = html
|
|
57
59
|
.replace(COMMENTS, '')
|
|
60
|
+
.replace(REF_MARKERS, '')
|
|
58
61
|
.replace(DROP_ELEMENTS, ' ')
|
|
59
62
|
.replace(BLOCK_TAGS, '\n')
|
|
60
63
|
.replace(CELL_TAGS, ' ')
|
package/dist/source/html.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/source/html.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,aAAa,GAAG,sFAAsF,CAAC;AAC7G,MAAM,QAAQ,GAAG,kBAAkB,CAAC;AACpC,MAAM,UAAU,GACd,uMAAuM,CAAC;AAC1M,MAAM,SAAS,GAAG,yBAAyB,CAAC;AAC5C,MAAM,OAAO,GAAG,UAAU,CAAC;AAE3B,MAAM,cAAc,GAA2B;IAC7C,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG;IAC3D,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG;IACvE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG;IACpF,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,IA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,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;YAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,MAAM,IAAI,GAAG,IAAI;SACd,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;SACxB,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC;SACzB,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;SACvB,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACxB,OAAO,cAAc,CAAC,IAAI,CAAC;SACxB,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;SACvD,IAAI,CAAC,IAAI,CAAC;SACV,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC;SAC1B,IAAI,EAAE,CAAC;AACZ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "veriquote",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Deterministic + semantic verification of quote-grounded LLM citations (EVI1 protocol): fuzzy verbatim-quote matching and an LLM entailment judge for transparent, per-claim hallucination detection.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"llm",
|
|
@@ -60,9 +60,11 @@
|
|
|
60
60
|
"bench:probe": "npm run build && node --env-file=.env bench/probe.mjs",
|
|
61
61
|
"bench:protocol": "npm run build && node --env-file=.env bench/protocol/run.mjs --json bench/results/protocol.json",
|
|
62
62
|
"bench:judge:prepare": "node bench/judge/prepare-alce.mjs",
|
|
63
|
-
"bench:judge": "npm run build && node --env-file=.env bench/judge/run.mjs"
|
|
63
|
+
"bench:judge": "npm run build && node --env-file=.env bench/judge/run.mjs",
|
|
64
|
+
"demo:lib": "esbuild src/index.ts --bundle --format=esm --minify --legal-comments=none --outfile=demo/lib/veriquote.js"
|
|
64
65
|
},
|
|
65
66
|
"devDependencies": {
|
|
67
|
+
"esbuild": "^0.25.12",
|
|
66
68
|
"typescript": "^5.5.0",
|
|
67
69
|
"vitest": "^3.0.0"
|
|
68
70
|
}
|
package/src/cli/main.ts
CHANGED
|
@@ -31,6 +31,7 @@ const HELP = `veriquote — check that an LLM answer's quotes exist in its sourc
|
|
|
31
31
|
|
|
32
32
|
Usage
|
|
33
33
|
veriquote prompt print the citation instructions for the answering model
|
|
34
|
+
veriquote source <url|file> print the text a source is checked against (quote from this)
|
|
34
35
|
veriquote check <answer> --source <url|file> [--source …]
|
|
35
36
|
veriquote check --job <file|-> JSON job: {"answer": "...", "sources": [{"text": "..."}]}
|
|
36
37
|
|
|
@@ -53,7 +54,7 @@ Judge (semantic support check), from the environment:
|
|
|
53
54
|
VERIQUOTE_JUDGE_MODEL required when a key is set
|
|
54
55
|
VERIQUOTE_JUDGE_BASE_URL default https://openrouter.ai/api/v1
|
|
55
56
|
|
|
56
|
-
Exit status: 0 pass · 2 revise · 1 error`;
|
|
57
|
+
Exit status: 0 pass · 2 revise · 1 error, or the judge failed (unverified)`;
|
|
57
58
|
|
|
58
59
|
interface Args {
|
|
59
60
|
command?: string;
|
|
@@ -147,6 +148,12 @@ export async function main(io: CliIo): Promise<number> {
|
|
|
147
148
|
return EXIT.pass;
|
|
148
149
|
case 'check':
|
|
149
150
|
return await check(args, io);
|
|
151
|
+
case 'source': {
|
|
152
|
+
if (args.positional.length !== 1) throw new UsageError('source needs exactly one URL or file');
|
|
153
|
+
const src = await loadSource(args.positional[0], io);
|
|
154
|
+
io.stdout(`${src.text}\n`);
|
|
155
|
+
return EXIT.pass;
|
|
156
|
+
}
|
|
150
157
|
default:
|
|
151
158
|
throw new UsageError(`unknown command "${args.command}"`);
|
|
152
159
|
}
|
|
@@ -191,9 +198,21 @@ async function check(args: Args, io: CliIo): Promise<number> {
|
|
|
191
198
|
{
|
|
192
199
|
verdict: gate.verdict,
|
|
193
200
|
judge: judgeSetup.model ?? null,
|
|
201
|
+
// The answer as the user should see it: [n] markers kept, {cX} markers and the appendix removed.
|
|
202
|
+
cleanAnswer: report.cleanText,
|
|
194
203
|
summary: report.summary,
|
|
195
204
|
problems: gate.problems,
|
|
196
205
|
uncited: gate.uncited,
|
|
206
|
+
unjudged: gate.unjudged,
|
|
207
|
+
citations: report.citations.map((c) => ({
|
|
208
|
+
claimId: c.claimId,
|
|
209
|
+
sourceIndex: c.sourceIndex,
|
|
210
|
+
match: { method: c.textMatch.method, score: round2(c.textMatch.score) },
|
|
211
|
+
judge: c.entailment
|
|
212
|
+
? { class: c.entailment.class, support: c.entailment.confidence === null ? null : round2(c.entailment.confidence) }
|
|
213
|
+
: null,
|
|
214
|
+
score: c.score === null ? null : round2(c.score),
|
|
215
|
+
})),
|
|
197
216
|
warnings: report.warnings,
|
|
198
217
|
sources: sources.map((s, i) => ({ index: i + 1, url: s.url, title: s.title, chars: s.text.length })),
|
|
199
218
|
instructionsForModel: gate.instructionsForModel,
|
|
@@ -205,9 +224,11 @@ async function check(args: Args, io: CliIo): Promise<number> {
|
|
|
205
224
|
} else {
|
|
206
225
|
io.stdout(renderHuman(report, gate, sources, judgeSetup.model, io.color, args.minScore ?? 0.5));
|
|
207
226
|
}
|
|
208
|
-
return gate.verdict === 'pass' ? EXIT.pass : EXIT.revise;
|
|
227
|
+
return gate.verdict === 'pass' ? EXIT.pass : gate.verdict === 'revise' ? EXIT.revise : EXIT.error;
|
|
209
228
|
}
|
|
210
229
|
|
|
230
|
+
const round2 = (x: number) => Math.round(x * 100) / 100;
|
|
231
|
+
|
|
211
232
|
async function loadSource(ref: string, io: CliIo): Promise<SourceDocument> {
|
|
212
233
|
if (/^https?:\/\//i.test(ref)) {
|
|
213
234
|
return fetchSource(ref, {
|
|
@@ -287,13 +308,16 @@ function renderHuman(
|
|
|
287
308
|
|
|
288
309
|
out.push('');
|
|
289
310
|
if (gate.verdict === 'pass') {
|
|
290
|
-
out.push(green(report.citations.length ? 'PASS' : 'PASS
|
|
311
|
+
out.push(green(report.citations.length ? 'PASS' : 'PASS, but the answer cites nothing'));
|
|
312
|
+
} else if (gate.verdict === 'unverified') {
|
|
313
|
+
out.push(yellow(`UNVERIFIED: the judge failed on ${gate.unjudged.length} citation(s), so their support was not checked. Run the check again.`));
|
|
291
314
|
} else {
|
|
292
315
|
const parts = [
|
|
293
316
|
gate.problems.length && `${gate.problems.length} failed citation(s)`,
|
|
294
317
|
gate.uncited.length && `${gate.uncited.length} uncited sentence(s)`,
|
|
295
318
|
].filter(Boolean);
|
|
296
|
-
out.push(red(`REVISE
|
|
319
|
+
out.push(red(`REVISE: ${parts.join(', ')}`));
|
|
320
|
+
if (gate.unjudged.length) out.push(yellow(`The judge also failed on ${gate.unjudged.length} citation(s).`));
|
|
297
321
|
}
|
|
298
322
|
if (!model) out.push(dim('Only checked that quotes exist in their sources. Set VERIQUOTE_JUDGE_API_KEY to check support.'));
|
|
299
323
|
return `${out.join('\n')}\n`;
|
package/src/gate.ts
CHANGED
|
@@ -33,11 +33,17 @@ export interface GateProblem {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export interface GateResult {
|
|
36
|
-
|
|
36
|
+
/**
|
|
37
|
+
* `unverified`: nothing failed, but the judge could not rate some citations,
|
|
38
|
+
* so support was not checked for them. Never report that as a pass.
|
|
39
|
+
*/
|
|
40
|
+
verdict: 'pass' | 'revise' | 'unverified';
|
|
37
41
|
problems: GateProblem[];
|
|
38
42
|
/** Factual-looking sentences without any `[n]` marker. Heuristic. */
|
|
39
43
|
uncited: string[];
|
|
40
|
-
/**
|
|
44
|
+
/** Citations the judge failed on (only when a judge ran). */
|
|
45
|
+
unjudged: { claimId: string; sourceIndex: number; reason: string }[];
|
|
46
|
+
/** Ready-to-send correction prompt; `null` unless the verdict is `revise`. */
|
|
41
47
|
instructionsForModel: string | null;
|
|
42
48
|
}
|
|
43
49
|
|
|
@@ -69,12 +75,16 @@ export function gateReport(
|
|
|
69
75
|
score: c.score === null ? null : round(c.score),
|
|
70
76
|
}));
|
|
71
77
|
const uncited = findUncitedSentences(stripEvi1Appendix(answer), t.minUncitedChars);
|
|
72
|
-
const
|
|
78
|
+
const unjudged = report.citations
|
|
79
|
+
.filter((c) => c.entailment?.class === 'error')
|
|
80
|
+
.map((c) => ({ claimId: c.claimId, sourceIndex: c.sourceIndex, reason: c.entailment?.reasons.join('; ') || 'judge error' }));
|
|
81
|
+
const verdict = problems.length || uncited.length ? 'revise' : unjudged.length ? 'unverified' : 'pass';
|
|
73
82
|
return {
|
|
74
83
|
verdict,
|
|
75
84
|
problems,
|
|
76
85
|
uncited,
|
|
77
|
-
|
|
86
|
+
unjudged,
|
|
87
|
+
instructionsForModel: verdict === 'revise' ? correctionInstructions(problems, uncited) : null,
|
|
78
88
|
};
|
|
79
89
|
}
|
|
80
90
|
|
package/src/judge/chat-judge.ts
CHANGED
|
@@ -61,11 +61,19 @@ export interface ChatJudgeOptions {
|
|
|
61
61
|
seed?: number;
|
|
62
62
|
/** Character caps applied to inputs before prompting. */
|
|
63
63
|
caps?: { id?: number; claim?: number; quote?: number; context?: number };
|
|
64
|
+
/**
|
|
65
|
+
* Extra fields merged into every request body, for provider-specific switches,
|
|
66
|
+
* e.g. `{ chat_template_kwargs: { enable_thinking: false } }` to turn off
|
|
67
|
+
* reasoning on vLLM-served hybrid models. Cannot override model, messages,
|
|
68
|
+
* temperature or response format.
|
|
69
|
+
*/
|
|
70
|
+
extraBody?: Record<string, unknown>;
|
|
64
71
|
/** Custom fetch (for testing or non-standard runtimes). Default globalThis.fetch. */
|
|
65
72
|
fetch?: typeof globalThis.fetch;
|
|
66
73
|
}
|
|
67
74
|
|
|
68
|
-
interface ResolvedOptions extends Required<Omit<ChatJudgeOptions, 'apiKey' | 'seed' | 'headers' | 'caps' | 'fetch'>> {
|
|
75
|
+
interface ResolvedOptions extends Required<Omit<ChatJudgeOptions, 'apiKey' | 'seed' | 'headers' | 'caps' | 'fetch' | 'extraBody'>> {
|
|
76
|
+
extraBody: Record<string, unknown>;
|
|
69
77
|
apiKey?: string;
|
|
70
78
|
seed?: number;
|
|
71
79
|
headers: Record<string, string>;
|
|
@@ -88,6 +96,7 @@ export class ChatCompletionsJudge implements EntailmentJudge {
|
|
|
88
96
|
maxRetries: options.maxRetries ?? 2,
|
|
89
97
|
seed: options.seed,
|
|
90
98
|
caps: { id: 80, claim: 700, quote: 700, context: 1200, ...options.caps },
|
|
99
|
+
extraBody: options.extraBody ?? {},
|
|
91
100
|
fetch: options.fetch ?? globalThis.fetch.bind(globalThis),
|
|
92
101
|
};
|
|
93
102
|
}
|
|
@@ -165,6 +174,7 @@ export class ChatCompletionsJudge implements EntailmentJudge {
|
|
|
165
174
|
},
|
|
166
175
|
signal: controller.signal,
|
|
167
176
|
body: JSON.stringify({
|
|
177
|
+
...this.opts.extraBody,
|
|
168
178
|
model: this.opts.model,
|
|
169
179
|
temperature: 0,
|
|
170
180
|
...(this.opts.seed !== undefined ? { seed: this.opts.seed } : {}),
|
package/src/source/html.ts
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
const DROP_ELEMENTS = /<(script|style|noscript|template|svg|iframe|head|object|canvas)\b[\s\S]*?<\/\1\s*>/gi;
|
|
9
9
|
const COMMENTS = /<!--[\s\S]*?-->/g;
|
|
10
|
+
/** Reference markers such as Wikipedia's [12]: models quoting the page leave them out. */
|
|
11
|
+
const REF_MARKERS = /<sup\b[^>]*class="[^"]*\breference\b[^"]*"[^>]*>[\s\S]*?<\/sup\s*>/gi;
|
|
10
12
|
const BLOCK_TAGS =
|
|
11
13
|
/<\/?(?:p|div|br|hr|li|ul|ol|dl|dt|dd|h[1-6]|tr|table|thead|tbody|tfoot|section|article|aside|main|header|footer|nav|blockquote|pre|figure|figcaption|details|summary|form|fieldset|address)\b[^>]*>/gi;
|
|
12
14
|
const CELL_TAGS = /<\/?(?:td|th)\b[^>]*>/gi;
|
|
@@ -61,6 +63,7 @@ export function htmlMainContent(html: string): string | undefined {
|
|
|
61
63
|
export function htmlToText(html: string): string {
|
|
62
64
|
const text = html
|
|
63
65
|
.replace(COMMENTS, '')
|
|
66
|
+
.replace(REF_MARKERS, '')
|
|
64
67
|
.replace(DROP_ELEMENTS, ' ')
|
|
65
68
|
.replace(BLOCK_TAGS, '\n')
|
|
66
69
|
.replace(CELL_TAGS, ' ')
|