Add current date to query rewrite and chat answer prompts
Author: pamelafoxCreated Feb 3, 2026Updated Feb 3, 2026
Summary
Add the current date as a template variable to both the query rewrite and chat answer prompts. This will help the LLM understand temporal context when answering questions like "What happened last week?" or "What are the current policies?"
Proposed Changes
- Pass
current_date(formatted as "February 3, 2026") to the query rewrite prompt (query_rewrite.system.jinja2) - Pass
current_dateto the chat answer prompt (chat_answer.system.jinja2) - Update the Jinja2 templates to include the date in the system message
Implementation Notes
- Use
datetime.now().strftime("%B %d, %Y")for formatting - Add
current_datetosystem_template_variablesin bothchatreadretrieveread.pycall sites - Consider if the date should also be added to the agentic retrieval path in
approach.py
Related
This was partially implemented but reverted from the Jinja2 migration PR to keep that change focused.
Source: Azure-Samples/azure-search-openai-demo