structlm
A library that generates schemas for structured JSON outputs from LLMs using a TypeScript-like custom schema definition, based on the idea that LLMs read TypeScript types better than JSON schema types. Reported results show accuracy on par with or better than JSON schemas while using 20-40% fewer tokens.
What it addresses
JSON schema types are less effectively read by LLMs and consume more tokens than TypeScript-style type definitions.
Shared over time
Each entry reflects what was shared on that date. Details may have changed since then.
structlm
A library that generates schemas for structured JSON outputs from LLMs using a TypeScript-like custom schema definition, based on the idea that LLMs read TypeScript types better than JSON schema types. Reported results show accuracy on par with or better than JSON schemas while using 20-40% fewer tokens.
Problem: JSON schema types are less effectively read by LLMs and consume more tokens than TypeScript-style type definitions.
Posted by @lunarcave · Original source ↗
Source text · @lunarcave · · Source ↗
I've been tinkering around with a library that can generate schemas for structured JSON outputs, according to a Typescript-like custom schema definition: https://github.com/nadeesha/structlm