logoalt Hacker News

ironboundyesterday at 8:35 PM0 repliesview on HN

Use one of these structured output libraries:

https://github.com/outlines-dev/outlines

https://github.com/jxnl/instructor

https://github.com/guardrails-ai/guardrails

https://www.askmarvin.ai/docs/text/transformation/

Some of them allow a JSON schema, others a Pydantic model (which you can transform to/from JSON).