Starter template for a sabaki plugin.
Three patterns: definePlugin (ad-hoc), nanoClassifier (TF-IDF), miniClassifier (ONNX). Click Use this template.
Ship ONNX weights inside the package so it works offline:
- Put the files in
models/<workflow>-int8/(<workflow>_int8.onnx,<workflow>_int8.onnx.dataif any,<workflow>.json,model.json,tokenizer.json). - Export the dir from
src/index.ts:import path from "node:path"; import { fileURLToPath } from "node:url"; export const modelDir = path.join( path.dirname(fileURLToPath(import.meta.url)), "..", "models", "<workflow>-int8", );
- Add
"models"topackage.jsonfiles. - Callers pass it explicitly:
miniClassifier(manifest, wf, { modelDir })(falls back to HF download when absent).
npm version patch && npm run publish-package # tags v* -> CI publishes to npmPart of sabaki - see the GUIDE.
MIT