Passage selection and answer verification
Selects the passage that best answers a question and checks whether a generated answer is supported by its sources. These are separate functions.
Example
Input
Does the warranty on my Aster 2 heat pump still apply if I skip the annual service?
Labels (the options)
- p1
- 4.1 Aster 2 heat pumps installed on or after 1 March 2026 carry a seven-year parts and labour warranty from the date of installation, subject to clause 4.3.
- p2
- 4.3 The warranty remains valid only if the unit is serviced at least once every 12 months by a Fenwick-approved engineer. If a service is missed, the warranty ends on the date the service was due and cannot be reinstated.
- p3
- 6.2 To book a service, call 0161 496 0123 or use the customer portal. Services are available Monday to Saturday, 8:00 to 18:00.
- none
- None of the passages answers the question.
- Answer (JSON)
- value p2, confidence 1
- Top options
- p2 1
- p1 0
- none 0
Of three warranty clauses, only the one on missed annual services says what happens to the warranty, so the pick is p2.
import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client: decide = client.function("jeff.retrieval.ground.rerank", labels={ "p1": "4.1 Aster 2 heat pumps installed on or after 1 March 2026 carry a seven-year parts and labour warranty from the date of installation, subject to clause 4.3.", "p2": "4.3 The warranty remains valid only if the unit is serviced at least once every 12 months by a Fenwick-approved engineer. If a service is missed, the warranty ends on the date the service was due and cannot be reinstated.", "p3": "6.2 To book a service, call 0161 496 0123 or use the customer portal. Services are available Monday to Saturday, 8:00 to 18:00.", "none": "None of the passages answers the question.", }) decision = decide("Does the warranty on my Aster 2 heat pump still apply if I skip the annual service?") print(decision.value, decision.confidence)
More examples
Heat pump warranty after March 2026answer p2 · confidence 0.999
Input
How long is the warranty on an Aster 2 heat pump installed after March 2026?
Labels (the options)
- p1
- Aster 1 heat pumps carry a five-year parts and labour warranty from the date of installation.
- p2
- For Aster 2 units installed on or after 1 March 2026 the warranty is extended to seven years, parts and labour.
- p3
- Our boilers come with a two-year warranty as standard.
- none
- None of the passages answers the question.
- Answer (JSON)
- value p2, confidence 0.999
- Top options
- p2 0.999
- none 0
- p3 0
Only the second passage covers the Aster 2 installed after March 2026, so the pick is
p2.import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client: decide = client.function("jeff.retrieval.ground.rerank", labels={ "p1": "Aster 1 heat pumps carry a five-year parts and labour warranty from the date of installation.", "p2": "For Aster 2 units installed on or after 1 March 2026 the warranty is extended to seven years, parts and labour.", "p3": "Our boilers come with a two-year warranty as standard.", "none": "None of the passages answers the question.", }) decision = decide("How long is the warranty on an Aster 2 heat pump installed after March 2026?") print(decision.value, decision.confidence)
Seven-year warranty answeranswer supported · confidence 0.996
Context
- sources
- - Passage 1: Aster 1 heat pumps carry a five-year parts and labour warranty from the date of installation. - Passage 2: For Aster 2 units installed on or after 1 March 2026 the warranty is extended to seven years, parts and labour, provided the unit is serviced every year by an approved engineer.
Input
An Aster 2 installed after March 2026 has a seven-year parts and labour warranty, as long as it is serviced every year by an approved engineer.
- Answer (JSON)
- value supported, confidence 0.996
- Top options
- supported 0.996
- partly_supported 0.003
- contradicted 0.001
The answer's seven years, its cover and its service condition are all in the second source, so it is
supported.import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client: decide = client.function("jeff.retrieval.ground.grounding", context={ "sources": [ "Passage 1: Aster 1 heat pumps carry a five-year parts and labour warranty from the date of installation.", "Passage 2: For Aster 2 units installed on or after 1 March 2026 the warranty is extended to seven years, parts and labour, provided the unit is serviced every year by an approved engineer.", ], }) decision = decide("An Aster 2 installed after March 2026 has a seven-year parts and labour warranty, as long as it is serviced every year by an approved engineer.") print(decision.value, decision.confidence)
Answer that adds a promise the sources do not makeanswer partly_supported · confidence 0.994
Context
- sources
- - Passage 1: Aster 1 heat pumps carry a five-year parts and labour warranty from the date of installation. - Passage 2: For Aster 2 units installed on or after 1 March 2026 the warranty is extended to seven years, parts and labour, provided the unit is serviced every year by an approved engineer.
Input
An Aster 2 installed after March 2026 has a seven-year parts and labour warranty, and the annual service is free during that time.
- Answer (JSON)
- value partly_supported, confidence 0.994
- Top options
- partly_supported 0.994
- contradicted 0.003
- supported 0.001
The seven-year warranty is in the sources but the free annual service is not, so the answer is
partly_supported.import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client: decide = client.function("jeff.retrieval.ground.grounding", context={ "sources": [ "Passage 1: Aster 1 heat pumps carry a five-year parts and labour warranty from the date of installation.", "Passage 2: For Aster 2 units installed on or after 1 March 2026 the warranty is extended to seven years, parts and labour, provided the unit is serviced every year by an approved engineer.", ], }) decision = decide("An Aster 2 installed after March 2026 has a seven-year parts and labour warranty, and the annual service is free during that time.") print(decision.value, decision.confidence)
Answer with the wrong number of yearsanswer contradicted · confidence 0.943
Context
- sources
- - Passage 1: Aster 1 heat pumps carry a five-year parts and labour warranty from the date of installation. - Passage 2: For Aster 2 units installed on or after 1 March 2026 the warranty is extended to seven years, parts and labour, provided the unit is serviced every year by an approved engineer.
Input
An Aster 2 installed after March 2026 has a five-year parts and labour warranty.
- Answer (JSON)
- value contradicted, confidence 0.943
- Top options
- contradicted 0.943
- supported 0.044
- partly_supported 0.01
The sources give seven years for an Aster 2 installed after March 2026 and the answer says five, so it is
contradicted.import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client: decide = client.function("jeff.retrieval.ground.grounding", context={ "sources": [ "Passage 1: Aster 1 heat pumps carry a five-year parts and labour warranty from the date of installation.", "Passage 2: For Aster 2 units installed on or after 1 March 2026 the warranty is extended to seven years, parts and labour, provided the unit is serviced every year by an approved engineer.", ], }) decision = decide("An Aster 2 installed after March 2026 has a five-year parts and labour warranty.") print(decision.value, decision.confidence)
Use when
- Your retrieval pipeline needs to select the best passage or determine that none answers the question.
- You need to verify a generated answer against its sources before displaying it.
Avoid when
- You need to generate an answer or identify the specific unsupported claim; this adapter returns a selection or verdict.
- You need an assessment based on outside knowledge; this adapter uses only the supplied sources.
Context and input
| Field | Kind | Description |
|---|---|---|
answer | input | The answer to check. |
sources | context | The source passages the answer was written from, each with a short label such as "Document A: Title" or "Source 1". |
Functions
| Key | Interface | Instructions | Labels |
|---|---|---|---|
| grounding | is_supported | Is the answer supported by the sources? Judge only from the sources, not from outside knowledge. | supported, partly_supported, contradicted, unsupported |
| rerank | classify | Which passage answers the question? If none of them does, choose none. | from the caller |
| Uses its own request shape, not the adapter's: input question (The question to find an answering passage for; the passages are the options, each as p1, p2, ... with its text.). context: none. | |||
How it was measured
Test accuracy: the share of test rows whose top answer was right.
- 96.6% on passages from public data sets (SQuAD 2.0, HotpotQA, FEVER) and LLM-written documents, held out by source document, with LLM-made changes for the partly supported, contradicted and unsupported cases (4,160 rows). mixed sources
When confident
From the calibration set: at or above the threshold confidence, how often the answer is right, and how often the adapter is that confident. Below it, escalate.
| Function | Right when confident | Confident on | Threshold | Calibration rows |
|---|---|---|---|---|
| grounding | 98.0% | 98.1% | 0.63 | 720 |
| rerank | 98.0% | 91.0% | 0.80 | 720 |
Base: Jeff v1.4. Adapter trained: 25 October 2026.
Base
jeff-base v1.4
Call it
jeff.retrieval.ground.grounding, with placeholders for its input and context.
import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client: decide = client.function("jeff.retrieval.ground.grounding", context={ "sources": "<sources>", }) decision = decide("<answer>") print(decision.value, decision.confidence)
Download
Weights: mstrasser/jeff-adapter-ground (v1.4)
Licence: Apache-2.0