https://www.boundaryml.com logo
🟡 Discussion on BAML type checks with ENUM respon...
# questions
s
Hey folks - curious how BAML type checks work. Suppose I have a prompt that expects a response of ENUM type, but I notice the LLM (Gemini 3 flash) keeps giving an output with an ENUM type, but followed by a large chunk of explanation of its reasoning. Does BAML reject that or somehow parse the ENUM response from that? If it does parsing, what's the logic?
g
Great question! We do try to parse the enum value out from any string the LLM gives. IIRC we regex search for your enum variants.
s
got it. What if the LLM answer included more than one ENUM value? For example, if it answered: "Answer: RED The picture looks like a red horse, not a BLUE, YELLOW, or GREEN one, so the answer is RED." All four ENUM values are mentioned
Does it reject in this case?
If regex matches more than one value
v
Then we reject it!
Well we do a bit more of a heuristic
We look at frequency
s
Sounds great
2 Views