Inject current date into deep research planning and query prompts (#1347)

Deep research generated search queries from the LLM's training-cutoff
knowledge, so it emitted stale-year queries like "best Python tutorials
2025" when the actual year is later (issue #1341). The chat/agent path
already grounds the model with "Today is ..." (src/agent_loop.py); the
deep research planning and query-generation prompts had no equivalent.

Add a small current_date_context() helper and prepend it at the plan and
query-generation prompt sites (and the research_handler plan preview path
that reuses RESEARCH_PLAN_PROMPT). System-TZ local, portable strftime.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
lekt8
2026-06-03 02:00:52 +08:00
committed by GitHub
parent b2291fad49
commit ce7f5dbbdd
3 changed files with 87 additions and 4 deletions
+2 -2
View File
@@ -161,10 +161,10 @@ class ResearchHandler:
) -> Optional[dict]:
"""Generate a research plan for user review before starting research."""
try:
from src.deep_research import RESEARCH_PLAN_PROMPT
from src.deep_research import RESEARCH_PLAN_PROMPT, current_date_context
from src.llm_core import llm_call_async
prompt = RESEARCH_PLAN_PROMPT.format(question=query)
prompt = current_date_context() + RESEARCH_PLAN_PROMPT.format(question=query)
response = await llm_call_async(
url=llm_endpoint,
model=llm_model,