Skip to content
Effect Days 2026 Get your ticket

TypeSafeSchema

Codecs for the TypeSafe System One API.

11 exports Added in v4.0.0 Source

Schemas

Answer

Added in v4.0.0 Source

A System One answer.

Signature

declare const Answer: Union<readonly [Struct<{
readonly choice: String;
readonly confidence: Number;
readonly probabilities: $Record<String, Number>;
readonly type: Literal<"choice">;
}>, Struct<{
readonly confidence: Number;
readonly legend: optional<$Record<String, String>>;
readonly probabilities: $Record<String, Number>;
readonly score: Number;
readonly type: Literal<"score">;
}>, Struct<{
readonly noul: Number;
readonly type: Literal<"noul">;
}>]>

ChoiceAnswer

Added in v4.0.0 Source

A classification distribution.

Signature

declare const ChoiceAnswer: Struct<{
readonly choice: String;
readonly confidence: Number;
readonly probabilities: $Record<String, Number>;
readonly type: Literal<"choice">;
}>

A classification question.

Signature

declare const ChoiceQuestion: Struct<{
readonly criteria: $Record<String, String>;
readonly instructions: String;
readonly type: Literal<"choice">;
}>

Available TypeSafe models.

Signature

declare const ListModelsResponse: Struct<{
readonly models: $Array<Struct<{
readonly description: optional<String>;
readonly name: String;
readonly release_date: optional<String>;
}>>;
}>

NoulAnswer

Added in v4.0.0 Source

A Bernoulli probability.

Signature

declare const NoulAnswer: Struct<{
readonly noul: Number;
readonly type: Literal<"noul">;
}>

NoulQuestion

Added in v4.0.0 Source

A probability question.

Signature

declare const NoulQuestion: Struct<{
readonly criteria: optional<Struct<{
readonly false: String;
readonly true: String;
}>>;
readonly instructions: String;
readonly type: Literal<"noul">;
}>

Question

Added in v4.0.0 Source

A System One question.

Signature

declare const Question: Union<readonly [Struct<{
readonly criteria: $Record<String, String>;
readonly instructions: String;
readonly type: Literal<"choice">;
}>, Struct<{
readonly criteria: $Array<String>;
readonly instructions: String;
readonly type: Literal<"score">;
}>, Struct<{
readonly criteria: optional<Struct<{
readonly false: String;
readonly true: String;
}>>;
readonly instructions: String;
readonly type: Literal<"noul">;
}>]>

ScoreAnswer

Added in v4.0.0 Source

A zero-based rating and index-keyed distribution.

Signature

declare const ScoreAnswer: Struct<{
readonly confidence: Number;
readonly legend: optional<$Record<String, String>>;
readonly probabilities: $Record<String, Number>;
readonly score: Number;
readonly type: Literal<"score">;
}>

An ordered rating question.

Signature

declare const ScoreQuestion: Struct<{
readonly criteria: $Array<String>;
readonly instructions: String;
readonly type: Literal<"score">;
}>

A batch of questions against encoded state.

Signature

declare const SystemOneRequest: Struct<{
readonly model: String;
readonly questions: $Record<String, Union<readonly [Struct<{
readonly criteria: $Record<String, String>;
readonly instructions: String;
readonly type: Literal<"choice">;
}>, Struct<{
readonly criteria: $Array<String>;
readonly instructions: String;
readonly type: Literal<"score">;
}>, Struct<{
readonly criteria: optional<Struct<{
readonly false: String;
readonly true: String;
}>>;
readonly instructions: String;
readonly type: Literal<"noul">;
}>]>>;
readonly state: Codec<Json, Json, never, never>;
}>

Answers and token usage for a batch.

Signature

declare const SystemOneResponse: Struct<{
readonly answers: $Record<String, Union<readonly [Struct<{
readonly choice: String;
readonly confidence: Number;
readonly probabilities: $Record<String, Number>;
readonly type: Literal<"choice">;
}>, Struct<{
readonly confidence: Number;
readonly legend: optional<$Record<String, String>>;
readonly probabilities: $Record<String, Number>;
readonly score: Number;
readonly type: Literal<"score">;
}>, Struct<{
readonly noul: Number;
readonly type: Literal<"noul">;
}>]>>;
readonly model: String;
readonly usage: optional<Struct<{
readonly input_tokens: optional<Number>;
readonly output_tokens: optional<Number>;
}>>;
}>