SwapAI

Result types

Learn bounded numbers, booleans or one value from a closed string list.

Bounded numbers

result: { type: "number", min: 0, max: 1 }

Numbers must be finite and inside the declared range. SwapAI converts numeric values into ordered Needle labels and stores the label map with the model. Candidate identity covers both the .cact model and numeric-label sidecar, so neither file can be substituted independently.

Numeric error is normalized to the declared range:

abs(reference - candidate) / (max - min)

Booleans

result: { type: "boolean" }

A match has error 0; a mismatch has error 1.

Closed strings

result: {
  type: "string",
  values: ["gbp", "usd", "eur"],
}

Use as const when declaring a reusable result configuration so TypeScript preserves the exact union. Values outside the list fail with invalid_result.

One name, one contract

A classifier name identifies its persisted task, result type, data policy and models. Changing that contract requires a deliberate migration or a new classifier name. SwapAI rejects incompatible configuration instead of mixing data from different tasks.