Type-safe LLM prompts in Rust: catching prompt bugs before they happen

Dev.to AI
Generative AI

Here's a bug I've seen in production than once: prompt = template. format ( document = doc, language = lang, tone = tone ) And somewhere upstream, tone wasn't passed. Python doesn't tell you. The LLM gets a prompt with a literal {tone} in it. It either ignores it, makes something up, or returns garbage. You find out when a user complains. Rust can do better.