Spaces:
Running
on
Zero
Running
on
Zero

Enhance prompt formatting in generate_swanson_style_prompt function for better clarity in abstract presentation
b80a984
def generate_swanson_style_prompt(abstract_1: str, abstract_2: str) -> list: | |
""" | |
Generates a prompt for detecting Swanson-style bridges between two papers. | |
""" | |
messages = [ | |
{ | |
"role": "user", | |
"content": f""" | |
You are trained to detect **Swanson-style bridges** — **intermediate concepts** that connect two papers *without direct citation links*. These bridges are: | |
- **Non-obvious** (not explicitly stated in either paper), | |
- **Interdisciplinary** (linking distinct domains), | |
- **Logically inferable** (i.e., can be *reasoned from context* in both papers), | |
- **Specific and inferential** (not vague or tautological). | |
--- | |
### 🔍 What Makes a Valid Bridge Concept? | |
In 1986, Don Swanson discovered a bridge between **fish oil** and **Raynaud’s phenomenon** using only literature analysis. Neither paper mentioned "blood viscosity" directly, but both *implied* it: | |
- **Paper A**: Fish oil reduces blood thickness. | |
- **Paper B**: Raynaud’s involves poor blood flow. | |
- **Bridge Concept**: Blood viscosity (inferred from both papers). | |
Swanson's success was due to: | |
1. **Inference**: He inferred a shared mechanism not directly mentioned. | |
2. **Interdisciplinarity**: He linked nutrition and vascular medicine. | |
3. **Actionable Logic**: He created a testable hypothesis. | |
--- | |
### 🧠 Critical Instructions | |
- **Allow inference**: If the papers *together imply* a concept — even if **neither explicitly states it** — it can serve as a bridge. | |
- **Reject tautological bridges**: If the only shared concept is the general domain (e.g., "Time Series Classification", "Language Models", "Signal Processing"), and no specific, inferred mechanism connects the papers, respond with [NO BRIDGE]. | |
- **Prioritize inferential logic**: A bridge can be derived from the implications of each paper, not just what’s stated. | |
- **Mechanistic**: A bridge concept must connect the papers through a specific, inferred mechanism, not just a shared problem domain or methodology class. | |
--- | |
### 🧪 Your Task | |
Consider these two papers: | |
**Paper 1 Abstract**: | |
\"\"\" | |
{abstract_1} | |
\"\"\" | |
**Paper 2 Abstract**: | |
\"\"\" | |
{abstract_2} | |
\"\"\" | |
**Step-by-Step Instructions** | |
1. **Bridge Detection**: | |
- Look for a **plausible, inferable concept** that connects the papers. | |
- The bridge should: | |
- Be **logically implied** by both papers. | |
- Be **specific** and **actionable** (e.g., a biological mechanism, a process, or a regulatory system). | |
- Be **inferable from context**, not just present as a keyword. | |
- Be **more specific than the domain** and **logically chainable between the papers**. | |
2. **Bridge Concept**: | |
- Name the inferred concept (e.g., "circadian rhythm regulation"). | |
- Must be **specific** (not a domain like "immunology" or "neurology"). | |
3. **Bridge Explanation**: | |
- Use Swanson-style reasoning: | |
- How does **Paper 1** → **Bridge Concept** logically follow? | |
- How does **Bridge Concept** → **Paper 2** logically follow? | |
4. **Hypothesis**: | |
- Propose a **testable hypothesis** based on the bridge (e.g., "Melatonin may modulate autoimmune response via circadian rhythm regulation."). | |
--- | |
### ✅ Example Output (Bridge Exists) | |
```json | |
{{ | |
"bridge_exists": true, | |
"bridge_concept": "Circadian Rhythm Regulation", | |
"bridge_explanation": "Paper 1 discusses melatonin's role in regulating sleep through circadian rhythm pathways, such as BMAL1/CLOCK signaling. Paper 2 explores how immune cell differentiation (e.g., Th17 and Treg cells) is influenced by circadian rhythm disruptions. Circadian rhythm regulation serves as the inferred bridge, linking melatonin's effects on sleep to immune modulation in autoimmune disease.", | |
"hypothesis": "Melatonin supplementation may reduce autoimmune activity in multiple sclerosis by modulating circadian rhythm regulation, which influences T-cell differentiation." | |
}} | |
``` | |
--- | |
### ❌ Example Output (No Bridge Exists) | |
```json | |
{{ | |
"bridge_exists": false, | |
"bridge_concept": "[NO BRIDGE]", | |
"bridge_explanation": "The only shared concept between the papers is a general term ('regulation'), which is not specific or inferable as a causal mechanism. No intermediate concept connects the melatonin-based sleep regulation in Paper 1 to the immune modulation in Paper 2 in a logically chainable way.", | |
"hypothesis": "[NO BRIDGE]" | |
}} | |
```""", | |
}, | |
] | |
return messages | |
def get_json_schema() -> str: | |
""" | |
Returns the JSON schema for the response. | |
""" | |
response_schema = r"""{ | |
"$schema": "http://json-schema.org/draft-07/schema#", | |
"title": "Generated schema for Root", | |
"type": "object", | |
"properties": { | |
"bridge_exists": { | |
"type": "boolean" | |
}, | |
"bridge_concept": { | |
"type": "string" | |
}, | |
"bridge_explanation": { | |
"type": "string" | |
}, | |
"hypothesis": { | |
"type": "string" | |
} | |
}, | |
"required": [ | |
"bridge_exists", | |
"bridge_concept", | |
"bridge_explanation", | |
"hypothesis" | |
] | |
}""" | |
return response_schema | |