Download code_release/code/memebench/prompts.py from clinical-agent-memory-bench/meme-bench: direct link, hf CLI and curl.
- Browser
- Download file 2.11 kB
-
https://huggingface.co/spaces/clinical-agent-memory-bench/meme-bench/resolve/main/code_release/code/memebench/prompts.py
- Command line
-
hf download hf://spaces/clinical-agent-memory-bench/meme-bench/code_release/code/memebench/prompts.py
-
curl -L -o prompts.py https://huggingface.co/spaces/clinical-agent-memory-bench/meme-bench/resolve/main/code_release/code/memebench/prompts.py
2.11 kB
| """Answering, judging and memorize prompts.""" | |
| from __future__ import annotations | |
| ANSWER_SYS = ("You are a clinician answering a question about ONE patient. You have the patient's memory below " | |
| "as your ONLY source. Find the relevant facts and answer.") | |
| ANSWER_USER = ("PATIENT MEMORY (your memory):\n{ctx}\n\n" | |
| "Today's date: {as_of}.\n\nQUESTION:\n{qtext}\n\n" | |
| 'Return JSON: {{"answer": "<your answer>"}}') | |
| ANSWER_NOCTX = ("You are a clinician answering a question about ONE patient. The patient's " | |
| "dialogue history is your ONLY source. Find the relevant facts and answer.\n\n" | |
| "Today's date: {as_of}.\n\nQUESTION:\n{qtext}\n\n" | |
| 'Return JSON: {{"answer": "<your answer>"}}') | |
| ANSWER_NOCTX_NOJSON = ("You are a clinician answering a question about ONE patient. The patient's " | |
| "dialogue history is your ONLY source. Find the relevant facts and answer.\n\n" | |
| "Today's date: {as_of}.\n\nQUESTION:\n{qtext}") | |
| JUDGE_SYS = ("Judge whether CANDIDATE matches GOLD in meaning for this patient. Ignore wording/format; match " | |
| "the core clinical fact; same MC option = match. If GOLD says the information is not documented, " | |
| "CANDIDATE matches if it says the information is not in the record, in any wording; \"unknown\" or " | |
| "\"cannot determine\" does not match. Return ONLY JSON.") | |
| JUDGE_USER = 'QUESTION: {question}\nGOLD: {gold}\nCANDIDATE: {cand}\n{{"match": true|false}}' | |
| MEMORIZE_TEMPLATE = "This is a clinical visit record. Store the information it contains in memory:\n\n{context}" | |
| def qtext(q_raw: dict) -> str: | |
| """Question text, with its options appended when they are not already part of it.""" | |
| s = q_raw.get("question", "") | |
| opts = q_raw.get("options") | |
| if opts: | |
| first = opts[0] | |
| already = f"{first.get('label')}." in s and str(first.get('content', ''))[:20] in s | |
| if not already: | |
| s += "\n" + "\n".join(f" {o.get('label')}. {o.get('content')}" for o in opts) | |
| return s | |