SPB Git

spb/wp30_uqo

Public
2.9 KB · 50 lines latex
1% auto-generated from src/wp30/prompts.py2\begin{footnotesize}\begin{verbatim}3"""Prompt templates (frozen at Phase 7). Receiver prompts are identical across methods4  except for the message slot."""5SYSTEM_RECEIVER = ("You are a careful assistant. Answer the question using ONLY the provided6  material. "7                   "If the material does not contain the answer, reply exactly: unknown.")8SYSTEM_RECEIVER_NOMSG = ("You are a careful assistant. Answer the question. If you do not9  know, reply exactly: unknown.")1011def receiver_user_text(material_label: str, material: str, question: str, family: str) ->12  str:13    if family == "exec":14        return f"{material_label}:\n{material}\n\nTask: {question}"15    fmt = "Give a short answer (a few words or a number), with no explanation."16    return f"{material_label}:\n{material}\n\nQuestion: {question}\n{fmt}"1718def receiver_question_only(question: str, family: str) -> str:19    if family == "exec":20        return f"Task: {question}"21    return f"Question: {question}\nGive a short answer (a few words or a number), with no22      explanation."2324# Sender prompts (question-blind: no question shown; question-aware: question appended)25SUMMARY_SYSTEM = "You are a precise note-taker. You write faithful summaries that preserve26  exact names, identifiers, numbers, units, dates, statuses and negations."27def summary_user(doc: str, budget_tokens: int, question: str | None) -> str:28    q = f"\nThe reader will need to answer this question: {question}\n" if question else29      "\nThe reader's future questions are unknown; preserve every concrete fact (who, what,30      where, when, how much, status).\n"31    return (f"Summarize the following document in at most {budget_tokens} tokens (about32      {int(budget_tokens*0.75)} words). Copy identifiers, "33            f"numbers, dates and names exactly as written. Mark explicitly what is NOT34              stated if relevant.{q}\nDocument:\n{doc}\n\nSummary:")3536EVIDENCE_SYSTEM = ("You extract structured evidence. Output ONLY a JSON object with a key37  \"facts\": a list of objects "38                   "{\"entity\": str, \"attribute\": str, \"value\": str, \"quote\": str}39                     where quote is a short EXACT substring of the document "40                   "supporting the fact, and optionally a key \"notes\": a short string for41                     anything important that does not fit the schema, "42                   "and a key \"unknowns\": list of things the document explicitly leaves43                     unstated. Copy values verbatim.")44def evidence_user(doc: str, budget_tokens: int, question: str | None) -> str:45    q = f"\nThe reader will need to answer this question: {question}\n" if question else46      "\nThe reader's future questions are unknown; capture every concrete fact.\n"47    return f"Extract structured evidence from the document. Keep the JSON under48      {budget_tokens} tokens.{q}\nDocument:\n{doc}\n\nJSON:"49\end{verbatim}\end{footnotesize}50
Files · d5e182fa7d7d5118aa92e61c47c40ed848da0ecf
Menu

Theme