Product-Claim Checks with NLI
Objective
Catalog copy drifts: a rewrite adds "waterproof" to a lamp whose specification says nothing about water. Verify marketing claims against the SKU's specification before publication — and choose deliberately what happens to claims the spec neither supports nor denies.
Step 1: A claim the specification supports
curl -s -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{
"model": "nli-default",
"statement": "The Atlas lamp can be charged using USB-C.",
"truth_anchors": ["The Atlas lamp supports charging through a USB-C port."],
"closed_world": false,
"contradiction_threshold": 0.6, "entailment_threshold": 0.6
}' http://localhost:8080/v1/ai/nli/verify
Expected (verified on v2.1.1-ce): verdict TRUTH, entailment 1.00 — the claim restates the spec.
Step 2: An unlisted claim, open world
curl -s -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{
"model": "nli-default",
"statement": "The Atlas lamp is waterproof.",
"truth_anchors": ["The Atlas lamp has a USB-C charging port."],
"closed_world": false,
"contradiction_threshold": 0.6, "entailment_threshold": 0.6
}' http://localhost:8080/v1/ai/nli/verify
Expected (verified): verdict UNVERIFIED_PLAUSIBLE, neutral 0.99 — a charging spec says nothing about water resistance. Open world preserves the uncertainty for a reviewer.
Step 3: The same claim, closed world — a publish gate
curl -s -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{
"model": "nli-default",
"statement": "The Atlas lamp is waterproof.",
"truth_anchors": ["The Atlas lamp has a USB-C charging port."],
"closed_world": true,
"contradiction_threshold": 0.6, "entailment_threshold": 0.6
}' http://localhost:8080/v1/ai/nli/verify
Expected (verified): verdict LIE with violated_anchor: null — nothing contradicted
the claim; closed-world policy refuses to certify what the evidence does not
establish. The scores are identical to Step 2: world mode changes policy, not
the inferred relation.
Use it from your app
Run the gate on every copy change against the SKU's current specification revision. An unsupported claim is not proof the feature is false — it is a publication block until someone supplies evidence. Matching the right SKU, variant, and spec revision is exact-identity work your application does first.
Key Concepts Learned
- Open world = review queue; closed world = publish gate. Same scores, different policy.
- "Not supported by the spec" and "false" are different verdicts; NLI gives you the first.