Skip to main content
The ML library, @bijectionhq/library-ml, is a model registry and model serving for the app that places it: models, versions, aliases with their promotion history, predictions and their observed values. Everything is a fact of your app. ml({...}) returns a subtree whose functions take their paths where you place it (models.aliases.promote). Four facts carry the design:
  • A version is a Datasets artifact. A model’s files are one published version of an artifact dataset held by your Datasets app ({ dataset, number, snapshot }). Training and capture run on your compute; the registry stores no file and runs no training.
  • An assessment is a check. Evaluations are verdicts of your checks({ label, writers }) subtree on (subject, digest, kind): subject <subject>/<model>, digest the version’s exact artifact. A pass on one version is never read as a pass on another.
  • Promotion is a gated pointer move. Each alias names the check kinds it requires. aliases.promote moves the alias only if every kind’s newest verdict on exactly that digest passed, in the same commit.
  • Serving is a receiver. serving.predict records a pending prediction and submits one task to the serving endpoint; the continuation records the answer or the refusal.
bijection/models.ts

Checks

checks({ writers, label }) from @bijectionhq/library-checks is a subtree of verdicts. A writer records one with assessments.record(ctx, { subject, digest, kind, verdict, detail }), and any function asks assessments.passed(ctx, subject, digest, kinds). A verdict is pinned to its digest. Scores, thresholds and report views go in detail. Your evaluation workers, or the evaluation library, record the verdicts an alias requires.

Register and promote

expected makes a promotion compare-and-set against the alias’s revision, and every move is a new promotion fact. They refuse with the codes in ML_REFUSES, such as ChecksFailing and AliasMoved. For an independent review, ask the Approvals app and promote from its continuation. The subtree also carries in-transaction helpers: register, promote, resolve, version, alias, prediction, predict and subjectOf(model). With datasets: { holds }, the first alias that points at a version holds its artifact in the Datasets app, so retention never retires a served model’s files. When no alias points at it, the hold ends. A hold that ends redacted, because a legal erasure won over it, marks the version redacted and clears its aliases.

Serve

With serving, serving.predict({ model, key, alias, number, input }) requests a prediction by alias or version number (the other null) under your key; the same key answers the existing prediction. The task’s body names the version and its artifact, and the endpoint loads it. serving.observe({ model, key, value }) records what was later observed, and serving.prediction reads both. Serving infrastructure stays yours: the endpoint is a receiver with bearer, input and output types and a timeout.

Managed serving endpoints

Install External model serving with the ML registry and a Compute worker. A target names a model and a promoted alias. Its installation-owned binding maps each deployable candidate digest to an exact SageMaker, Vertex AI, or Databricks model artifact and a synthetic probe. The worker uses provider credentials in its own environment. Call deploy({ target, expectedRevision, request }) to create a dedicated endpoint. The request records the original alias revision and candidate digest. Read status({ id }) or current({ target }) for the latest command, observation, and retirement evidence. The controller starts a separate readiness observation after creation. isReady requires the bound provider version to receive all traffic, a live probe that reports the candidate digest it loaded, and a still-current promotion. The result expires within five minutes of observation. Call refresh({ id }) for fresh evidence. resume({ id }) reconciles the same endpoint after a lost create reply while the pinned promotion is current. retire({ id }) disables readiness and deletes the owned endpoint. The target becomes available for a new deployment when the provider confirms that the owned resources are gone. Retrying retire reconciles a lost delete reply. An absent endpoint after an unacknowledged create leaves the request active until its outcome can be established.