Skip to main content

Crate stateset_nsr_sdk

Crate stateset_nsr_sdk 

Source
Expand description

Stateset NSR Rust SDK

use stateset_nsr_sdk::NSRClient;

#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = NSRClient::new("nsr_api_key", "org_id");
    let response = client.chat("I want to cancel my subscription").await?;
    println!("Reply: {}", response.completion.reply);
    for tc in response.ready_tool_calls() {
        println!("Execute: {} (rule: {})", tc.function, tc.policy.rule_name);
    }
    Ok(())
}

Structs§

AdvancedReasoning
ApiKeyCreateRequest
ApiKeyCreateResponse
The plaintext key is shown ONLY in this creation response — store it.
ApiKeyListItem
ApiKeyListResponse
ApiKeyRevokeResponse
AuthResponse
POST /api/v1/auth/signup and /login response — carries the org’s API key.
AuthSessionResponse
AwsRegisterRequest
AzureRegisterRequest
BatchCreateRulesResponse
BatchCreateTriplesResponse
BatchDecisionItem
BatchDecisionResponse
POST /v1/decisions/batch response.
BatchInferRequest
BatchItemError
BatchSummary
BeliefConflictsResponse
BeliefResponse
CancelJobResponse
Category
ChatCompletion
ChatMessage
ChatResponse
CompletionGeneration
ConstraintResponse
ConstraintSpec
ConstraintViolationResponse
DecisionAction
The authorized action + its policy justification.
DecisionProof
DecisionRecord
One row of the ephemeral decision analytics log (GET /v1/decisions/recent, GET /v1/decisions/{id}).
DecisionRefusal
DecisionResponse
One verified decision (POST /v1/decisions): approved | denied | refused, with a cited proof chain and per-decision usage.
DecisionUsage
Per-decision metering.
Entity
GraphAnalysisResponse
GroundingEvidence
GroundingSnapshot
JobListParams
Query parameters for GET /api/v1/jobs, which does NOT speak the standard ListParams dialect: it accepts limit/offset plus sort_by (created_at | updated_at) and sort_order (asc | desc) — no cursor, no --prefixed sort.
JobStatusResponse
JobSubmitResponse
KBEntityEvidence
KBRuleEvidence
KBStats
ListConstraintsResponse
ListJobsResponse
ListParams
Standard pagination/sorting query parameters for list endpoints (see the server’s pagination module: limit/offset or cursor, plus sort with an optional - descending prefix).
MachineStatus
ModifyBeliefResponse
NSRClient
Client for the Stateset NSR AI platform.
OutcomeUsage
Outcome-based billing metrics.
PolicyEvaluateResponse
PolicyInferResponse
ProofVerifyResponse
Verdict from POST /v1/proofs/verify — always 200; an unsound proof is a valid answer (verified: false plus the located reason), not an error.
QueryResponse
RecentDecisionsResponse
A page of recent decision analytics rows (GET /v1/decisions/recent).
Rule
RuleAtom
One body atom of a rule.
RuleLintResponse
POST /api/v1/rules/lint — diagnostics only; the rule is NOT installed.
RuleSpec
A rule specification, as accepted by create/lint/batch rule endpoints.
RuleUpdate
PATCH /api/v1/rules/:id — only the provided fields are changed.
SymbolicAnalysis
ToolCall
ToolCallPolicy
TrainingExample
TriplePattern
One triple pattern for POST /api/v1/query; use ?var for variables.
TripleSpec
UncertaintyEstimate
UsageAccount
Tenant account posture for outcome production and prepaid runway.
UsageResponse
ValidateConstraintsResponse

Enums§

ConstraintStrength
Constraint strength: hard, soft { tolerance }, or weighted { weight }.
NSRError
Error type for NSR API operations.

Functions§

verify_webhook_signature
Verify an NSR webhook delivery (X-NSR-Signature header).