We tried 14 levers to get reliable SDUI card JSON from a local LLM model
In freemansoft/Flutter-AdaptiveCards a demonstration Dart chat server hands a question to a local Ollama model, asks for the answer as Adaptive Card JSON, and a Flutter client app renders the reply. Everything below is an attempt to make that card generation more reliable and more faithful to what was asked. The figures are transcribed from ModelBehavior.md , a lab notebook in that repository. Giving the explanation a place in the card worked; banning prose did not qwen2.5-coder:7b answered a request to explain a snippet of code with a valid Adaptive Card, then appended the explanation after it. A reply is either a card or prose, with nothing in between: the client renders a card only when the entire reply is one, so appending the explanation demoted the whole thing to text and the user saw raw JSON. The obvious repair was to tell the model harder not to write anything after the card. That did not work. It scored the same and stopped producing cards at all,...