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
Python: Handlebars messages helper ignores its argument and always reads chat_history from the context #14535
The Handlebars messages helper ignores its argument. {{messages my_history}} always reads this.context["chat_history"], whatever variable is passed. If no variable named chat_history exists it raises KeyError. If one exists with different content, the wrong history is rendered. The Jinja2 helper messages(history) uses the argument it is given, so the two template formats disagree.
Where
python/semantic_kernel/prompt_template/utils/handlebars_system_helpers.py (checked against current main, 9974625):
Expected: the Handlebars output matches Jinja2 for the first case, and the third case renders RIGHT.
Notes
The existing tests only pass a variable literally named chat_history, so they do not catch this. I have a fix ready: use the first positional argument, and fall back to chat_history from the context when no argument is given so current templates keep working.
Activity