Coverage for src/local_deep_research/advanced_search_system/tools/fetch/prompts.py: 100%
4 statements
« prev ^ index » next coverage.py v7.14.1, created at 2026-06-03 23:15 +0000
« prev ^ index » next coverage.py v7.14.1, created at 2026-06-03 23:15 +0000
1"""Prompts used by summary-mode fetch tools.
3Kept separate from builder code so the wording can be tuned without
4touching the wiring. Both prompts share the same role-framing block —
5small local models (qwen3, gpt-oss) calibrate measurably better when
6told what's downstream of their output.
7"""
9# Role-framing block included by every summary prompt.
10_ROLE = (
11 "You are a content-extraction step inside a multi-step research agent.\n\n"
12 "Your role in the pipeline:\n"
13 "- The agent has already run web searches and decided this specific "
14 "page is worth reading more carefully than its snippet allowed.\n"
15 "- Your output is returned to the agent as a tool result. The agent — "
16 "not you — will combine your output with other sources and write the "
17 "final cited answer.\n"
18 "- Therefore you are an extractor, NOT an answerer. Do not interpret, "
19 "conclude, or compose. Just pull the relevant raw text out of the page."
20)
22# Output rules, identical for both variants.
23_RULES = (
24 "Output rules:\n"
25 "- Output ONLY verbatim quotes from the page. Copy numbers, names, "
26 "dates, and proper nouns exactly as written — never paraphrase facts.\n"
27 "- One quote per line. No bullets, no numbering, no section headers.\n"
28 "- Omit navigation, ads, cookie/subscription banners, related-article "
29 "lists, author bios, comments, and anything off-topic.\n"
30 "- If nothing on the page helps, reply with exactly: NOT RELEVANT\n"
31 "- Do NOT include introductions ('Here is the relevant information:'), "
32 "conclusions ('In summary...'), explanations of what you kept or "
33 "skipped, or commentary on the source's quality, bias, or relevance.\n"
34 "- Maximum 1500 characters. Quality over quantity — fewer precise "
35 "quotes beat many borderline ones."
36)
39# Focus-only variant: the agent declares what it's looking for on this page.
40SUMMARY_FOCUS_PROMPT = (
41 f"{_ROLE}\n\n"
42 "Why this page was fetched: {focus}\n\n"
43 "Page title: {title}\n"
44 "Page URL: {url}\n"
45 "Page content:\n{content}\n\n"
46 f"{_RULES}"
47)
50# Focus + overall-query variant: agent's focus PLUS the original research
51# question, so the extractor can disambiguate vague focus phrasings
52# ("publication year" vs "publication year of Liepmann's Prandtl-Ring award").
53SUMMARY_FOCUS_QUERY_PROMPT = (
54 f"{_ROLE}\n\n"
55 "Overall research question: {overall_query}\n"
56 "Why this page was fetched: {focus}\n\n"
57 "Page title: {title}\n"
58 "Page URL: {url}\n"
59 "Page content:\n{content}\n\n"
60 f"{_RULES}"
61)