teren de test TypeSafe: docs offline + script de proba

Separat de produsele ROA. docs/ = documentatia oficiala descarcata ca Markdown
(111 pagini), reluabila cu update_docs.sh. typesafe_test.py face un apel cu cate
o intrebare din fiecare tip (choice/noul/score) pe o linie de factura de furnizor.
Cheia API se ia din TYPESAFE_API_KEY, nu se versioneaza.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KHLUSsKP99G6ebv2fFUKQV
This commit is contained in:
2026-09-17 21:47:19 +03:00
commit 2d012a969c
116 changed files with 25116 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# API reference
## Classes
* [APIConnectionError](/sdk/javascript/api/classes/APIConnectionError)
* [APIError](/sdk/javascript/api/classes/APIError)
* [APIPromise](/sdk/javascript/api/classes/APIPromise)
* [APITimeoutError](/sdk/javascript/api/classes/APITimeoutError)
* [APIUserAbortError](/sdk/javascript/api/classes/APIUserAbortError)
* [AuthenticationError](/sdk/javascript/api/classes/AuthenticationError)
* [BadRequestError](/sdk/javascript/api/classes/BadRequestError)
* [InternalServerError](/sdk/javascript/api/classes/InternalServerError)
* [NotFoundError](/sdk/javascript/api/classes/NotFoundError)
* [PermissionDeniedError](/sdk/javascript/api/classes/PermissionDeniedError)
* [RateLimitError](/sdk/javascript/api/classes/RateLimitError)
* [TypeSafeClient](/sdk/javascript/api/classes/TypeSafeClient)
* [TypeSafeError](/sdk/javascript/api/classes/TypeSafeError)
* [UnprocessableEntityError](/sdk/javascript/api/classes/UnprocessableEntityError)
## Interfaces
* [ChoiceQuestion](/sdk/javascript/api/interfaces/ChoiceQuestion)
* [ChoiceResponse](/sdk/javascript/api/interfaces/ChoiceResponse)
* [Logger](/sdk/javascript/api/interfaces/Logger)
* [ModelCard](/sdk/javascript/api/interfaces/ModelCard)
* [Models](/sdk/javascript/api/interfaces/Models)
* [NoulQuestion](/sdk/javascript/api/interfaces/NoulQuestion)
* [NoulResponse](/sdk/javascript/api/interfaces/NoulResponse)
* [Questions](/sdk/javascript/api/interfaces/Questions)
* [RequestOptions](/sdk/javascript/api/interfaces/RequestOptions)
* [RetryPolicy](/sdk/javascript/api/interfaces/RetryPolicy)
* [ScoreQuestion](/sdk/javascript/api/interfaces/ScoreQuestion)
* [ScoreResponse](/sdk/javascript/api/interfaces/ScoreResponse)
* [SystemOneRequest](/sdk/javascript/api/interfaces/SystemOneRequest)
* [SystemOneRequestPayload](/sdk/javascript/api/interfaces/SystemOneRequestPayload)
* [SystemOneResult](/sdk/javascript/api/interfaces/SystemOneResult)
* [TypeSafeClientConfig](/sdk/javascript/api/interfaces/TypeSafeClientConfig)
* [Usage](/sdk/javascript/api/interfaces/Usage)
* [WithResponse](/sdk/javascript/api/interfaces/WithResponse)
## Type Aliases
* [ChoiceCriteria](/sdk/javascript/api/type-aliases/ChoiceCriteria)
* [Description](/sdk/javascript/api/type-aliases/Description)
* [EntryType](/sdk/javascript/api/type-aliases/EntryType)
* [EnvVar](/sdk/javascript/api/type-aliases/EnvVar)
* [Fetch](/sdk/javascript/api/type-aliases/Fetch)
* [JsonValue](/sdk/javascript/api/type-aliases/JsonValue)
* [LogLevel](/sdk/javascript/api/type-aliases/LogLevel)
* [Question](/sdk/javascript/api/type-aliases/Question)
* [ResultFor](/sdk/javascript/api/type-aliases/ResultFor)
* [ScoreCriteria](/sdk/javascript/api/type-aliases/ScoreCriteria)
* [ScoreLegend](/sdk/javascript/api/type-aliases/ScoreLegend)
* [ScoreOf](/sdk/javascript/api/type-aliases/ScoreOf)
## Variables
* [ENV](/sdk/javascript/api/variables/ENV)
* [LOG\_LEVELS](/sdk/javascript/api/variables/LOG_LEVELS)
* [VERSION](/sdk/javascript/api/variables/VERSION)
## Functions
* [choice](/sdk/javascript/api/functions/choice)
* [noul](/sdk/javascript/api/functions/noul)
* [score](/sdk/javascript/api/functions/score)

View File

