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§
- Advanced
Reasoning - ApiKey
Create Request - ApiKey
Create Response - The plaintext
keyis shown ONLY in this creation response — store it. - ApiKey
List Item - ApiKey
List Response - ApiKey
Revoke Response - Auth
Response POST /api/v1/auth/signupand/loginresponse — carries the org’s API key.- Auth
Session Response - AwsRegister
Request - Azure
Register Request - Batch
Create Rules Response - Batch
Create Triples Response - Batch
Decision Item - Batch
Decision Response POST /v1/decisions/batchresponse.- Batch
Infer Request - Batch
Item Error - Batch
Summary - Belief
Conflicts Response - Belief
Response - Cancel
JobResponse - Category
- Chat
Completion - Chat
Message - Chat
Response - Completion
Generation - Constraint
Response - Constraint
Spec - Constraint
Violation Response - Decision
Action - The authorized action + its policy justification.
- Decision
Proof - Decision
Record - One row of the ephemeral decision analytics log
(
GET /v1/decisions/recent,GET /v1/decisions/{id}). - Decision
Refusal - Decision
Response - One verified decision (
POST /v1/decisions):approved | denied | refused, with a cited proof chain and per-decision usage. - Decision
Usage - Per-decision metering.
- Entity
- Graph
Analysis Response - Grounding
Evidence - Grounding
Snapshot - JobList
Params - Query parameters for
GET /api/v1/jobs, which does NOT speak the standardListParamsdialect: it acceptslimit/offsetplussort_by(created_at|updated_at) andsort_order(asc|desc) — no cursor, no--prefixedsort. - JobStatus
Response - JobSubmit
Response - KBEntity
Evidence - KBRule
Evidence - KBStats
- List
Constraints Response - List
Jobs Response - List
Params - Standard pagination/sorting query parameters for list endpoints
(see the server’s
paginationmodule: limit/offset or cursor, plussortwith an optional-descending prefix). - Machine
Status - Modify
Belief Response - NSRClient
- Client for the Stateset NSR AI platform.
- Outcome
Usage - Outcome-based billing metrics.
- Policy
Evaluate Response - Policy
Infer Response - Proof
Verify Response - Verdict from
POST /v1/proofs/verify— always 200; an unsound proof is a valid answer (verified: falseplus the located reason), not an error. - Query
Response - Recent
Decisions Response - A page of recent decision analytics rows (
GET /v1/decisions/recent). - Rule
- Rule
Atom - One body atom of a rule.
- Rule
Lint Response POST /api/v1/rules/lint— diagnostics only; the rule is NOT installed.- Rule
Spec - A rule specification, as accepted by create/lint/batch rule endpoints.
- Rule
Update PATCH /api/v1/rules/:id— only the provided fields are changed.- Symbolic
Analysis - Tool
Call - Tool
Call Policy - Training
Example - Triple
Pattern - One triple pattern for
POST /api/v1/query; use?varfor variables. - Triple
Spec - Uncertainty
Estimate - Usage
Account - Tenant account posture for outcome production and prepaid runway.
- Usage
Response - Validate
Constraints Response
Enums§
- Constraint
Strength - Constraint strength:
hard,soft { tolerance }, orweighted { weight }. - NSRError
- Error type for NSR API operations.
Functions§
- verify_
webhook_ signature - Verify an NSR webhook delivery (
X-NSR-Signatureheader).