Skip to content

About

A rust client for the TypeSafe AI API

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

typesafe-rs

Async Rust client and JSON-first CLI for the TypeSafe API.

CLI

Install from this checkout:

cargo install --path cli --locked
export TYPESAFE_API_KEY='your-api-key'

# Read a file or piped stdin
 typesafe request.json
 typesafe < request.json

A request:

{"state":"Payouts are blocked","questions":{"urgent":{"type":"noul","instructions":"Is this urgent?"}}}
  • Question types: noul (yes/no probability), choice, score.
  • Options: --model NAME, --url URL, --pretty, --help.
  • Success: JSON on stdout, exit 0. Errors: JSON on stderr with error and kind; API errors also include status and body.
  • Exit 2: usage, input, or configuration. Exit 1: request, response, or output failure.
  • HTTP timeout: 60 seconds, no automatic retries.

Rust

Requires a Tokio runtime with I/O and timers enabled.

use typesafe_rs::{Client, Question};

let response = Client::from_env()?
    .evaluate("Payouts are blocked", [("urgent", Question::noul("Urgent?"))])
    .await?;

See the runnable example. Use Client::with_http_client to configure timeouts, TLS, or proxies; the library has no default request timeout.

MIT.

About

A rust client for the TypeSafe AI API

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages