https://www.boundaryml.com logo
Getting a BAMLValidationError
# help
m
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
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
> 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
@baml-sam
b
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/alias https://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.
If you share your specific prompt/data, I'm happy to help you with that specifically!
s
Thanks! Ok I'll create a new thread for this so I can paste stuff there