DEV Community

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
Sign in to keep reading the full article.

Keyboard Shortcuts

Navigation

Next / previous post
j/k
Open post
oorEnter
Preview post
v

Post Actions

Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Save / unsave
s

Recommendations

Add interest / feed
Enter
Not interested
x

Go to

Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Discover
gb
Search
/

General

Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help