llm icon indicating copy to clipboard operation
llm copied to clipboard

enable $ without template variables in system prompts

Open henrynine opened this issue 2 months ago • 0 comments

while working with a system prompt for latex generation, i found that $ characters in a template system prompt that don't refer to a template variable will cause an error since Template.extract_vars will return a list containing None values. by ignoring None when checking for missing template vars, this error is avoided. using safe_substitute over substitute should be fine here because there is already a check for missing variables, and allows the use of $ characters that don't refer to template vars in a system prompt without raising an error for an invalid placeholder.

henrynine avatar Apr 22 '24 23:04 henrynine