instructor-js icon indicating copy to clipboard operation
instructor-js copied to clipboard

feeding instructor a json schema instead of zod schema

Open rgarcia opened this issue 1 year ago • 0 comments

I'm trying to use LLMs to generate OpenAPI schemas, and running into some roadblocks trying to use instructor. It mainly boils down to the fact that zod + typescript types don't really work well when schemas are recursive (OpenAPI specs have lots of recursion). It also seems weird that I'm doing all this work to convert the OpenAPI schema to zod when they publish a JSON schema.

How would you go about doing this? I've peaked at how instructor-js works and I'm tempted to use some of the primitives in zod-stream there and kind of roll-my-own thing similar to instructor but based on json schema instead of zod. I'm hoping you have better ideas :)

Thanks for building instructor!

rgarcia avatar Jul 03 '24 00:07 rgarcia