General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
TheEvertw
ArjanCodes
comments
Comments by "TheEvertw" (@TheEvertw) on "How To Do AI Prompt Templating" video.
Templates separate the String from the code used to render it. They make it easier to imagine how a rendered document is going look, than having dozens of f-strings sprinkled throughout one or more code files. If you just want a single prompt, an f-string is fine. If you want a document generated from a data set, use Jinja2 (or another templating engine, like Mako or Django).
3
Jinja2 is great when you can re-use your special formatting over several templates. It is a bit restrictive but that makes writing correct templates easier. I use templates a lot for code generation, where the templates have almost no overlap, meaning there is very little re-use of special formatting filters. In that case, Mako is more powerful. But Mako is harder to debug.
2