SPB Git

spb/wp30_uqo

Public
2.7 KB · 31 lines python
1"""Prompt templates (frozen at Phase 7). Receiver prompts are identical across methods except for the message slot."""2SYSTEM_RECEIVER = ("You are a careful assistant. Answer the question using ONLY the provided material. "3                   "If the material does not contain the answer, reply exactly: unknown.")4SYSTEM_RECEIVER_NOMSG = ("You are a careful assistant. Answer the question. If you do not know, reply exactly: unknown.")56def receiver_user_text(material_label: str, material: str, question: str, family: str) -> str:7    if family == "exec":8        return f"{material_label}:\n{material}\n\nTask: {question}"9    fmt = "Give a short answer (a few words or a number), with no explanation."10    return f"{material_label}:\n{material}\n\nQuestion: {question}\n{fmt}"1112def receiver_question_only(question: str, family: str) -> str:13    if family == "exec":14        return f"Task: {question}"15    return f"Question: {question}\nGive a short answer (a few words or a number), with no explanation."1617# Sender prompts (question-blind: no question shown; question-aware: question appended)18SUMMARY_SYSTEM = "You are a precise note-taker. You write faithful summaries that preserve exact names, identifiers, numbers, units, dates, statuses and negations."19def summary_user(doc: str, budget_tokens: int, question: str | None) -> str:20    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"21    return (f"Summarize the following document in at most {budget_tokens} tokens (about {int(budget_tokens*0.75)} words). Copy identifiers, "22            f"numbers, dates and names exactly as written. Mark explicitly what is NOT stated if relevant.{q}\nDocument:\n{doc}\n\nSummary:")2324EVIDENCE_SYSTEM = ("You extract structured evidence. Output ONLY a JSON object with a key \"facts\": a list of objects "25                   "{\"entity\": str, \"attribute\": str, \"value\": str, \"quote\": str} where quote is a short EXACT substring of the document "26                   "supporting the fact, and optionally a key \"notes\": a short string for anything important that does not fit the schema, "27                   "and a key \"unknowns\": list of things the document explicitly leaves unstated. Copy values verbatim.")28def evidence_user(doc: str, budget_tokens: int, question: str | None) -> str:29    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"30    return f"Extract structured evidence from the document. Keep the JSON under {budget_tokens} tokens.{q}\nDocument:\n{doc}\n\nJSON:"31
Files · fea8e12394fac49c22b00e41baf681fd35f0576e
Menu

Theme