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 /v9 suffix from 9.0.0. Releases are tagged sdk-go/vX.Y.Z. Pin a release with the version only:
If you upgrade from 8.x, change every sdk-go/v8 import to sdk-go/v9. See Upgrading to 9.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/logic, /verify/fact, /verify/rag, /verify/process, and batch logic and fact items) are therefore never admitted. The top-level verified that /verify/rag and /verify/process send is their guard’s own result. It stays 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 items always carry BLOCKED. Logic and 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