BamlValidationError: Failed to parse LLM response: Failed to coerce value: [InferedObject(String(\"I willkor\", Complete))] - Hey I am getting this when I am running a baml function I run a fixup but it doesnt have the full response what can I do to fix this
b
baml-sam
11/02/2025, 7:44 PM
If the response isn’t getting parsed, you have three things that you can change:
- use a smarter model
- make your schema easier for the model to follow
- update your prompt
If you share your function&schema&prompt I can make some suggestions!
s
Sanjan
12/07/2025, 11:22 PM
> make your schema easier for the model to follow
Do you have any generic guidelines for this? I'm running into a similar issue so trying to see what would work
Sanjan
12/07/2025, 11:22 PM
@baml-sam
b
baml-sam
12/08/2025, 12:07 AM
Assorted guidelines, off the top of my head:
- Use alias and description fields to provide hints/examples about what the LLM should put in a field https://docs.boundaryml.com/ref/attributes/aliashttps://docs.boundaryml.com/ref/attributes/description
- Use less nesting in your data structures, i.e. hoist fields into the top-level.
- LLMs are bad at counting. Don't rely on their ability to do numeric reasoning.
- Be specific in your prompt: saying something like "don't make mistakes" is meaningless, because the LLM doesn't know what a "mistake" is; instead identify a mistake that the LLM makes in your use case, identify what it should do, and encourage it to do the thing it should do. (This is the [pink elephant problem](https://eval.16x.engineer/blog/the-pink-elephant-negative-instructions-llms-effectiveness-analysis).)
- Reasoning fields should go before output fields, in the same way that chain-of-thought reasoning comes before the answer.
baml-sam
12/08/2025, 12:07 AM
If you share your specific prompt/data, I'm happy to help you with that specifically!
s
Sanjan
12/08/2025, 12:22 AM
Thanks! Ok I'll create a new thread for this so I can paste stuff there