[feat] add TOON to output formats
Product
BAML
Problem Statement / Use Case
AI is becoming cheaper and more accessible, but larger context windows allow for larger data inputs as well. LLM tokens still cost money – and standard JSON is verbose and token-expensive.
Proposed Solution
„Token-Oriented Object Notation is a compact, human-readable format designed for passing structured data to Large Language Models with significantly reduced token usage.“
It claims to be a drop-in replacement for JSON that typically uses 30–60% fewer tokens.
https://github.com/johannschopplich/toon
Alternative Solutions
No response
Additional Context
No response
that would be awesome !
I think we should implement this soon to try to reduce token cost
we are looking for contributors to drive this through.
We would need a spec of how to serialize BAML Types into this format in the prompt, like this document: https://gloochat.notion.site/XML-Outputs-218bb2d26216806fb4dfef242d150c51?source=copy_link
https://crates.io/crates/toon-format/0.3.0
Then we can use an opensource crate to adapt our parser to turn the TOON output into json > back to the baml parser