Live data from Hacker News

Tosijs-schema is a super lightweight schema-first LLM-native JSON schema library

npmjs.com

1–10 of 31 posts

Re: Tosijs-schema is a super lightweight schema-first LLM-native JSON schema library

#3

I 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.

What led you to that conclusion?

Re: Tosijs-schema is a super lightweight schema-first LLM-native JSON schema library

#4
post #3

I 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.

What led you to that conclusion?

And what makes this different? What makes it LLM-native?

Re: Tosijs-schema is a super lightweight schema-first LLM-native JSON schema library

#6
post #3

I 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.

What led you to that conclusion?

Zod'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

Re: Tosijs-schema is a super lightweight schema-first LLM-native JSON schema library

#7
post #4
post #3

Earlier quoted context omitted.

What led you to that conclusion?

And what makes this different? What makes it LLM-native?

It 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).

Re: Tosijs-schema is a super lightweight schema-first LLM-native JSON schema library

#8

Had 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.

JSON 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.

Re: Tosijs-schema is a super lightweight schema-first LLM-native JSON schema library

#9
post #3

I 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.

What led you to that conclusion?

1. Zoe’s documentation, such as it is 2. Code examples

Re: Tosijs-schema is a super lightweight schema-first LLM-native JSON schema library

#10
post #6
post #3

Earlier quoted context omitted.

What led you to that conclusion?

Zod'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

What's wrong with Zod validation errors?
Post reply on HN