Files
hanzo.ai/scripts/zen.mjs

23 lines
955 B
JavaScript

#!/usr/bin/env node
/**
* The Zen catalogue a page reads: @zenlm/models, as Zen.
*
* node scripts/zen.mjs
*
* Writes lib/data/zen.json from the installed @zenlm/models with each
* description and feature read through lib/upstream (`bare`, `said`), so no
* sentence about what a checkpoint descends from reaches a page or a client
* chunk, and with no price: a rate is the price list's, read when a page opens
* (api.hanzo.ai/v1/pricing). Part of `prebuild`; every page imports the JSON,
* never the package.
*/
import { writeFileSync } from 'node:fs'
import { allModels } from '@zenlm/models'
import { bare, said } from '../lib/upstream.ts'
const FILE = new URL('../lib/data/zen.json', import.meta.url)
const models = allModels.map(({ pricing, ...m }) => ({ ...m, description: bare(m.description), features: m.features.filter(said) }))
writeFileSync(FILE, `${JSON.stringify(models, null, 2)}\n`)
console.log(`zen: ${models.length} models`)