npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kaiord/ai

v9.6.1

Published

AI/LLM integration for the Kaiord health & fitness data framework

Readme

@kaiord/ai

AI/LLM integration for the Kaiord health & fitness data framework. Converts natural language workout descriptions into structured KRD workout objects using the Vercel AI SDK.

Installation

pnpm add @kaiord/ai ai @ai-sdk/anthropic

Usage

import { createTextToWorkout } from "@kaiord/ai";
import { createAnthropic } from "@ai-sdk/anthropic";

const provider = createAnthropic({ apiKey: process.env.ANTHROPIC_API_KEY });
const textToWorkout = createTextToWorkout({
  model: provider("claude-sonnet-4-5-20250929"),
});

const workout = await textToWorkout("30 minutes easy cycling", {
  sport: "cycling",
});

Eval Suite

The eval suite validates LLM output quality against a curated set of workout descriptions.

Running Evals Locally

The suite runs only on your local Claude Code subscription, through eval:live; see Live evals (local only). No provider API key is used.

# Default model (claude-sonnet-5, the official cassette model)
pnpm --filter @kaiord/ai eval:live

# Another Anthropic model
EVAL_MODEL=claude-haiku-4-5 pnpm --filter @kaiord/ai eval:live

pnpm --filter @kaiord/ai eval without :live stays inert unless EVAL_LIVE=1 is exported in your shell. The runner prints per-case counts and saves a JSON report (eval-report-<timestamp>.json) in the package directory, packages/ai/.

Benchmarks

The benchmark suite (src/evals/benchmarks.json) contains 22 curated workout descriptions across:

  • Sports: cycling, running, swimming, generic
  • Complexity: simple, intervals, repetition blocks, mixed
  • Languages: English, Spanish, mixed
  • Zones: FTP percentages, HR zones, pace zones with expected value ranges
  • Edge cases: very short, very long, ambiguous descriptions

Assertions

Each benchmark is evaluated against these criteria:

Every assertion is per-benchmark and binary — evaluateBenchmark folds all of them into one pass. There is no rate across benchmarks, so this table has no threshold column to fill: an earlier revision listed 100% and >= 95% here, and neither was ever implemented.

| Assertion | Dimension | What it checks | | ----------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | | Schema validation | schema | Output must pass Zod workoutSchema. A failure short-circuits; no other dimension is evaluated | | Sport correctness | sport | Detected sport matches expectedSport, when the benchmark sets one | | Step count | steps | Between minSteps and maxSteps | | Zone accuracy | zone | Active steps of the target type within +/- 5%. A zone check with no matching step fails; a check declaring no usable bound is rejected by a keyless test |

Each failure carries the dimension that produced it, so a red result says which capability broke rather than only that something did.

The live suite carries no pass threshold and never calls a model in CI. It runs live only through eval:live on the maintainer's local subscription, and that runner never gates. The floor it used to declare could not fire, so it was removed rather than kept as decoration. What runs on every commit is the assertion logic, the fixtures' own structural invariants and the keyless replay of the committed cassettes, none of which needs a credential.

Adding New Benchmarks

  1. Edit src/evals/benchmarks.json
  2. Add an entry following this schema:
{
  "id": "unique-id",
  "text": "Natural language workout description",
  "expectedSport": "cycling",
  "minSteps": 1,
  "maxSteps": 10,
  "category": "simple|intervals|repetition|zones|mixed|edge",
  "language": "en|es|mixed",
  "zoneCheck": {
    "targetType": "power",
    "minValue": 200,
    "maxValue": 280
  }
}

The zoneCheck field is optional. When present, active and interval steps with the specified target type are validated against the min/max values with a 5% tolerance.

Live evals (local only)

This project holds no provider API key, and no live eval runs in CI (only the keyless replay of committed cassettes does). The only live model access is the maintainer's local Claude Code subscription, driven headless (claude -p) behind a LanguageModelV4 adapter, so the real agent runtime runs unchanged above it:

pnpm --filter @kaiord/ai eval:live                  # one pass of the parser suite
pnpm --filter @kaiord/ai eval:live -- --repeat 5    # five passes, k of n per case
pnpm --filter @kaiord/ai eval:live -- --record      # one cassette per case
pnpm --filter @kaiord/ai eval:live -- --calibrate   # one call, captured for pinning

eval:live is the only script that sets EVAL_LIVE=1; with CI set or without that opt-in the runner stops as INERT before any process starts. pnpm eval stays inert only while EVAL_LIVE is not exported in your shell: it never sets the opt-in, but it does not clear one you exported. Each pass starts with a calibration call, runs one call at a time, stops after EVAL_MAX_CALLS calls (default 50) or above EVAL_MAX_WEEKLY_UTILIZATION (default 0.85), and reports cost as API-equivalent, never as money spent. It never gates: the report holds per-case counts, not a pass rate. The chat-tool and lab-extraction suites need tool calling and document file parts, which claude -p cannot carry, so eval:chat-tools and eval:labs report every case unmeasured and exit 0.

--record with the official model (claude-sonnet-5) writes the committed cassettes (src/evals/cassettes/committed/) and their manifest entries; the served form is pinned to the bare claude-sonnet-5. pnpm test replays them keylessly and fails on any fault. With any other EVAL_MODEL it writes to packages/ai/.eval-cassettes/, which is gitignored and never listed in the manifest.

License

MIT