BoundaryML / baml

BAML is a language that helps you get structured data from LLMs, with the best DX possible. Works with all languages. Check out the promptfiddle.com playground
https://docs.boundaryml.com
Apache License 2.0
1.09k stars 34 forks source link

allow optional lists and maps #948

Open sxlijin opened 3 weeks ago

sxlijin commented 3 weeks ago

We currently allow neither of these properties to be declared:

class Foo {
  a string[]?
  b map<string, string>?
}

because the parser, in its current error-correcting behavior, coerces an unset parameter into an empty list / map.

However, we've had numerous asks for this, and there's no good reason to impose this (somewhat artificial) restriction on our users, so we should just allow this in the type system and parser.

Users to update: