Expand description
Rust client for the TypeSafe AI System One API.
Send a state and a map of typed questions — Noul (yes/no probability), Choice
(one of N labels) and Score (ordered levels) — and get typed answers back.
Behaviour follows the official Python SDK (typesafe-sdk): the same environment variables,
defaults, retry semantics, error classification and forward-compatible decoding.
Enable the blocking feature for a synchronous client in blocking, reqwest-client
to supply your own reqwest::Client, and derive for #[derive(Rubric)]: a struct that
describes the questions and receives the answers (see rubric).
Re-exports§
pub use error::ApiError;pub use error::ApiErrorKind;pub use error::Error;pub use error::ResponseValidationError;pub use error::Result;pub use question::Choice;pub use question::Noul;pub use question::NoulCriteria;pub use question::Question;pub use question::Questions;pub use question::Score;pub use response::Answer;pub use response::ChoiceAnswer;pub use response::ListModelsResponse;pub use response::ModelMetadata;pub use response::NoulAnswer;pub use response::ResponseMeta;pub use response::ScoreAnswer;pub use response::SystemOneResponse;pub use response::Usage;pub use retry::RetryPolicy;pub use rubric::AskRequest;pub use rubric::ChoiceOf;pub use rubric::Rubric;pub use rubric::RubricChoice;pub use http;pub use serde_json;
Modules§
- blocking
- Synchronous client (feature
blocking). Each client owns a private current-thread Tokio runtime; do not call it from inside an async context. - cassette
- Record and replay: System One responses kept on disk, one file per request.
- constants
- Environment-variable names, defaults and protocol constants.
- error
- Error types.
- question
- Typed questions:
Noul,ChoiceandScore. - response
- Answers and response metadata.
- retry
- Retry configuration. Semantics match the Python SDK’s
RetryPolicy(Tenacity-based): exponential backoff with subtractive jitter,Retry-After/retry-after-mssupport, a max retry count, and a total time budget that stops before a sleep that would exceed it. - rubric
- Rubrics as types: a struct describes the questions, and the answers come back into it.
Macros§
- json
- Re-exported so callers can build structured instructions/state without adding a dependency.
Construct a
serde_json::Valuefrom a JSON literal.
Structs§
- Client
- TypeSafe API client. Cheap to clone; clones share the connection pool.
- Client
Builder - Builder for
Client. Explicit settings win over environment variables; empty or whitespace-only environment values are ignored. - List
Models Request - A pending
GET /v1/models. - Models
- The Models resource.
- System
OneRequest - A pending
POST /v1/systemone. Configure it, then.awaitit (or callsend).
Derive Macros§
- Rubric
#[derive(Rubric)]and#[derive(RubricChoice)](featurederive); seerubric. Implementtypesafe::rubric::Rubricfor a struct whose fields are the questions.- Rubric
Choice #[derive(Rubric)]and#[derive(RubricChoice)](featurederive); seerubric. Implementtypesafe::rubric::RubricChoice(andFromStr) for an enum whose variants are the options of a choice.