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

OpenAiDecisionModel unstable

OpenAI implementation of DecisionModel over the Decisions API.

4 exports Since v4.0.5 Source

Constructors

make

unstable
Since v4.0.5

Builds a decision service with tolerance for two-decimal probability rounding.

Details

String state is sent as input unchanged, and other state is sent as JSON. With images, input becomes one user message with the state as text followed by the images. Byte arrays and base64 strings are sent as data: URLs, and data: URLs are sent unchanged.

Probability criteria are appended to the question instructions, and each rating level is sent with its label and description. String instructions and descriptions are unchanged; structured values and null descriptions are serialized with JSON.stringify.

Gotchas

  • Remote URLs fail with AiError.InvalidUserInputError because OpenAI only accepts inline images.
  • Refusals yield "Refused" with decideSettled; decide fails with AiError.ContentPolicyError naming the refused decisions.

Signature

declare const make: (...args: [options: {
readonly model: "gpt-6-luna" | string & {};
}]) => Effect<DecisionModel, never, OpenAiClient>

model

unstable
Since v4.0.5

Creates a decision model with OpenAI provider metadata.

Signature

declare function model(model: "gpt-6-luna" | string & {}): Model<"openai", DecisionModel, OpenAiClient>

Layers

layer

unstable
Since v4.0.5

Provides DecisionModel using an existing OpenAiClient.

Signature

declare function layer(options: {
readonly model: "gpt-6-luna" | string & {};
}): Layer<DecisionModel, never, OpenAiClient>

Models

Model

type unstable
Since v4.0.5

OpenAI decision model identifiers.

Signature

type Model = typeof OpenAiSchema.CreateDecisionsRequest.Encoded["model"]