agentprompt-rs: Jinja2 LLM prompt templates in Rust with strict-mode missing variable errors (opens in new tab)
The bug that took two days to find The prompt looked fine in the template file. Nothing obviously broken. You are a helpful assistant. The user's name is {{ user_name }}. Greet them warmly and help with their question. The variable was populated from a user profile lookup. Normally. But the lookup had an early return path. When the profile was not found, the dictionary passed to the template renderer was missing the user_name key entirely. The default Jinja2 behavior, and the default for most...
Read the original article