Class: TypeSafeClient¶
Client for the TypeSafe AI API.
Constructors¶
Constructor¶
Create a client for the TypeSafe AI API.
Explicit options take precedence over environment variables, then SDK defaults. Empty or whitespace-only environment values are ignored.
Parameters¶
config?¶
TypeSafeClientConfig = {}
Returns¶
TypeSafeClient
Throws¶
The API key is missing, configuration is invalid, or the runtime is unsupported.
Properties¶
baseURL¶
API root with trailing slashes removed.
defaultHeaders¶
Additional headers sent with each request.
defaultModel¶
Model used when a request omits model.
fetch¶
HTTP fetch implementation.
logger¶
The configured logger, filtered to logLevel.
logLevel¶
Configured log verbosity.
models¶
The models available to the account.
retry¶
Retry settings with constructor overrides applied.
timeout¶
Timeout per attempt in milliseconds.
Methods¶
systemOne()¶
Answer named questions about text or structured state.
Type Parameters¶
Q¶
Q extends Questions
Parameters¶
request¶
SystemOneRequest\<Q>
State, questions, and an optional model override.
options?¶
RequestOptions = {}
Per-call timeout, retry, headers, and cancellation settings.
Returns¶
APIPromise\<SystemOneResult\<Q>>
Answers typed by question name and criteria, with model and token usage.
Throws¶
Questions are empty, or score criteria are not a list of at least two entries.
Throws¶
The server returns a non-2xx response after retries.
Throws¶
The request cannot connect or times out after retries.
Throws¶
The caller aborts the request.