Bringing Structured Outputs and Schema-Aligned Parsing to Golang, Java, PHP, Ruby, Rust, and More
With today's release of BAML 0.55.0, we're excited to announce that BAML now
supports Golang, Java, PHP, Ruby, Rust, and any language which you might want to
use. Check it out here!
What is BAML?
BAML is an open-source programming language that combines a great developer
experience - live preview, IDE integration, first-class tests - with new
techniques to make it easy to get structured output
out of LLMs.
How do you support all languages?
For any BAML function you define, you can now
expose that function over an HTTP/RESTful interface, and
call it using an OpenAPI-generated client in the language of your choice.
And, of course, it's all 100% local, so you retain control over your prompts and
data models.
Show me an example!
Developers define two key primitives in BAML: prompts and output schemas. For
example, to define an ExtractReceipt function that asks GPT4o to extract a
receipt from an image:
You can now start a BAML server to expose this function over HTTP:
which you can curl to get a parsed Receipt:
If you've followed the quickstart guide, the development server will
also automatically generate an OpenAPI client for you in the language of your choosing.
We've added example projects that demonstrate this for Golang, Java, PHP, Ruby,
and Rust in our baml-examples
repo, but to save you a click,
we've also included snippets here:
Golang
Java
PHP
Ruby
Rust
You can see the full list of client languages that OpenAPI supports
here.
If this seems useful to you, visit the quickstart to try it out today!