Skip to main content

Installation

Quick start

Available components

QWEDTool

General-purpose verification tool:
QWEDTool sends its input to /verify/natural_language, which admits no result while the LLM’s translation of the query is unverified. So the tool says what holds for the translated expression and that it is not admitted. A claim proven false for that expression starts with ❌ INCORRECT for the translated expression, and a result QWED did not decide is ⚠️ UNVERIFIABLE: or ⛔ BLOCKED: followed by the server’s message.

Specialized tools

Changed in v10.0.0
The tools call a result wrong only when QWED decided it. A result QWED did not decide is reported with its status and the server’s message. QWEDLogicTool takes a question with its conditions and the claim to check, such as x is greater than 5. Is x greater than 3?. /verify/logic admits no result while the LLM’s translation of the query is unverified, so the tool reports a claim that follows as HOLDS, NOT ADMITTED. Constraints with no claim prove nothing, so the tool reports them as SATISFIABLE, NOT PROVEN, not as a verified answer.

QWEDVerificationCallback

Checks what it recognises in each LLM, chain and agent output: the math it finds, each fenced block (as SQL or as code, by its tag), and SQL outside a block, which it records as UNVERIFIABLE. Outside a block, it finds a statement by its keywords in capitals, such as SELECT ... FROM or DELETE FROM. Only a statement that creates, drops, alters or truncates a table is found in any case. Lowercase SQL such as delete from users; is not found, so it is not checked. Anything else, such as a claim in prose, is not checked.
The math check sends the output to /verify/natural_language, which admits no result while the LLM’s translation is unverified, so it logs verified=False. verify_sql is on by default: a SQL block is checked against sql_schema_ddl in sql_dialect (default sqlite). Without a schema, the SQL check records SQL as UNVERIFIABLE and sends nothing. Two other checks can still send SQL text: an untagged block that starts with a SQL statement is also checked as code, so with verify_code on it goes to /verify/code; and with verify_math on, an output the math check finds, such as one with WHERE id = 1, goes whole to /verify/natural_language. get_summary() counts an output as verified only when a check ran and every check verified it. SQL the callback did not find is not a check, so an output with an admitted code block and delete from users; in its text counts as verified.

QWEDVerifiedChain

Wrap any chain with verification:
The callback and QWEDVerifiedChain read the client’s is_verified, which follows the server’s admission: result.verified is True only when the server admitted the output, and a BLOCKED or UNVERIFIABLE result is never verified. QWEDVerifiedChain checks the output with client.verify(), which calls /verify/natural_language, so result.verified is False while that route admits no result. The tools call a result wrong only when QWED decided it.
Before v8.0.0 (GHSA-83v6-6h23-pvp4), the integrations read a verified attribute that QWEDClient results don’t have, so their checks raised. When you call QWEDClient directly, gate on result.is_verified.

LCEL integration

Use with LangChain Expression Language:

Best practices

  1. Use callbacks for monitoring — Track verification rates
  2. Use tools for agent autonomy — Let agents verify themselves
  3. Use wrappers for guarantees — Ensure all outputs are verified