json-schema-for-llms overview
What it is
json-schema-for-llms is a library, not a command-line tool, published on npm as json-schema-for-llms. According to the README and the npm package, it takes JSON too large for an LLM's context window and turns it into a compact JSON Schema with real examples and counts. You can then merge schemas and check new documents against them without calling a model. Its maker suggested this tool to Toolsmith Weekly.
Key features
- The README lists four main functions:
describe, which builds a JSON Schema with types, counts, ranges, categories and example records;merge, which combines schemas;fits, which reports field paths a new document adds; andcompact, which returns whichever of the document or its schema is smaller, for a prompt.
Getting started
- Install it with npm, bun, pnpm or yarn (
npm install json-schema-for-llms) and import it as an ES module. It needs Node 18 or later. The README says it also runs on Bun and Deno; on Deno you can add it withdeno add jsr:@carmenaresearch/json-schema-for-llms, or usenpm:json-schema-for-llms.
Pricing
Free and open source (MIT).
Drafted with AI assistance.