Ground checks each sentence of an answer against the source text it should come from and flags the ones the source doesn't support. Use it after RAG: send the retrieved context in context and your model's answer as input.
You get a score for the whole answer (the weakest sentence) and a score per sentence, so you can highlight or drop the unsupported parts.
Use it
curl https://labs.greatwork.company/v1/run \
-H "Authorization: Bearer $GWL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "ground-1",
"context": "The Eiffel Tower was completed in 1889 for the World'\''s Fair in Paris. It is 330 meters tall and was the tallest structure in the world until 1930.",
"input": "The Eiffel Tower was finished in 1889. It was built for the Olympic Games and is about 330 meters tall."
}'const res = await fetch("https://labs.greatwork.company/v1/run", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.GWL_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"model": "ground-1",
"context": "The Eiffel Tower was completed in 1889 for the World's Fair in Paris. It is 330 meters tall and was the tallest structure in the world until 1930.",
"input": "The Eiffel Tower was finished in 1889. It was built for the Olympic Games and is about 330 meters tall."
}),
});
const { output, usage } = await res.json();import os, requests
res = requests.post(
"https://labs.greatwork.company/v1/run",
headers={"Authorization": f"Bearer {os.environ['GWL_API_KEY']}"},
json={
"model": "ground-1",
"context": "The Eiffel Tower was completed in 1889 for the World's Fair in Paris. It is 330 meters tall and was the tallest structure in the world until 1930.",
"input": "The Eiffel Tower was finished in 1889. It was built for the Olympic Games and is about 330 meters tall."
},
)
output = res.json()["output"]Set GWL_API_KEY to a key from your dashboard. The bare name ground works too and follows new versions.
Options
input: The answer or claim to check (a string, up to 8,000 characters).
| Name | Type | Default | What it does |
|---|---|---|---|
context required | string | The source text the answer should be based on (up to 8,000 characters). | |
threshold | number | 0.5 | Score at or above which a sentence counts as supported. |
Output
| Field | Type | Meaning |
|---|---|---|
supported | boolean | True when every sentence is supported. |
score | number | Support score of the weakest sentence, 0 to 1. |
sentences | object[] | Each sentence: text, score, supported. |
Every response wraps this in {"id", "model", "output", "usage": {"units", "unit", "cost_usd"}, "latency_ms"}.
Examples
Half right
{
"model": "ground-1",
"context": "The Eiffel Tower was completed in 1889 for the World's Fair in Paris. It is 330 meters tall and was the tallest structure in the world until 1930.",
"input": "The Eiffel Tower was finished in 1889. It was built for the Olympic Games and is about 330 meters tall."
}{
"supported": false,
"score": 0.3905,
"sentences": [
{
"text": "The Eiffel Tower was finished in 1889.",
"score": 0.9686,
"supported": true
},
{
"text": "It was built for the Olympic Games and is about 330 meters tall.",
"score": 0.3905,
"supported": false
}
]
}Captured on our production servers: 173 ms, 2 sentences, $0.00008.
Supported
{
"model": "ground-1",
"context": "Our Pro plan costs $29 per month and includes 10 seats. Annual billing saves 20%.",
"input": "Pro is $29 a month with 10 seats included."
}{
"supported": true,
"score": 0.8851,
"sentences": [
{
"text": "Pro is $29 a month with 10 seats included.",
"score": 0.8851,
"supported": true
}
]
}Captured on our production servers: 52 ms, 1 sentence, $0.00004.
Good for
- Flag unsupported claims in RAG answers
- Score summaries against their source
- Check generated product descriptions against specs
- Gate answers before they reach a customer
Limits and caveats
- Judges against the context only: a true fact the context doesn't contain is unsupported.
- Arithmetic and date inferences are often marked unsupported.
- Some paraphrases are missed.
Pricing
$0.04 per 1,000 sentences. One unit per sentence of the answer checked against the context. Failed calls aren't charged, and a call never costs more than its estimate (POST /v1/estimate tells you before you run it).
Built on
Horizon-Labs/hallucination-guard-small, 141M (mmBERT-small encoder) parameters. License: Apache-2.0. We run it on our servers with our own long-text chunking and score aggregation.