You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG: Jinja filters on a template parameter break when a YAML seed loads #4272
When a YAML seed loads, SeedPrompt and SeedObjective render the template once with only the path variables. A filter on a parameter that isn't supplied yet runs on the placeholder. {{ prompt | upper }} turns into {{ PROMPT }}, so the later render with prompt=... fails with 'PROMPT' is undefined. {{ prompt | length }} turns into 0, and filters like replace or trim are just dropped.
default and the is tests already keep the template as it is (#3098), and so do filters that loop over the value, like join. Other filters don't.
loaded as 'Say {{ PROMPT }}'
render failed: Error rendering template '<unnamed template>': 'PROMPT' is undefined
loaded as '0 characters'
rendered: '0 characters'
None of the bundled templates put a filter on a parameter, so only custom ones run into this. A fix is to wrap every filter at load with the same deferral guard as default (_render_trusted_template_value in seed.py). I have it ready with a test and will open a PR.
Activity