3 ms·
Tosijs-schema is a super lightweight schema-first LLM-native JSON schema library
- podperson 10mo agoI wrote this library this weekend after realizing that Zod was really not designed for the use-cases I want JSON schemas for: 1) defining response formats for LLMs and 2) as a single source of truth for data structures.
- 7thpower 10mo agoWhat led you to that conclusion?
- nerdponx 10mo agoAnd what makes this different? What makes it LLM-native?
- podperson 10mo agoIt generates schemas that are strict by default while Zod requires you to set everything manually. This is actually discussed in the linked article (READ ME file).
- halayli 10mo agoThat's not true based on zod docs. https://zod.dev/api?id=objects https://zod.dev/api?id=objects most of the claims you're making against zod is inaccurate. the readme feels like false claims by ai.
- podperson 10mo agoIt seems to be true to me. And aside from the API stuff (because I am far from an expert user of Zod) all of this has been carefully verified.
- dsabanin 10mo agoZod's validation errors are awful, the json schema it generates for LLM is ugly and and often confusing, the types structures Zod creates are often unintelligible in the and there's even no good way to pretty print a schema when you're debugging. Things are even worse if you're stuck with zod/v3
- sesm 10mo agoWhat's wrong with Zod validation errors?
- light_hue_1 10mo agoNone of this makes a lot of sense. Validation errors are largely irrelevant for LLMs and they can understand them just fine. The type structure looks good for LLMs. You can definitely pretty print a schema at runtime. This all seems pretty uninformed.
- podperson 10mo ago1. Zoe’s documentation, such as it is 2. Code examples
- taveras 10mo agoHappy to see more tools in the data schema space. Will you support Standard Schema (https://standardschema.dev https://standardschema.dev)? How does this compare to typebox (https://github.com/sinclairzx81/typebox https://github.com/sinclairzx81/typebox)?
- _heimdall 10mo agoHad you considered using something like XML as the transport format rather than JSON? If the UX is similar to zod it wouldn't matter what the underlying data format is, and XML is meant to support schemas unlike JSON.
- podperson 10mo agoJSON Schema is a schema built on JSON and it’s already being used. Using XML would mean converting the XML into JSON schema to define the response from the LLM. That said, JSON is “language neutral” but also super convenient for JavaScript developers and typically more convenient for most people than XML.
- yeasku 10mo agoLLMs are not people. We want a format for LLMs or for people?
- deleted 10mo ago[deleted]
- podperson 10mo agoJSON schema is very human readable.
- _heimdall 10mo agoWhy does that matter though? MCP is meant for LLMs not humans, and for something like this lib it seems the human side if the API is based on JavaScript not JSON.
- drowsspa 10mo agoAs a person myself, I very much prefer JSON
- _heimdall 10mo ago
- bbminner 10mo agoWhile llms accept json schemas for constrained decoding, they might not respect all of the constraints.
- yunohn 10mo ago> It checks a fixed sample of items (roughly 1%) regardless of size > This provides O(1) performance Wouldn’t 1% of N still imply O(N) performance?
- kevmo314 10mo ago> For large arrays (>97 items) and large dictionaries How did we end up in a world where 97 items is considered large?
- deleted 10mo ago[deleted]
- vages 10mo agoMind your off-by-1s: 97 items is not large, 98 is.