Official Go SDK for the QWED Verification Protocol.
go get github.com/QWED-AI/qwed-verification/sdk-gopackage main
import (
"context"
"fmt"
"log"
qwed "github.com/QWED-AI/qwed-verification/sdk-go"
)
func main() {
// Create client
client := qwed.NewClient("your-api-key")
// Verify math
result, err := client.VerifyMath(context.Background(), "2 + 2 = 4")
if err != nil {
log.Fatal(err)
}
fmt.Printf("Verified: %v\n", result.Verified)
}- Zero Dependencies - Uses only Go standard library
- Context Support - All methods accept
context.Contextfor cancellation - Mockable - Implements
Verifierinterface for easy testing - Type Safe - Full type definitions for all requests/responses
| Method | Description |
|---|---|
Health(ctx) |
Check API health status |
Verify(ctx, query) |
Natural language verification |
VerifyMath(ctx, expr) |
Mathematical expression verification |
VerifyLogic(ctx, query) |
Logic/reasoning verification (Z3) |
VerifyCode(ctx, code, lang) |
Code security scanning |
VerifyFact(ctx, claim, context) |
Fact verification |
VerifySQL(ctx, query, schema, dialect) |
SQL validation |
VerifyBatch(ctx, items, opts) |
Batch verification |
client := qwed.NewClient("api-key",
qwed.WithBaseURL("https://api.qwedai.com"),
qwed.WithTimeout(30 * time.Second),
qwed.WithHTTPClient(customClient),
)The SDK provides a Verifier interface for easy mocking:
type Verifier interface {
Health(ctx context.Context) (map[string]interface{}, error)
Verify(ctx context.Context, query string) (*VerificationResponse, error)
VerifyMath(ctx context.Context, expression string) (*VerificationResponse, error)
// ... other methods
}
// In your tests:
type MockVerifier struct{}
func (m *MockVerifier) VerifyMath(ctx context.Context, expr string) (*qwed.VerificationResponse, error) {
return &qwed.VerificationResponse{Verified: true}, nil
}
// Use mock in your code that accepts Verifier interface
func ProcessData(v qwed.Verifier, data string) error {
result, err := v.VerifyMath(context.Background(), data)
// ...
}result, err := client.VerifyMath(ctx, "invalid")
if err != nil {
if qwedErr, ok := err.(*qwed.QWEDError); ok {
fmt.Printf("QWED Error [%s]: %s\n", qwedErr.Code, qwedErr.Message)
fmt.Printf("HTTP Status: %d\n", qwedErr.StatusCode)
}
}type VerificationResponse struct {
Status VerificationStatus `json:"status"`
Verified bool `json:"verified"`
Engine string `json:"engine,omitempty"`
Result map[string]interface{} `json:"result,omitempty"`
Attestation string `json:"attestation,omitempty"`
Error *ErrorInfo `json:"error,omitempty"`
Metadata *ResponseMetadata `json:"metadata,omitempty"`
}See the examples directory for complete usage examples.
Apache 2.0 - See LICENSE