@@ -0,0 +1,43 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Class: APIConnectionError
The request or response-body delivery failed (DNS, TLS, connection closed, etc.).
## Extends
* [`TypeSafeError`](/sdk/javascript/api/classes/TypeSafeError)
## Extended by
* [`APITimeoutError`](/sdk/javascript/api/classes/APITimeoutError)
## Constructors
<a id="sdk-constructor" />
### Constructor
```ts theme={null}
new APIConnectionError(message?, options?): APIConnectionError;
```
#### Parameters
##### message?
`string` = `"Connection error."`
##### options?
`ErrorOptions`
#### Returns
`APIConnectionError`
#### Overrides
[`TypeSafeError`](/sdk/javascript/api/classes/TypeSafeError).[`constructor`](/sdk/javascript/api/classes/TypeSafeError#sdk-constructor)

View File

@@ -0,0 +1,144 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Class: APIError
An unsuccessful HTTP response from the API.
## Extends
* [`TypeSafeError`](/sdk/javascript/api/classes/TypeSafeError)
## Extended by
* [`AuthenticationError`](/sdk/javascript/api/classes/AuthenticationError)
* [`BadRequestError`](/sdk/javascript/api/classes/BadRequestError)
* [`InternalServerError`](/sdk/javascript/api/classes/InternalServerError)
* [`NotFoundError`](/sdk/javascript/api/classes/NotFoundError)
* [`PermissionDeniedError`](/sdk/javascript/api/classes/PermissionDeniedError)
* [`RateLimitError`](/sdk/javascript/api/classes/RateLimitError)
* [`UnprocessableEntityError`](/sdk/javascript/api/classes/UnprocessableEntityError)
## Constructors
<a id="sdk-constructor" />
### Constructor
```ts theme={null}
new APIError(
status,
body,
headers,
message?
): APIError;
```
#### Parameters
##### status
`number`
##### body
`unknown`
##### headers
`Headers`
##### message?
`string`
#### Returns
`APIError`
#### Overrides
[`TypeSafeError`](/sdk/javascript/api/classes/TypeSafeError).[`constructor`](/sdk/javascript/api/classes/TypeSafeError#sdk-constructor)
## Properties
<a id="sdk-body" />
### body
```ts theme={null}
readonly body: unknown;
```
Parsed JSON, response text, or `undefined` for an empty body.
***
<a id="sdk-headers" />
### headers
```ts theme={null}
readonly headers: Headers;
```
HTTP response headers.
***
<a id="sdk-requestid" />
### requestId
```ts theme={null}
readonly requestId: string | undefined;
```
Request ID from `x-typesafe-request-id`, or `undefined` when absent.
***
<a id="sdk-status" />
### status
```ts theme={null}
readonly status: number;
```
HTTP response status code.
## Methods
<a id="sdk-fromresponse" />
### fromResponse()
```ts theme={null}
static fromResponse(
status,
body,
headers
): APIError;
```
Create the error subclass for an HTTP status code.
#### Parameters
##### status
`number`
##### body
`unknown`
##### headers
`Headers`
#### Returns
`APIError`

View File

@@ -0,0 +1,230 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Class: APIPromise<T>
A promise for the parsed result with access to the HTTP response.
Non-2xx responses reject with an `APIError`, including through `asResponse()`.
## Extends
* `Promise`\<`T`>
## Type Parameters
### T
`T`
## Constructors
<a id="sdk-constructor" />
### Constructor
```ts theme={null}
new APIPromise<T>(responsePromise, parseResponse): APIPromise<T>;
```
#### Parameters
##### responsePromise
`Promise`\<`Response`>
##### parseResponse
(`response`) => `Promise`\<`T`>
#### Returns
`APIPromise`\<`T`>
#### Overrides
```ts theme={null}
Promise<T>.constructor
```
## Methods
<a id="sdk-asresponse" />
### asResponse()
```ts theme={null}
asResponse(): Promise<Response>;
```
Resolves to the raw `Response` without parsing the body. SDK requests buffer the full
body under the request timeout before handoff; reading it afterwards is caller-owned.
The caller owns the body; don't also `await` the parsed result on the same promise.
#### Returns
`Promise`\<`Response`>
***
<a id="sdk-catch" />
### catch()
```ts theme={null}
catch<TResult>(onrejected?): Promise<T | TResult>;
```
Attaches a callback for only the rejection of the Promise.
#### Type Parameters
##### TResult
`TResult` = `never`
#### Parameters
##### onrejected?
((`reason`) => `TResult` | `PromiseLike`\<`TResult`>) | `null`
The callback to execute when the Promise is rejected.
#### Returns
`Promise`\<`T` | `TResult`>
A Promise for the completion of the callback.
#### Overrides
```ts theme={null}
Promise.catch
```
***
<a id="sdk-finally" />
### finally()
```ts theme={null}
finally(onfinally?): Promise<T>;
```
Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The
resolved value cannot be modified from the callback.
#### Parameters
##### onfinally?
(() => `void`) | `null`
The callback to execute when the Promise is settled (fulfilled or rejected).
#### Returns
`Promise`\<`T`>
A Promise for the completion of the callback.
#### Overrides
```ts theme={null}
Promise.finally
```
***
<a id="sdk-map" />
### map()
```ts theme={null}
map<U>(fn): APIPromise<U>;
```
Transform the parsed result, sharing the HTTP response and a single body parse.
#### Type Parameters
##### U
`U`
#### Parameters
##### fn
(`data`) => `U`
#### Returns
`APIPromise`\<`U`>
***
<a id="sdk-then" />
### then()
```ts theme={null}
then<TResult1, TResult2>(onfulfilled?, onrejected?): Promise<TResult1 | TResult2>;
```
Attaches callbacks for the resolution and/or rejection of the Promise.
#### Type Parameters
##### TResult1
`TResult1` = `T`
##### TResult2
`TResult2` = `never`
#### Parameters
##### onfulfilled?
((`value`) => `TResult1` | `PromiseLike`\<`TResult1`>) | `null`
The callback to execute when the Promise is resolved.
##### onrejected?
((`reason`) => `TResult2` | `PromiseLike`\<`TResult2`>) | `null`
The callback to execute when the Promise is rejected.
#### Returns
`Promise`\<`TResult1` | `TResult2`>
A Promise for the completion of which ever callback is executed.
#### Overrides
```ts theme={null}
Promise.then
```
***
<a id="sdk-withresponse" />
### withResponse()
```ts theme={null}
withResponse(): Promise<WithResponse<T>>;
```
Return the parsed result, HTTP response, and request ID.
#### Returns
`Promise`\<[`WithResponse`](/sdk/javascript/api/interfaces/WithResponse)\<`T`>>

View File

@@ -0,0 +1,51 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Class: APITimeoutError
The full response did not arrive within the timeout. A kind of `APIConnectionError`.
## Extends
* [`APIConnectionError`](/sdk/javascript/api/classes/APIConnectionError)
## Constructors
<a id="sdk-constructor" />
### Constructor
```ts theme={null}
new APITimeoutError(timeoutMs, options?): APITimeoutError;
```
#### Parameters
##### timeoutMs
`number`
##### options?
`ErrorOptions`
#### Returns
`APITimeoutError`
#### Overrides
[`APIConnectionError`](/sdk/javascript/api/classes/APIConnectionError).[`constructor`](/sdk/javascript/api/classes/APIConnectionError#sdk-constructor)
## Properties
<a id="sdk-timeoutms" />
### timeoutMs
```ts theme={null}
readonly timeoutMs: number;
```
Configured timeout in milliseconds.

View File

@@ -0,0 +1,39 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Class: APIUserAbortError
The caller cancelled the request through an `AbortSignal`.
## Extends
* [`TypeSafeError`](/sdk/javascript/api/classes/TypeSafeError)
## Constructors
<a id="sdk-constructor" />
### Constructor
```ts theme={null}
new APIUserAbortError(message?, options?): APIUserAbortError;
```
#### Parameters
##### message?
`string` = `"Request was aborted."`
##### options?
`ErrorOptions`
#### Returns
`APIUserAbortError`
#### Overrides
[`TypeSafeError`](/sdk/javascript/api/classes/TypeSafeError).[`constructor`](/sdk/javascript/api/classes/TypeSafeError#sdk-constructor)

View File

@@ -0,0 +1,154 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Class: AuthenticationError
HTTP 401: authentication failed.
## Extends
* [`APIError`](/sdk/javascript/api/classes/APIError)
## Constructors
<a id="sdk-constructor" />
### Constructor
```ts theme={null}
new AuthenticationError(
status,
body,
headers,
message?
): AuthenticationError;
```
#### Parameters
##### status
`number`
##### body
`unknown`
##### headers
`Headers`
##### message?
`string`
#### Returns
`AuthenticationError`
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`constructor`](/sdk/javascript/api/classes/APIError#sdk-constructor)
## Properties
<a id="sdk-body" />
### body
```ts theme={null}
readonly body: unknown;
```
Parsed JSON, response text, or `undefined` for an empty body.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`body`](/sdk/javascript/api/classes/APIError#sdk-body)
***
<a id="sdk-headers" />
### headers
```ts theme={null}
readonly headers: Headers;
```
HTTP response headers.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`headers`](/sdk/javascript/api/classes/APIError#sdk-headers)
***
<a id="sdk-requestid" />
### requestId
```ts theme={null}
readonly requestId: string | undefined;
```
Request ID from `x-typesafe-request-id`, or `undefined` when absent.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`requestId`](/sdk/javascript/api/classes/APIError#sdk-requestid)
***
<a id="sdk-status" />
### status
```ts theme={null}
readonly status: number;
```
HTTP response status code.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`status`](/sdk/javascript/api/classes/APIError#sdk-status)
## Methods
<a id="sdk-fromresponse" />
### fromResponse()
```ts theme={null}
static fromResponse(
status,
body,
headers
): APIError;
```
Create the error subclass for an HTTP status code.
#### Parameters
##### status
`number`
##### body
`unknown`
##### headers
`Headers`
#### Returns
[`APIError`](/sdk/javascript/api/classes/APIError)
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`fromResponse`](/sdk/javascript/api/classes/APIError#sdk-fromresponse)

View File

@@ -0,0 +1,154 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Class: BadRequestError
HTTP 400: the request is invalid.
## Extends
* [`APIError`](/sdk/javascript/api/classes/APIError)
## Constructors
<a id="sdk-constructor" />
### Constructor
```ts theme={null}
new BadRequestError(
status,
body,
headers,
message?
): BadRequestError;
```
#### Parameters
##### status
`number`
##### body
`unknown`
##### headers
`Headers`
##### message?
`string`
#### Returns
`BadRequestError`
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`constructor`](/sdk/javascript/api/classes/APIError#sdk-constructor)
## Properties
<a id="sdk-body" />
### body
```ts theme={null}
readonly body: unknown;
```
Parsed JSON, response text, or `undefined` for an empty body.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`body`](/sdk/javascript/api/classes/APIError#sdk-body)
***
<a id="sdk-headers" />
### headers
```ts theme={null}
readonly headers: Headers;
```
HTTP response headers.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`headers`](/sdk/javascript/api/classes/APIError#sdk-headers)
***
<a id="sdk-requestid" />
### requestId
```ts theme={null}
readonly requestId: string | undefined;
```
Request ID from `x-typesafe-request-id`, or `undefined` when absent.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`requestId`](/sdk/javascript/api/classes/APIError#sdk-requestid)
***
<a id="sdk-status" />
### status
```ts theme={null}
readonly status: number;
```
HTTP response status code.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`status`](/sdk/javascript/api/classes/APIError#sdk-status)
## Methods
<a id="sdk-fromresponse" />
### fromResponse()
```ts theme={null}
static fromResponse(
status,
body,
headers
): APIError;
```
Create the error subclass for an HTTP status code.
#### Parameters
##### status
`number`
##### body
`unknown`
##### headers
`Headers`
#### Returns
[`APIError`](/sdk/javascript/api/classes/APIError)
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`fromResponse`](/sdk/javascript/api/classes/APIError#sdk-fromresponse)

View File

@@ -0,0 +1,154 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Class: InternalServerError
HTTP 5xx: the server failed to handle the request.
## Extends
* [`APIError`](/sdk/javascript/api/classes/APIError)
## Constructors
<a id="sdk-constructor" />
### Constructor
```ts theme={null}
new InternalServerError(
status,
body,
headers,
message?
): InternalServerError;
```
#### Parameters
##### status
`number`
##### body
`unknown`
##### headers
`Headers`
##### message?
`string`
#### Returns
`InternalServerError`
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`constructor`](/sdk/javascript/api/classes/APIError#sdk-constructor)
## Properties
<a id="sdk-body" />
### body
```ts theme={null}
readonly body: unknown;
```
Parsed JSON, response text, or `undefined` for an empty body.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`body`](/sdk/javascript/api/classes/APIError#sdk-body)
***
<a id="sdk-headers" />
### headers
```ts theme={null}
readonly headers: Headers;
```
HTTP response headers.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`headers`](/sdk/javascript/api/classes/APIError#sdk-headers)
***
<a id="sdk-requestid" />
### requestId
```ts theme={null}
readonly requestId: string | undefined;
```
Request ID from `x-typesafe-request-id`, or `undefined` when absent.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`requestId`](/sdk/javascript/api/classes/APIError#sdk-requestid)
***
<a id="sdk-status" />
### status
```ts theme={null}
readonly status: number;
```
HTTP response status code.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`status`](/sdk/javascript/api/classes/APIError#sdk-status)
## Methods
<a id="sdk-fromresponse" />
### fromResponse()
```ts theme={null}
static fromResponse(
status,
body,
headers
): APIError;
```
Create the error subclass for an HTTP status code.
#### Parameters
##### status
`number`
##### body
`unknown`
##### headers
`Headers`
#### Returns
[`APIError`](/sdk/javascript/api/classes/APIError)
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`fromResponse`](/sdk/javascript/api/classes/APIError#sdk-fromresponse)

View File

@@ -0,0 +1,154 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Class: NotFoundError
HTTP 404: the resource was not found.
## Extends
* [`APIError`](/sdk/javascript/api/classes/APIError)
## Constructors
<a id="sdk-constructor" />
### Constructor
```ts theme={null}
new NotFoundError(
status,
body,
headers,
message?
): NotFoundError;
```
#### Parameters
##### status
`number`
##### body
`unknown`
##### headers
`Headers`
##### message?
`string`
#### Returns
`NotFoundError`
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`constructor`](/sdk/javascript/api/classes/APIError#sdk-constructor)
## Properties
<a id="sdk-body" />
### body
```ts theme={null}
readonly body: unknown;
```
Parsed JSON, response text, or `undefined` for an empty body.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`body`](/sdk/javascript/api/classes/APIError#sdk-body)
***
<a id="sdk-headers" />
### headers
```ts theme={null}
readonly headers: Headers;
```
HTTP response headers.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`headers`](/sdk/javascript/api/classes/APIError#sdk-headers)
***
<a id="sdk-requestid" />
### requestId
```ts theme={null}
readonly requestId: string | undefined;
```
Request ID from `x-typesafe-request-id`, or `undefined` when absent.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`requestId`](/sdk/javascript/api/classes/APIError#sdk-requestid)
***
<a id="sdk-status" />
### status
```ts theme={null}
readonly status: number;
```
HTTP response status code.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`status`](/sdk/javascript/api/classes/APIError#sdk-status)
## Methods
<a id="sdk-fromresponse" />
### fromResponse()
```ts theme={null}
static fromResponse(
status,
body,
headers
): APIError;
```
Create the error subclass for an HTTP status code.
#### Parameters
##### status
`number`
##### body
`unknown`
##### headers
`Headers`
#### Returns
[`APIError`](/sdk/javascript/api/classes/APIError)
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`fromResponse`](/sdk/javascript/api/classes/APIError#sdk-fromresponse)

View File

@@ -0,0 +1,154 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Class: PermissionDeniedError
HTTP 403: access is denied.
## Extends
* [`APIError`](/sdk/javascript/api/classes/APIError)
## Constructors
<a id="sdk-constructor" />
### Constructor
```ts theme={null}
new PermissionDeniedError(
status,
body,
headers,
message?
): PermissionDeniedError;
```
#### Parameters
##### status
`number`
##### body
`unknown`
##### headers
`Headers`
##### message?
`string`
#### Returns
`PermissionDeniedError`
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`constructor`](/sdk/javascript/api/classes/APIError#sdk-constructor)
## Properties
<a id="sdk-body" />
### body
```ts theme={null}
readonly body: unknown;
```
Parsed JSON, response text, or `undefined` for an empty body.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`body`](/sdk/javascript/api/classes/APIError#sdk-body)
***
<a id="sdk-headers" />
### headers
```ts theme={null}
readonly headers: Headers;
```
HTTP response headers.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`headers`](/sdk/javascript/api/classes/APIError#sdk-headers)
***
<a id="sdk-requestid" />
### requestId
```ts theme={null}
readonly requestId: string | undefined;
```
Request ID from `x-typesafe-request-id`, or `undefined` when absent.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`requestId`](/sdk/javascript/api/classes/APIError#sdk-requestid)
***
<a id="sdk-status" />
### status
```ts theme={null}
readonly status: number;
```
HTTP response status code.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`status`](/sdk/javascript/api/classes/APIError#sdk-status)
## Methods
<a id="sdk-fromresponse" />
### fromResponse()
```ts theme={null}
static fromResponse(
status,
body,
headers
): APIError;
```
Create the error subclass for an HTTP status code.
#### Parameters
##### status
`number`
##### body
`unknown`
##### headers
`Headers`
#### Returns
[`APIError`](/sdk/javascript/api/classes/APIError)
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`fromResponse`](/sdk/javascript/api/classes/APIError#sdk-fromresponse)

View File

@@ -0,0 +1,166 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Class: RateLimitError
HTTP 429: the rate limit was exceeded.
## Extends
* [`APIError`](/sdk/javascript/api/classes/APIError)
## Constructors
<a id="sdk-constructor" />
### Constructor
```ts theme={null}
new RateLimitError(
status,
body,
headers,
message?
): RateLimitError;
```
#### Parameters
##### status
`number`
##### body
`unknown`
##### headers
`Headers`
##### message?
`string`
#### Returns
`RateLimitError`
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`constructor`](/sdk/javascript/api/classes/APIError#sdk-constructor)
## Properties
<a id="sdk-body" />
### body
```ts theme={null}
readonly body: unknown;
```
Parsed JSON, response text, or `undefined` for an empty body.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`body`](/sdk/javascript/api/classes/APIError#sdk-body)
***
<a id="sdk-headers" />
### headers
```ts theme={null}
readonly headers: Headers;
```
HTTP response headers.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`headers`](/sdk/javascript/api/classes/APIError#sdk-headers)
***
<a id="sdk-requestid" />
### requestId
```ts theme={null}
readonly requestId: string | undefined;
```
Request ID from `x-typesafe-request-id`, or `undefined` when absent.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`requestId`](/sdk/javascript/api/classes/APIError#sdk-requestid)
***
<a id="sdk-retryafterms" />
### retryAfterMs
```ts theme={null}
readonly retryAfterMs: number | undefined;
```
Server retry delay in milliseconds, or `undefined` when absent or invalid.
***
<a id="sdk-status" />
### status
```ts theme={null}
readonly status: number;
```
HTTP response status code.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`status`](/sdk/javascript/api/classes/APIError#sdk-status)
## Methods
<a id="sdk-fromresponse" />
### fromResponse()
```ts theme={null}
static fromResponse(
status,
body,
headers
): APIError;
```
Create the error subclass for an HTTP status code.
#### Parameters
##### status
`number`
##### body
`unknown`
##### headers
`Headers`
#### Returns
[`APIError`](/sdk/javascript/api/classes/APIError)
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`fromResponse`](/sdk/javascript/api/classes/APIError#sdk-fromresponse)

View File

@@ -0,0 +1,208 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Class: TypeSafeClient
Client for the TypeSafe AI API.
## Constructors
<a id="sdk-constructor" />
### Constructor
```ts theme={null}
new TypeSafeClient(config?): TypeSafeClient;
```
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`](/sdk/javascript/api/interfaces/TypeSafeClientConfig) = `{}`
#### Returns
`TypeSafeClient`
#### Throws
The API key is missing, configuration is invalid, or the runtime is unsupported.
## Properties
<a id="sdk-baseurl" />
### baseURL
```ts theme={null}
readonly baseURL: string;
```
API root with trailing slashes removed.
***
<a id="sdk-defaultheaders" />
### defaultHeaders
```ts theme={null}
readonly defaultHeaders: Readonly<Record<string, string>>;
```
Additional headers sent with each request.
***
<a id="sdk-defaultmodel" />
### defaultModel
```ts theme={null}
readonly defaultModel: string;
```
Model used when a request omits `model`.
***
<a id="sdk-fetch" />
### fetch
```ts theme={null}
readonly fetch: Fetch;
```
HTTP fetch implementation.
***
<a id="sdk-logger" />
### logger
```ts theme={null}
readonly logger: Logger;
```
The configured logger, filtered to `logLevel`.
***
<a id="sdk-loglevel" />
### logLevel
```ts theme={null}
readonly logLevel: LogLevel;
```
Configured log verbosity.
***
<a id="sdk-models" />
### models
```ts theme={null}
readonly models: Models;
```
The models available to the account.
***
<a id="sdk-retry" />
### retry
```ts theme={null}
readonly retry: RetryPolicy;
```
Retry settings with constructor overrides applied.
***
<a id="sdk-timeout" />
### timeout
```ts theme={null}
readonly timeout: number;
```
Timeout per attempt in milliseconds.
## Methods
<a id="sdk-systemone" />
### systemOne()
```ts theme={null}
systemOne<Q>(request, options?): APIPromise<SystemOneResult<Q>>;
```
Answer named questions about text or structured state.
#### Type Parameters
##### Q
`Q` *extends* [`Questions`](/sdk/javascript/api/interfaces/Questions)
#### Parameters
##### request
[`SystemOneRequest`](/sdk/javascript/api/interfaces/SystemOneRequest)\<`Q`>
State, questions, and an optional model override.
##### options?
[`RequestOptions`](/sdk/javascript/api/interfaces/RequestOptions) = `{}`
Per-call timeout, retry, headers, and cancellation settings.
#### Returns
[`APIPromise`](/sdk/javascript/api/classes/APIPromise)\<[`SystemOneResult`](/sdk/javascript/api/interfaces/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.
#### Example
```ts theme={null}
const { answers } = await client.systemOne({
state: "I was charged twice. Please help.",
questions: { billing: noul("Is this about billing?") },
});
console.log(answers.billing.noul);
```

View File

@@ -0,0 +1,47 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Class: TypeSafeError
Base class for SDK errors.
## Extends
* `Error`
## Extended by
* [`APIConnectionError`](/sdk/javascript/api/classes/APIConnectionError)
* [`APIError`](/sdk/javascript/api/classes/APIError)
* [`APIUserAbortError`](/sdk/javascript/api/classes/APIUserAbortError)
## Constructors
<a id="sdk-constructor" />
### Constructor
```ts theme={null}
new TypeSafeError(message, options?): TypeSafeError;
```
#### Parameters
##### message
`string`
##### options?
`ErrorOptions`
#### Returns
`TypeSafeError`
#### Overrides
```ts theme={null}
Error.constructor
```

View File

@@ -0,0 +1,154 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Class: UnprocessableEntityError
HTTP 422: request validation failed.
## Extends
* [`APIError`](/sdk/javascript/api/classes/APIError)
## Constructors
<a id="sdk-constructor" />
### Constructor
```ts theme={null}
new UnprocessableEntityError(
status,
body,
headers,
message?
): UnprocessableEntityError;
```
#### Parameters
##### status
`number`
##### body
`unknown`
##### headers
`Headers`
##### message?
`string`
#### Returns
`UnprocessableEntityError`
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`constructor`](/sdk/javascript/api/classes/APIError#sdk-constructor)
## Properties
<a id="sdk-body" />
### body
```ts theme={null}
readonly body: unknown;
```
Parsed JSON, response text, or `undefined` for an empty body.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`body`](/sdk/javascript/api/classes/APIError#sdk-body)
***
<a id="sdk-headers" />
### headers
```ts theme={null}
readonly headers: Headers;
```
HTTP response headers.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`headers`](/sdk/javascript/api/classes/APIError#sdk-headers)
***
<a id="sdk-requestid" />
### requestId
```ts theme={null}
readonly requestId: string | undefined;
```
Request ID from `x-typesafe-request-id`, or `undefined` when absent.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`requestId`](/sdk/javascript/api/classes/APIError#sdk-requestid)
***
<a id="sdk-status" />
### status
```ts theme={null}
readonly status: number;
```
HTTP response status code.
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`status`](/sdk/javascript/api/classes/APIError#sdk-status)
## Methods
<a id="sdk-fromresponse" />
### fromResponse()
```ts theme={null}
static fromResponse(
status,
body,
headers
): APIError;
```
Create the error subclass for an HTTP status code.
#### Parameters
##### status
`number`
##### body
`unknown`
##### headers
`Headers`
#### Returns
[`APIError`](/sdk/javascript/api/classes/APIError)
#### Inherited from
[`APIError`](/sdk/javascript/api/classes/APIError).[`fromResponse`](/sdk/javascript/api/classes/APIError#sdk-fromresponse)

View File

@@ -0,0 +1,35 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Function: choice()
```ts theme={null}
function choice<T>(instructions, criteria): ChoiceQuestion<T>;
```
Create a question that selects between named alternatives.
## Type Parameters
### T
`T` *extends* [`ChoiceCriteria`](/sdk/javascript/api/type-aliases/ChoiceCriteria)
## Parameters
### instructions
[`EntryType`](/sdk/javascript/api/type-aliases/EntryType)
The question as text, a JSON object or array, or `null`.
### criteria
`T`
Labels mapped to descriptions, or `null` for undescribed labels.
## Returns
[`ChoiceQuestion`](/sdk/javascript/api/interfaces/ChoiceQuestion)\<`T`>

View File

@@ -0,0 +1,58 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Function: noul()
```ts theme={null}
function noul(instructions?, criteria?): NoulQuestion;
```
Create a yes/no question with optional descriptions for either outcome.
## Parameters
### instructions?
[`EntryType`](/sdk/javascript/api/type-aliases/EntryType) = `null`
The question as text, a JSON object or array; defaults to `null`.
### criteria?
\| \{
`false?`: [`EntryType`](/sdk/javascript/api/type-aliases/EntryType);
`true?`: [`EntryType`](/sdk/javascript/api/type-aliases/EntryType);
}
\| `null`
Optional descriptions of the yes and no outcomes.
#### Type Literal
\{
`false?`: [`EntryType`](/sdk/javascript/api/type-aliases/EntryType);
`true?`: [`EntryType`](/sdk/javascript/api/type-aliases/EntryType);
}
Optional descriptions of the yes and no outcomes.
##### false?
[`EntryType`](/sdk/javascript/api/type-aliases/EntryType)
Description of the no outcome.
##### true?
[`EntryType`](/sdk/javascript/api/type-aliases/EntryType)
Description of the yes outcome.
***
`null`
## Returns
[`NoulQuestion`](/sdk/javascript/api/interfaces/NoulQuestion)

View File

@@ -0,0 +1,35 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Function: score()
```ts theme={null}
function score<T>(instructions, criteria): ScoreQuestion<T>;
```
Create a score question using an ordered rubric.
## Type Parameters
### T
`T` *extends* [`ScoreCriteria`](/sdk/javascript/api/type-aliases/ScoreCriteria)
## Parameters
### instructions
[`EntryType`](/sdk/javascript/api/type-aliases/EntryType)
The question as text, a JSON object or array, or `null`.
### criteria
`T`
At least two descriptions indexed by score from zero; entries may be `null`.
## Returns
[`ScoreQuestion`](/sdk/javascript/api/interfaces/ScoreQuestion)\<`T`>

View File

@@ -0,0 +1,47 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Interface: ChoiceQuestion<T>
A question that selects between named alternatives.
## Type Parameters
### T
`T` *extends* [`ChoiceCriteria`](/sdk/javascript/api/type-aliases/ChoiceCriteria) = [`ChoiceCriteria`](/sdk/javascript/api/type-aliases/ChoiceCriteria)
## Properties
<a id="sdk-criteria" />
### criteria
```ts theme={null}
criteria: T;
```
Descriptions of the available outcomes.
***
<a id="sdk-instructions" />
### instructions?
```ts theme={null}
optional instructions?: EntryType;
```
The question as text, a JSON object, or an array; optional or `null`.
***
<a id="sdk-type" />
### type
```ts theme={null}
type: "choice";
```

View File

@@ -0,0 +1,59 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Interface: ChoiceResponse<T>
A selected label and its probabilities.
## Type Parameters
### T
`T` *extends* [`ChoiceCriteria`](/sdk/javascript/api/type-aliases/ChoiceCriteria) = [`ChoiceCriteria`](/sdk/javascript/api/type-aliases/ChoiceCriteria)
## Properties
<a id="sdk-choice" />
### choice
```ts theme={null}
readonly choice: keyof T & string;
```
The selected label.
***
<a id="sdk-confidence" />
### confidence
```ts theme={null}
readonly confidence: number;
```
Reported confidence in the selected label.
***
<a id="sdk-probabilities" />
### probabilities
```ts theme={null}
readonly probabilities: { readonly [label in string | number | symbol]: number };
```
Probabilities keyed by label.
***
<a id="sdk-type" />
### type
```ts theme={null}
readonly type: "choice";
```

View File

@@ -0,0 +1,103 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Interface: Logger
Log methods accepting a message and structured values; compatible with `console`.
## Methods
<a id="sdk-debug" />
### debug()
```ts theme={null}
debug(message, ...args): void;
```
#### Parameters
##### message
`string`
##### args
...`unknown`\[]
#### Returns
`void`
***
<a id="sdk-error" />
### error()
```ts theme={null}
error(message, ...args): void;
```
#### Parameters
##### message
`string`
##### args
...`unknown`\[]
#### Returns
`void`
***
<a id="sdk-info" />
### info()
```ts theme={null}
info(message, ...args): void;
```
#### Parameters
##### message
`string`
##### args
...`unknown`\[]
#### Returns
`void`
***
<a id="sdk-warn" />
### warn()
```ts theme={null}
warn(message, ...args): void;
```
#### Parameters
##### message
`string`
##### args
...`unknown`\[]
#### Returns
`void`

View File

@@ -0,0 +1,37 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Interface: ModelCard
Metadata for an available model.
## Properties
<a id="sdk-description" />
### description
```ts theme={null}
readonly description: string;
```
***
<a id="sdk-name" />
### name
```ts theme={null}
readonly name: string;
```
***
<a id="sdk-release_date" />
### release\_date
```ts theme={null}
readonly release_date: string;
```

View File

@@ -0,0 +1,29 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Interface: Models
Access to the Models API resource.
## Methods
<a id="sdk-list" />
### list()
```ts theme={null}
list(options?): APIPromise<ModelCard[]>;
```
List the models available to the account.
#### Parameters
##### options?
[`RequestOptions`](/sdk/javascript/api/interfaces/RequestOptions) = `{}`
#### Returns
[`APIPromise`](/sdk/javascript/api/classes/APIPromise)\<[`ModelCard`](/sdk/javascript/api/interfaces/ModelCard)\[]>

View File

@@ -0,0 +1,77 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Interface: NoulQuestion
A yes/no question with optional descriptions for either outcome.
## Properties
<a id="sdk-criteria" />
### criteria?
```ts theme={null}
optional criteria?:
| {
false?: EntryType;
true?: EntryType;
}
| null;
```
Optional descriptions of the yes and no outcomes.
#### Union Members
##### Type Literal
```ts theme={null}
{
false?: EntryType;
true?: EntryType;
}
```
##### false?
```ts theme={null}
optional false?: EntryType;
```
Description of the no outcome.
##### true?
```ts theme={null}
optional true?: EntryType;
```
Description of the yes outcome.
***
`null`
***
<a id="sdk-instructions" />
### instructions?
```ts theme={null}
optional instructions?: EntryType;
```
The question as text, a JSON object, or an array; optional or `null`.
***
<a id="sdk-type" />
### type
```ts theme={null}
type: "noul";
```

View File

@@ -0,0 +1,29 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Interface: NoulResponse
A yes/no answer.
## Properties
<a id="sdk-noul" />
### noul
```ts theme={null}
readonly noul: number;
```
Probability of a yes answer, from zero to one.
***
<a id="sdk-type" />
### type
```ts theme={null}
readonly type: "noul";
```

View File

@@ -0,0 +1,13 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Interface: Questions
Questions keyed by the names used to identify their answers.
## Indexable
```ts theme={null}
[name: string]: Question
```

View File

@@ -0,0 +1,55 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Interface: RequestOptions
Per-call options that override client settings.
## Properties
<a id="sdk-headers" />
### headers?
```ts theme={null}
optional headers?: Record<string, string>;
```
Additional headers, merged over `defaultHeaders`.
***
<a id="sdk-retry" />
### retry?
```ts theme={null}
optional retry?: Partial<RetryPolicy>;
```
Retry overrides for this call; omitted fields inherit client settings.
***
<a id="sdk-signal" />
### signal?
```ts theme={null}
optional signal?: AbortSignal;
```
Cancellation signal for the request and pending retries.
***
<a id="sdk-timeout" />
### timeout?
```ts theme={null}
optional timeout?: number;
```
Timeout per attempt in milliseconds; there is no total retry budget.

View File

@@ -0,0 +1,115 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Interface: RetryPolicy
Retry configuration. Partial overrides inherit unset fields from the client or SDK defaults.
## Properties
<a id="sdk-apiconnectionerror" />
### apiConnectionError
```ts theme={null}
readonly apiConnectionError: boolean;
```
Retry connection failures, including interrupted response bodies (`APIConnectionError`). Default: true.
***
<a id="sdk-apitimeouterror" />
### apiTimeoutError
```ts theme={null}
readonly apiTimeoutError: boolean;
```
Whether to retry `APITimeoutError`. Default: true.
***
<a id="sdk-backoffinitialms" />
### backoffInitialMs
```ts theme={null}
readonly backoffInitialMs: number;
```
First backoff delay in milliseconds, doubled up to `backoffMaxMs`. Default: 500.
***
<a id="sdk-backoffjitter" />
### backoffJitter
```ts theme={null}
readonly backoffJitter: number;
```
Fraction of each backoff delay randomly subtracted, from 0 to 1. Default: 0.25.
***
<a id="sdk-backoffmaxms" />
### backoffMaxMs
```ts theme={null}
readonly backoffMaxMs: number;
```
Maximum backoff delay in milliseconds. Default: 5000.
***
<a id="sdk-httpstatuses" />
### httpStatuses
```ts theme={null}
readonly httpStatuses: ReadonlySet<number>;
```
HTTP status codes to retry. Default: 408, 429, and 500–599.
***
<a id="sdk-maxretries" />
### maxRetries
```ts theme={null}
readonly maxRetries: number;
```
Maximum retries after the initial attempt; `0` disables retries. Default: 2.
***
<a id="sdk-maxretryafterms" />
### maxRetryAfterMs
```ts theme={null}
readonly maxRetryAfterMs: number;
```
Maximum server retry delay in milliseconds; longer delays use backoff. Default: 60000.
***
<a id="sdk-respectretryafter" />
### respectRetryAfter
```ts theme={null}
readonly respectRetryAfter: boolean;
```
Honor `Retry-After` and `retry-after-ms` up to `maxRetryAfterMs`. Default: true.

View File

@@ -0,0 +1,47 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Interface: ScoreQuestion<T>
A question that assigns a score using an ordered rubric.
## Type Parameters
### T
`T` *extends* [`ScoreCriteria`](/sdk/javascript/api/type-aliases/ScoreCriteria) = [`ScoreCriteria`](/sdk/javascript/api/type-aliases/ScoreCriteria)
## Properties
<a id="sdk-criteria" />
### criteria
```ts theme={null}
criteria: T;
```
Descriptions of the available outcomes.
***
<a id="sdk-instructions" />
### instructions?
```ts theme={null}
optional instructions?: EntryType;
```
The question as text, a JSON object, or an array; optional or `null`.
***
<a id="sdk-type" />
### type
```ts theme={null}
type: "score";
```

View File

@@ -0,0 +1,71 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Interface: ScoreResponse<T>
An expected score with its rubric and probabilities.
## Type Parameters
### T
`T` *extends* [`ScoreCriteria`](/sdk/javascript/api/type-aliases/ScoreCriteria) = [`ScoreCriteria`](/sdk/javascript/api/type-aliases/ScoreCriteria)
## Properties
<a id="sdk-confidence" />
### confidence
```ts theme={null}
readonly confidence: number;
```
Reported confidence in the score.
***
<a id="sdk-legend" />
### legend
```ts theme={null}
readonly legend: ScoreLegend<T>;
```
Rubric descriptions keyed by score.
***
<a id="sdk-probabilities" />
### probabilities
```ts theme={null}
readonly probabilities: { readonly [score in number | `${number}`]: number };
```
Probabilities keyed by score.
***
<a id="sdk-score" />
### score
```ts theme={null}
readonly score: number;
```
Expected score, which may fall between integer rubric levels.
***
<a id="sdk-type" />
### type
```ts theme={null}
readonly type: "score";
```

View File

@@ -0,0 +1,55 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Interface: SystemOneRequest<Q>
State and named questions for `systemOne`.
Additional properties on a request variable are forwarded, including `null` values.
## Extended by
* [`SystemOneRequestPayload`](/sdk/javascript/api/interfaces/SystemOneRequestPayload)
## Type Parameters
### Q
`Q` *extends* [`Questions`](/sdk/javascript/api/interfaces/Questions) = [`Questions`](/sdk/javascript/api/interfaces/Questions)
## Properties
<a id="sdk-model" />
### model?
```ts theme={null}
optional model?: string;
```
Model override; omitted values inherit `defaultModel`.
***
<a id="sdk-questions" />
### questions
```ts theme={null}
questions: Q;
```
Nonempty questions keyed by the names used to identify their answers.
***
<a id="sdk-state" />
### state
```ts theme={null}
state: EntryType;
```
Text, a JSON object or array, or `null` to evaluate.

View File

@@ -0,0 +1,59 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Interface: SystemOneRequestPayload
Request body for `POST /v1/systemone`, with the model resolved.
## Extends
* [`SystemOneRequest`](/sdk/javascript/api/interfaces/SystemOneRequest)
## Properties
<a id="sdk-model" />
### model
```ts theme={null}
model: string;
```
Model override; omitted values inherit `defaultModel`.
#### Overrides
[`SystemOneRequest`](/sdk/javascript/api/interfaces/SystemOneRequest).[`model`](/sdk/javascript/api/interfaces/SystemOneRequest#sdk-model)
***
<a id="sdk-questions" />
### questions
```ts theme={null}
questions: Questions;
```
Nonempty questions keyed by the names used to identify their answers.
#### Inherited from
[`SystemOneRequest`](/sdk/javascript/api/interfaces/SystemOneRequest).[`questions`](/sdk/javascript/api/interfaces/SystemOneRequest#sdk-questions)
***
<a id="sdk-state" />
### state
```ts theme={null}
state: EntryType;
```
Text, a JSON object or array, or `null` to evaluate.
#### Inherited from
[`SystemOneRequest`](/sdk/javascript/api/interfaces/SystemOneRequest).[`state`](/sdk/javascript/api/interfaces/SystemOneRequest#sdk-state)

View File

@@ -0,0 +1,49 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Interface: SystemOneResult<Q>
Answers keyed by question name, with model and usage metadata.
## Type Parameters
### Q
`Q` *extends* [`Questions`](/sdk/javascript/api/interfaces/Questions)
## Properties
<a id="sdk-answers" />
### answers
```ts theme={null}
readonly answers: { readonly [K in string | number | symbol]: ResultFor<Q[K]> };
```
Answers with types inferred from the supplied questions.
***
<a id="sdk-model" />
### model
```ts theme={null}
readonly model: string;
```
The model used to answer the request.
***
<a id="sdk-usage" />
### usage
```ts theme={null}
readonly usage: Usage;
```
Token usage for the request.

View File

@@ -0,0 +1,129 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Interface: TypeSafeClientConfig
Client options. Explicit values take precedence over environment variables, then SDK defaults.
## Properties
<a id="sdk-apikey" />
### apiKey?
```ts theme={null}
optional apiKey?: string;
```
Required API key; falls back to `TYPESAFE_API_KEY`.
***
<a id="sdk-baseurl" />
### baseURL?
```ts theme={null}
optional baseURL?: string;
```
API root; falls back to `TYPESAFE_BASE_URL`, then `https://api.typesafe.ai`.
***
<a id="sdk-dangerouslyallowbrowser" />
### dangerouslyAllowBrowser?
```ts theme={null}
optional dangerouslyAllowBrowser?: boolean;
```
Allow browser use, exposing the API key to page users. Default: false.
***
<a id="sdk-defaultheaders" />
### defaultHeaders?
```ts theme={null}
optional defaultHeaders?: Record<string, string>;
```
Additional request headers; per-call headers take precedence.
***
<a id="sdk-defaultmodel" />
### defaultModel?
```ts theme={null}
optional defaultModel?: string;
```
Default model; falls back to `TYPESAFE_DEFAULT_MODEL`, then `jev-latest`.
***
<a id="sdk-fetch" />
### fetch?
```ts theme={null}
optional fetch?: Fetch;
```
Custom HTTP fetch implementation for transport configuration or tests. Default: global `fetch`.
***
<a id="sdk-logger" />
### logger?
```ts theme={null}
optional logger?: Logger;
```
Logger filtered to `logLevel` and above. Default: prefixed `console`.
***
<a id="sdk-loglevel" />
### logLevel?
```ts theme={null}
optional logLevel?: LogLevel;
```
Log level; falls back to `TYPESAFE_LOG_LEVEL`, then `warn`.
`info` logs request summaries; `debug` adds headers and bodies.
Known credential headers are redacted; bodies are not.
***
<a id="sdk-retry" />
### retry?
```ts theme={null}
optional retry?: Partial<RetryPolicy>;
```
Retry overrides; omitted fields use the defaults in `RetryPolicy`.
***
<a id="sdk-timeout" />
### timeout?
```ts theme={null}
optional timeout?: number;
```
Timeout per attempt in milliseconds, without a total retry budget. Default: 10000.

View File

@@ -0,0 +1,31 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Interface: Usage
Token usage for a request.
## Properties
<a id="sdk-input_tokens" />
### input\_tokens
```ts theme={null}
readonly input_tokens: number;
```
Number of input tokens used.
***
<a id="sdk-output_tokens" />
### output\_tokens
```ts theme={null}
readonly output_tokens: number;
```
Number of output tokens used.

View File

@@ -0,0 +1,49 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Interface: WithResponse<T>
Parsed data with its HTTP response and request ID.
## Type Parameters
### T
`T`
## Properties
<a id="sdk-data" />
### data
```ts theme={null}
data: T;
```
The parsed response body.
***
<a id="sdk-requestid" />
### requestId
```ts theme={null}
requestId: string | undefined;
```
Request ID from `x-typesafe-request-id`, or `undefined` when absent.
***
<a id="sdk-response" />
### response
```ts theme={null}
response: Response;
```
The HTTP response, with its body consumed by parsing.

View File

@@ -0,0 +1,17 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Type Alias: ChoiceCriteria
```ts theme={null}
type ChoiceCriteria = object;
```
Labels mapped to descriptions, or `null` for undescribed labels.
## Index Signature
```ts theme={null}
[label: string]: EntryType
```

View File

@@ -0,0 +1,11 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Type Alias: Description
```ts theme={null}
type Description = EntryType;
```
A criterion description; `null` leaves the label undescribed.

View File

@@ -0,0 +1,17 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Type Alias: EntryType
```ts theme={null}
type EntryType =
| string
| {
[key: string]: JsonValue;
}
| JsonValue[]
| null;
```
Text, a JSON object or array, or `null` for state, instructions, and criteria.

View File

@@ -0,0 +1,9 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Type Alias: EnvVar
```ts theme={null}
type EnvVar = typeof ENV[keyof typeof ENV];
```

View File

@@ -0,0 +1,25 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Type Alias: Fetch
```ts theme={null}
type Fetch = (input, init?) => Promise<Response>;
```
HTTP fetch implementation compatible with the global `fetch`.
## Parameters
### input
`string`
### init?
`RequestInit`
## Returns
`Promise`\<`Response`>

View File

@@ -0,0 +1,19 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Type Alias: JsonValue
```ts theme={null}
type JsonValue =
| string
| number
| boolean
| null
| JsonValue[]
| {
[key: string]: JsonValue;
};
```
A JSON-compatible value.

View File

@@ -0,0 +1,11 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Type Alias: LogLevel
```ts theme={null}
type LogLevel = "debug" | "info" | "warn" | "error" | "off";
```
Log verbosity; `off` disables logging.

View File

@@ -0,0 +1,14 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Type Alias: Question
```ts theme={null}
type Question =
| NoulQuestion
| ScoreQuestion
| ChoiceQuestion;
```
A question identified by its `type` field.

View File

@@ -0,0 +1,17 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Type Alias: ResultFor<T>
```ts theme={null}
type ResultFor<T> = T extends NoulQuestion ? NoulResponse : T extends ScoreQuestion<infer S> ? ScoreResponse<S> : T extends ChoiceQuestion<infer E> ? ChoiceResponse<E> : never;
```
The answer type for a question, preserving its criteria keys.
## Type Parameters
### T
`T` *extends* [`Question`](/sdk/javascript/api/type-aliases/Question)

View File

@@ -0,0 +1,11 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Type Alias: ScoreCriteria
```ts theme={null}
type ScoreCriteria = readonly [EntryType, EntryType, ...EntryType[]];
```
At least two descriptions indexed by score from zero; `null` leaves a score undescribed.

View File

@@ -0,0 +1,17 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Type Alias: ScoreLegend<T>
```ts theme={null}
type ScoreLegend<T> = { readonly [score in ScoreOf<T>]: T[score] };
```
Rubric descriptions keyed by score.
## Type Parameters
### T
`T` *extends* [`ScoreCriteria`](/sdk/javascript/api/type-aliases/ScoreCriteria)

View File

@@ -0,0 +1,17 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Type Alias: ScoreOf<T>
```ts theme={null}
type ScoreOf<T> = number extends T["length"] ? number : Extract<keyof T, `${number}`>;
```
Score keys inferred from the rubric; a fixed-length tuple yields its indices, otherwise `number`.
## Type Parameters
### T
`T` *extends* [`ScoreCriteria`](/sdk/javascript/api/type-aliases/ScoreCriteria)

View File

@@ -0,0 +1,53 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Variable: ENV
```ts theme={null}
const ENV: object;
```
Environment variable names for client configuration. Explicit options take precedence.
## Type Declaration
<a id="sdk-apikey" />
### apiKey
```ts theme={null}
readonly apiKey: "TYPESAFE_API_KEY" = "TYPESAFE_API_KEY";
```
Required API key; used when `apiKey` is omitted.
<a id="sdk-baseurl" />
### baseURL
```ts theme={null}
readonly baseURL: "TYPESAFE_BASE_URL" = "TYPESAFE_BASE_URL";
```
API root; defaults to `https://api.typesafe.ai`.
<a id="sdk-defaultmodel" />
### defaultModel
```ts theme={null}
readonly defaultModel: "TYPESAFE_DEFAULT_MODEL" = "TYPESAFE_DEFAULT_MODEL";
```
Default model name; defaults to `jev-latest`.
<a id="sdk-loglevel" />
### logLevel
```ts theme={null}
readonly logLevel: "TYPESAFE_LOG_LEVEL" = "TYPESAFE_LOG_LEVEL";
```
Log level; defaults to `warn`.

View File

@@ -0,0 +1,11 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Variable: LOG_LEVELS
```ts theme={null}
const LOG_LEVELS: readonly LogLevel[];
```
Supported log levels, from most to least verbose.

View File

@@ -0,0 +1,9 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Variable: VERSION
```ts theme={null}
const VERSION: "0.6.0" = "0.6.0";
```

View File

@@ -0,0 +1,15 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.typesafe.ai/llms.txt
> Use this file to discover all available pages before exploring further.
# Changelog
## v0.6.0 (2026-09-15)
### Breaking changes
* accept `Score.criteria` as an ordered sequence instead of a dictionary keyed by integers
## v0.5.7 (2026-09-11)
This is the initial public release of TypeSafe JavaScript and TypeScript SDK. Learn more in the [documentation](https://docs.typesafe.ai/sdk/javascript).