Skip to main content

Installation

The module lives in the sdk-go/ subdirectory and follows the main QWED version line, so its import path carries the /v11 suffix from 11.0.0. Releases are tagged sdk-go/vX.Y.Z. Pin a release with the version only:
If you upgrade from 10.x, change every sdk-go/v10 import to sdk-go/v11. See Upgrading to 11.0.0.

Quick start

Configuration

Pass options to NewClient to point the client at your self-hosted QWED server or change the timeout. There is no hosted QWED API, so set the base URL to the server you run.

Reading a result

Every verification method returns a *VerificationResponse that models the server’s DiagnosticResult envelope. Numbers in Extra and DeveloperFields decode as json.Number, so they keep their exact text. json.Marshal writes Extra back beside the envelope fields. An Extra key never replaces an envelope field.

Gate on IsAdmitted()

Use IsAdmitted() to decide whether to act on a result. Don’t gate on Status alone. VERIFIED means the engine reached a deterministic answer, not that the claim holds. 2 + 2 = 5 returns VERIFIED · BLOCKED because it’s proven false. Unsafe code returns VERIFIED · BLOCKED because it’s proven unsafe. IsAdmitted() returns true only when all of these hold:
  • Admission is AdmissionAdmit
  • Status is StatusVerified
  • ProofRef is non-empty
A missing or unknown admission is never admitted. Endpoints that make no admission decision (/verify/fact, /verify/rag, /verify/process, and batch fact items) are therefore never admitted. /verify/logic and batch logic items decide one as /verify/natural_language does: their verdict covers the constraints an LLM translated the question into, so the admission is AdmissionBlocked until QWED verifies the translation itself. /verify/rag and /verify/process return StatusUnverifiable: what their guards check comes from the request itself, so the guard’s result is advisory only, in developer_fields.advisory_checks. An older server also sent the guard’s result as a top-level verified; it is kept in Extra["verified"] and DeveloperFields["verified"].
The Verified field and qwed.IsVerified() are deprecated. Decoding always sets Verified to IsAdmitted(), whatever the body says, and IsVerified() returns IsAdmitted().

Methods

Verify

VerifyMath

VerifyLogic

VerifyCode

VerifyFact

VerifySQL

VerifyBatch

VerifyBatch returns a *BatchResponse that mirrors the server’s batch job. Each item’s verification answer is in item.Result. Call IsAdmitted() on each item. There is no aggregate Summary. Math, code, and SQL items carry their route’s admission, so a proven item can be admitted. Natural-language and logic items always carry BLOCKED. Fact items make no decision, so they’re never admitted.
A batch SQL item needs params.schema_ddl. The server fails an item without it with Missing 'schema_ddl'. The SDK’s batch items send only a query and a type, so verify SQL with VerifySQL instead of in a batch.

Types

Error handling