ax icon indicating copy to clipboard operation
ax copied to clipboard

Standard Schema for Signature Input/Output?

Open austinm911 opened this issue 4 months ago • 6 comments

I've only recently came across DSPy and ax so I might not be so familiar with the paradigms here. But as a TS person, the familiarity of zod, valibot, arktype, effect/schema, etc is probably important for people to gain an immediate understanding of a new project. Especially since most are going to be more familiar with Zod usage patterns, like with Vercel AI and something like Mastra.

It's also not immediately clear to me that if you have types/schemas defined that you want to use as Input/Output Signatures, can you reuse those? As I'm looking through, it seems like you have to manually maintain the special Signature string when your project may be using Standard Schema for the same schema logic. I could very well be missing something though.

For example here, would you be able to reuse the SearchResult output schema with ax?

Anyways, I thought a newcomer's thoughts might be helpful as I really like to idea of not maintaining prompts that DSPy as I understand, really revolves around.

Haven't used this but looks like this may be relevant to mention as a Standard Schema -> JSON Schema converter https://xsai.js.org/docs/packages-top/xsschema

My attempt at trying to answer this myself, leaving this here. https://chatgpt.com/share/68c217a6-c35c-8013-88d1-8488d78b49a9

Maybe this is more of a discussion than an issue.

austinm911 avatar Sep 11 '25 00:09 austinm911

came here to say I'd love it if the project supported zod

FilipLjubic avatar Sep 14 '25 22:09 FilipLjubic

+1 for zod

muhajirdev avatar Oct 08 '25 23:10 muhajirdev

@dosco Absolutely baffling that this doesn't support zod. Please support it.

pranavsastry-sarvam avatar Oct 10 '25 08:10 pranavsastry-sarvam

will look into supporting zod

dosco avatar Oct 10 '25 20:10 dosco

We need your inputs here. https://github.com/ax-llm/ax/pull/388

dosco avatar Oct 15 '25 20:10 dosco

Even a simple one level deep "dictionary" (which you could have in an array) would unlock so much more flexibility.

Given how many (if not most?) LLMs support structured output using Zod/JSONSchema, it's very puzzling to see this library force me to treat a simple array like { a: string, b: boolean}[] as any[] (via the json type) which I then have to parse for myself.

That said, I love the idea of DSPy and that you've made Typescript version available 💚

umbrellasalesman02 avatar Oct 22 '25 08:10 umbrellasalesman02