-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON schema support for dynamic types #771
Comments
We'd love to use this feature. We use Pydantic extensively, including at our ORM layer. This would allow us to continue defining types ergonomically in Python, and have them available in BAML functions. |
Same! For those of us with a bunch of zod schemas already built out, its a lot easier to adopt BAML going forward if we don't have to big bang migrate everything over to BAML in one go, and can instead do it a little bit at a time and intermingle our existing zod schemas. This'd be great! |
Here's a question about an alternative approach (sorry for the delayed response, @arunbahl !): would you be interested in something that could take your pydantic/zod schemas and generate BAML code from them? Part of the reason we haven't shipped this yet is because:
|
I would also love to use this feature / it is kind of necessary for my use case to fully embrace BAML. And the alternative approach @sxlijin would not work for my use cases. For context, I am working on an agentic framework and using BAML for my prompting backend. Basically, there are two key reasons I need this feature: The alternative approach would not work for me because: |
On a related note, having serde options for TypeBuilder and FieldType objects would be a partial solve for my use case. I think currently having the JSON support for dynamic types solves my use case better because of the first point I mentioned. However, being able to serialize and de-serialize TypeBuilder objects and field types would also add a lot of flexibility for me - not sure if other people would make use of this. In general my use case necessitates the use of a lot of dynamic types - so having maximum flexibility with how I work with them adds a lot of value to me. |
jfan via Discord wants this: https://discord.com/channels/1119368998161752075/1316873547078959155 |
we have a community-contributed solution to this you can check out here: https://github.com/BoundaryML/baml-examples/tree/main/json-schema-to-baml |
We have a working implementation of this in #655 that allows users to inject JSON schemas into
TypeBuilder
using the following syntaxes. We're current holding off on merging this, though, because JSON schema is a very complex format and we don't have any users asking for this. If you're interested in trying this out, please let us know and we'll merge this in and make sure this will work for your use case!Python
TypeScript
The text was updated successfully, but these errors were encountered: