"""Prompt templates (frozen at Phase 7). Receiver prompts are identical across methods except for the message slot.""" SYSTEM_RECEIVER = ("You are a careful assistant. Answer the question using ONLY the provided material. " "If the material does not contain the answer, reply exactly: unknown.") SYSTEM_RECEIVER_NOMSG = ("You are a careful assistant. Answer the question. If you do not know, reply exactly: unknown.") def receiver_user_text(material_label: str, material: str, question: str, family: str) -> str: if family == "exec": return f"{material_label}:\n{material}\n\nTask: {question}" fmt = "Give a short answer (a few words or a number), with no explanation." return f"{material_label}:\n{material}\n\nQuestion: {question}\n{fmt}" def receiver_question_only(question: str, family: str) -> str: if family == "exec": return f"Task: {question}" return f"Question: {question}\nGive a short answer (a few words or a number), with no explanation." # Sender prompts (question-blind: no question shown; question-aware: question appended) SUMMARY_SYSTEM = "You are a precise note-taker. You write faithful summaries that preserve exact names, identifiers, numbers, units, dates, statuses and negations." def summary_user(doc: str, budget_tokens: int, question: str | None) -> str: q = f"\nThe reader will need to answer this question: {question}\n" if question else "\nThe reader's future questions are unknown; preserve every concrete fact (who, what, where, when, how much, status).\n" return (f"Summarize the following document in at most {budget_tokens} tokens (about {int(budget_tokens*0.75)} words). Copy identifiers, " f"numbers, dates and names exactly as written. Mark explicitly what is NOT stated if relevant.{q}\nDocument:\n{doc}\n\nSummary:") EVIDENCE_SYSTEM = ("You extract structured evidence. Output ONLY a JSON object with a key \"facts\": a list of objects " "{\"entity\": str, \"attribute\": str, \"value\": str, \"quote\": str} where quote is a short EXACT substring of the document " "supporting the fact, and optionally a key \"notes\": a short string for anything important that does not fit the schema, " "and a key \"unknowns\": list of things the document explicitly leaves unstated. Copy values verbatim.") def evidence_user(doc: str, budget_tokens: int, question: str | None) -> str: q = f"\nThe reader will need to answer this question: {question}\n" if question else "\nThe reader's future questions are unknown; capture every concrete fact.\n" return f"Extract structured evidence from the document. Keep the JSON under {budget_tokens} tokens.{q}\nDocument:\n{doc}\n\nJSON:"