Skip to content
Effect 4.0 is here. One ecosystem. Zero dependencies.

TypeSafeDecisionModel unstable

TypeSafe's System One implementation of DecisionModel.

4 exports Since v4.0.0 Source

Constructors

make

unstable
Since v4.0.0

Builds a decision service. Probabilities arrive rounded to two decimals, so DecisionModel rescales small sum drift when it validates distributions and derives rating labels.

Details

Each Decision.Image field is sent as a base64 asset keyed by the reference that replaces it in state, so instructions name an image by its field path, such as `photo`. Requests with images opt in to TypeSafe's preview image support. Locate decisions become Box questions whose instructions end with the image path; they need Jev 1.14 ("jev-preview" or "jev-1.14.0").

Gotchas

  • Images must be PNG or JPEG, 256 to 1568 pixels on each side. The API rejects other sizes rather than resizing, and ignores EXIF orientation.
  • Remote URLs fail with AiError.InvalidUserInputError because TypeSafe does not fetch them.

Signature

declare const make: (...args: [options: {
readonly model: Model | string & {};
}]) => Effect<DecisionModel, never, TypeSafeClient>

model

unstable
Since v4.0.0

Creates a decision model with TypeSafe provider metadata.

Signature

declare function model(model: Model | string & {}): Model<"typesafe", DecisionModel, TypeSafeClient>

Layers

layer

unstable
Since v4.0.0

Provides DecisionModel using an existing TypeSafeClient.

Signature

declare function layer(options: {
readonly model: Model | string & {};
}): Layer<DecisionModel, never, TypeSafeClient>

Models

Model

type unstable
Since v4.0.0

Known TypeSafe model identifiers. Constructors also accept custom identifiers.

Signature

type Model = "jev-latest" | "jev-preview" | "jev-1.13.0" | "jev-1.14.0"