Skip to main content

typesafe/
lib.rs

1//! Rust client for the [TypeSafe AI](https://typesafe.ai) System One API.
2//!
3//! Send a `state` and a map of typed questions — [`Noul`] (yes/no probability), [`Choice`]
4//! (one of N labels) and [`Score`] (ordered levels) — and get typed answers back.
5//!
6//! Behaviour follows the official Python SDK (`typesafe-sdk`): the same environment variables,
7//! defaults, retry semantics, error classification and forward-compatible decoding.
8//!
9//! Enable the `blocking` feature for a synchronous client in [`blocking`], and `reqwest-client`
10//! to supply your own `reqwest::Client`.
11#![warn(missing_docs)]
12
13mod client;
14pub mod constants;
15pub mod error;
16pub mod question;
17pub mod response;
18pub mod retry;
19
20#[cfg(feature = "blocking")]
21pub mod blocking;
22
23pub use client::{Client, ClientBuilder, ListModelsRequest, Models, SystemOneRequest};
24pub use error::{ApiError, ApiErrorKind, Error, ResponseValidationError, Result};
25pub use question::{Choice, Noul, NoulCriteria, Question, Questions, Score};
26pub use response::{
27    Answer, ChoiceAnswer, ListModelsResponse, ModelMetadata, NoulAnswer, ResponseMeta, ScoreAnswer,
28    SystemOneResponse, Usage,
29};
30pub use retry::RetryPolicy;
31
32/// Re-exported so callers can build headers without adding a dependency.
33pub use http;
34/// Re-exported so callers can build structured instructions/state without adding a dependency.
35pub use serde_json::{self, json};
36
37/// Compiles the README's code samples as doctests (they are not part of the rendered docs).
38#[cfg(doctest)]
39#[doc = include_str!("../README.md")]
40pub struct ReadmeDoctests;