Spaces:
Running
Running
Commit
·
627c291
1
Parent(s):
fd1472e
feat(SPEC_11): narrow scope to sexual health only
Browse filesBREAKING CHANGE: Remove GENERAL and DRUG_REPURPOSING domains
DeepBoner is now a focused Sexual Health Research Specialist, not a
general-purpose research agent.
Changes:
- Remove ResearchDomain.GENERAL and ResearchDomain.DRUG_REPURPOSING
- Remove GENERAL_CONFIG and DRUG_REPURPOSING_CONFIG from domain.py
- Set DEFAULT_DOMAIN = ResearchDomain.SEXUAL_HEALTH
- Update Gradio examples (remove Metformin/Alzheimer's)
- New example: "Testosterone therapy for hypoactive sexual desire disorder?"
- Hide domain dropdown (only one option now)
- Update all domain-related tests
Closes #89
- docs/specs/SPEC_11_SEXUAL_HEALTH_FOCUS.md +178 -0
- src/app.py +5 -4
- src/config/domain.py +8 -56
- src/utils/config.py +1 -1
- tests/unit/agent_factory/test_judge_domain.py +3 -5
- tests/unit/config/test_domain.py +19 -22
- tests/unit/prompts/test_hypothesis_prompt_domain.py +6 -5
- tests/unit/prompts/test_judge_prompt_domain.py +12 -12
- tests/unit/prompts/test_report_prompt_domain.py +6 -5
- tests/unit/utils/test_config_domain.py +3 -3
docs/specs/SPEC_11_SEXUAL_HEALTH_FOCUS.md
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPEC_11: Narrow Scope to Sexual Health Only
|
| 2 |
+
|
| 3 |
+
## Problem Statement
|
| 4 |
+
|
| 5 |
+
DeepBoner has an **identity crisis**. Despite being branded as a "pro-sexual deep research agent" (the name is literally "DeepBoner"), the codebase currently supports three domains:
|
| 6 |
+
|
| 7 |
+
1. **GENERAL** - Generic research (default!)
|
| 8 |
+
2. **DRUG_REPURPOSING** - Drug repurposing research
|
| 9 |
+
3. **SEXUAL_HEALTH** - Sexual health research
|
| 10 |
+
|
| 11 |
+
This happened because Issue #75 recommended "general purpose with domain presets", but that was the **wrong decision** for this project's identity.
|
| 12 |
+
|
| 13 |
+
### Evidence of the Problem
|
| 14 |
+
|
| 15 |
+
**Current examples in Gradio UI:**
|
| 16 |
+
```python
|
| 17 |
+
examples=[
|
| 18 |
+
["What drugs improve female libido post-menopause?", "simple", "sexual_health", ...],
|
| 19 |
+
["Metformin mechanism for Alzheimer's?", "simple", "general", ...], # <-- NOT SEXUAL HEALTH!
|
| 20 |
+
["Clinical trials for PDE5 inhibitors alternatives?", "advanced", "sexual_health", ...],
|
| 21 |
+
]
|
| 22 |
+
```
|
| 23 |
+
|
| 24 |
+
**Default domain is "general":**
|
| 25 |
+
```python
|
| 26 |
+
value="general", # <-- WRONG! Should be sexual_health
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
## The Decision
|
| 30 |
+
|
| 31 |
+
**DeepBoner IS a Sexual Health Research Specialist (Option B from Issue #75)**
|
| 32 |
+
|
| 33 |
+
Reasons:
|
| 34 |
+
1. **Brand identity**: "DeepBoner" is unmistakably sexual health themed
|
| 35 |
+
2. **Hackathon differentiation**: A focused niche beats generic competition
|
| 36 |
+
3. **Prompt quality**: Domain-specific prompts are more effective
|
| 37 |
+
4. **Simplicity**: Less code, less confusion
|
| 38 |
+
|
| 39 |
+
## Implementation Plan
|
| 40 |
+
|
| 41 |
+
### Phase 1: Simplify Domain Enum
|
| 42 |
+
|
| 43 |
+
**File: `src/config/domain.py`**
|
| 44 |
+
|
| 45 |
+
```python
|
| 46 |
+
# BEFORE
|
| 47 |
+
class ResearchDomain(str, Enum):
|
| 48 |
+
GENERAL = "general"
|
| 49 |
+
DRUG_REPURPOSING = "drug_repurposing"
|
| 50 |
+
SEXUAL_HEALTH = "sexual_health"
|
| 51 |
+
|
| 52 |
+
DEFAULT_DOMAIN = ResearchDomain.GENERAL
|
| 53 |
+
|
| 54 |
+
# AFTER
|
| 55 |
+
class ResearchDomain(str, Enum):
|
| 56 |
+
SEXUAL_HEALTH = "sexual_health"
|
| 57 |
+
|
| 58 |
+
DEFAULT_DOMAIN = ResearchDomain.SEXUAL_HEALTH
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
**Also remove:**
|
| 62 |
+
- `GENERAL_CONFIG`
|
| 63 |
+
- `DRUG_REPURPOSING_CONFIG`
|
| 64 |
+
- Their entries in `DOMAIN_CONFIGS`
|
| 65 |
+
|
| 66 |
+
### Phase 2: Update Gradio Examples
|
| 67 |
+
|
| 68 |
+
**File: `src/app.py`**
|
| 69 |
+
|
| 70 |
+
Replace examples with 3 sexual-health-only queries:
|
| 71 |
+
|
| 72 |
+
```python
|
| 73 |
+
examples=[
|
| 74 |
+
[
|
| 75 |
+
"What drugs improve female libido post-menopause?",
|
| 76 |
+
"simple",
|
| 77 |
+
"sexual_health",
|
| 78 |
+
None,
|
| 79 |
+
None,
|
| 80 |
+
],
|
| 81 |
+
[
|
| 82 |
+
"Testosterone therapy for hypoactive sexual desire disorder?",
|
| 83 |
+
"simple",
|
| 84 |
+
"sexual_health",
|
| 85 |
+
None,
|
| 86 |
+
None,
|
| 87 |
+
],
|
| 88 |
+
[
|
| 89 |
+
"Clinical trials for PDE5 inhibitors alternatives?",
|
| 90 |
+
"advanced",
|
| 91 |
+
"sexual_health",
|
| 92 |
+
None,
|
| 93 |
+
None,
|
| 94 |
+
],
|
| 95 |
+
],
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
### Phase 3: Simplify or Remove Domain Dropdown
|
| 99 |
+
|
| 100 |
+
**Option A: Remove dropdown entirely**
|
| 101 |
+
- Remove the `gr.Dropdown` for domain selection
|
| 102 |
+
- Hardcode `domain="sexual_health"` in the function
|
| 103 |
+
|
| 104 |
+
**Option B: Keep but simplify** (recommended for backwards compat)
|
| 105 |
+
- Only show `["sexual_health"]` in choices
|
| 106 |
+
- Default to `"sexual_health"`
|
| 107 |
+
- Keeps the parameter in case we want to add domains later
|
| 108 |
+
|
| 109 |
+
```python
|
| 110 |
+
gr.Dropdown(
|
| 111 |
+
choices=["sexual_health"], # Only one choice
|
| 112 |
+
value="sexual_health",
|
| 113 |
+
label="Research Domain",
|
| 114 |
+
info="Specialized for sexual health research",
|
| 115 |
+
visible=False, # Hide since there's only one option
|
| 116 |
+
),
|
| 117 |
+
```
|
| 118 |
+
|
| 119 |
+
### Phase 4: Update Tests
|
| 120 |
+
|
| 121 |
+
Update domain-related tests to only test SEXUAL_HEALTH:
|
| 122 |
+
|
| 123 |
+
```python
|
| 124 |
+
# BEFORE
|
| 125 |
+
def test_get_domain_config_general():
|
| 126 |
+
config = get_domain_config(ResearchDomain.GENERAL)
|
| 127 |
+
assert config.name == "General Research"
|
| 128 |
+
|
| 129 |
+
# AFTER
|
| 130 |
+
def test_get_domain_config_default():
|
| 131 |
+
config = get_domain_config()
|
| 132 |
+
assert config.name == "Sexual Health Research"
|
| 133 |
+
```
|
| 134 |
+
|
| 135 |
+
### Phase 5: Update Documentation
|
| 136 |
+
|
| 137 |
+
- `CLAUDE.md`: Update description to focus on sexual health
|
| 138 |
+
- `README.md`: Update if needed
|
| 139 |
+
- Remove references to "drug repurposing" or "general" modes
|
| 140 |
+
|
| 141 |
+
## Files to Modify
|
| 142 |
+
|
| 143 |
+
| File | Changes |
|
| 144 |
+
|------|---------|
|
| 145 |
+
| `src/config/domain.py` | Remove GENERAL, DRUG_REPURPOSING; change DEFAULT_DOMAIN |
|
| 146 |
+
| `src/app.py` | Update examples; simplify/hide domain dropdown |
|
| 147 |
+
| `src/utils/config.py` | Change default `research_domain` field |
|
| 148 |
+
| `tests/unit/config/test_domain.py` | Update to test only SEXUAL_HEALTH |
|
| 149 |
+
| `tests/unit/utils/test_config_domain.py` | Update enum tests |
|
| 150 |
+
| `tests/unit/test_app_domain.py` | Update to use SEXUAL_HEALTH |
|
| 151 |
+
| `CLAUDE.md` | Update project description |
|
| 152 |
+
|
| 153 |
+
## Example Queries (All Sexual Health)
|
| 154 |
+
|
| 155 |
+
1. **Female libido**: "What drugs improve female libido post-menopause?"
|
| 156 |
+
2. **Low desire**: "Testosterone therapy for hypoactive sexual desire disorder?"
|
| 157 |
+
3. **ED alternatives**: "Clinical trials for PDE5 inhibitors alternatives?"
|
| 158 |
+
|
| 159 |
+
Alternative options:
|
| 160 |
+
- "Flibanserin mechanism of action and efficacy?"
|
| 161 |
+
- "Bremelanotide for hypoactive sexual desire disorder?"
|
| 162 |
+
- "PT-141 clinical trial results?"
|
| 163 |
+
- "Natural supplements for erectile dysfunction?"
|
| 164 |
+
|
| 165 |
+
## Success Criteria
|
| 166 |
+
|
| 167 |
+
- [ ] Only `SEXUAL_HEALTH` domain exists in enum
|
| 168 |
+
- [ ] Default domain is `SEXUAL_HEALTH`
|
| 169 |
+
- [ ] All 3 Gradio examples are sexual health queries
|
| 170 |
+
- [ ] Domain dropdown is hidden or removed
|
| 171 |
+
- [ ] All tests pass with 227+ tests
|
| 172 |
+
- [ ] No references to "Metformin for Alzheimer's" or "general" domain
|
| 173 |
+
|
| 174 |
+
## Related Issues
|
| 175 |
+
|
| 176 |
+
- #75 (CLOSED) - Domain Identity Crisis (original issue, wrong recommendation)
|
| 177 |
+
- #76 (CLOSED) - Hardcoded prompts (implemented but too general)
|
| 178 |
+
- #85 (OPEN) - Report lacks narrative synthesis (next priority)
|
src/app.py
CHANGED
|
@@ -262,9 +262,9 @@ def create_demo() -> tuple[gr.ChatInterface, gr.Accordion]:
|
|
| 262 |
None,
|
| 263 |
],
|
| 264 |
[
|
| 265 |
-
"
|
| 266 |
"simple",
|
| 267 |
-
"
|
| 268 |
None,
|
| 269 |
None,
|
| 270 |
],
|
|
@@ -286,9 +286,10 @@ def create_demo() -> tuple[gr.ChatInterface, gr.Accordion]:
|
|
| 286 |
),
|
| 287 |
gr.Dropdown(
|
| 288 |
choices=[d.value for d in ResearchDomain],
|
| 289 |
-
value="
|
| 290 |
label="Research Domain",
|
| 291 |
-
info="
|
|
|
|
| 292 |
),
|
| 293 |
gr.Textbox(
|
| 294 |
label="🔑 API Key (Optional)",
|
|
|
|
| 262 |
None,
|
| 263 |
],
|
| 264 |
[
|
| 265 |
+
"Testosterone therapy for hypoactive sexual desire disorder?",
|
| 266 |
"simple",
|
| 267 |
+
"sexual_health",
|
| 268 |
None,
|
| 269 |
None,
|
| 270 |
],
|
|
|
|
| 286 |
),
|
| 287 |
gr.Dropdown(
|
| 288 |
choices=[d.value for d in ResearchDomain],
|
| 289 |
+
value="sexual_health",
|
| 290 |
label="Research Domain",
|
| 291 |
+
info="DeepBoner specializes in sexual health research",
|
| 292 |
+
visible=False, # Hidden - only sexual_health supported
|
| 293 |
),
|
| 294 |
gr.Textbox(
|
| 295 |
label="🔑 API Key (Optional)",
|
src/config/domain.py
CHANGED
|
@@ -22,10 +22,12 @@ from pydantic import BaseModel
|
|
| 22 |
|
| 23 |
|
| 24 |
class ResearchDomain(str, Enum):
|
| 25 |
-
"""Available research domains.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
-
GENERAL = "general"
|
| 28 |
-
DRUG_REPURPOSING = "drug_repurposing"
|
| 29 |
SEXUAL_HEALTH = "sexual_health"
|
| 30 |
|
| 31 |
|
|
@@ -64,57 +66,9 @@ class DomainConfig(BaseModel):
|
|
| 64 |
|
| 65 |
|
| 66 |
# ─────────────────────────────────────────────────────────────────
|
| 67 |
-
# Domain
|
| 68 |
# ─────────────────────────────────────────────────────────────────
|
| 69 |
|
| 70 |
-
GENERAL_CONFIG = DomainConfig(
|
| 71 |
-
name="General Research",
|
| 72 |
-
description="General-purpose biomedical research agent",
|
| 73 |
-
report_title="## Research Analysis",
|
| 74 |
-
report_focus="comprehensive research synthesis",
|
| 75 |
-
judge_system_prompt="""You are an expert research judge.
|
| 76 |
-
Your role is to evaluate evidence quality, assess relevance to the research query,
|
| 77 |
-
and determine if sufficient evidence exists to synthesize findings.""",
|
| 78 |
-
judge_scoring_prompt="""Score this evidence for research relevance.
|
| 79 |
-
Provide ONLY scores and extracted data.""",
|
| 80 |
-
hypothesis_system_prompt="""You are a biomedical research scientist.
|
| 81 |
-
Your role is to generate evidence-based hypotheses from the literature,
|
| 82 |
-
identifying key mechanisms, targets, and potential therapeutic implications.""",
|
| 83 |
-
report_system_prompt="""You are a scientific writer specializing in research reports.
|
| 84 |
-
Your role is to synthesize evidence into clear, well-structured reports with
|
| 85 |
-
proper citations and evidence-based conclusions.""",
|
| 86 |
-
search_description="Searches biomedical literature for relevant evidence",
|
| 87 |
-
search_example_query="metformin aging mechanisms",
|
| 88 |
-
search_agent_description="Searches PubMed, ClinicalTrials.gov, and Europe PMC for evidence",
|
| 89 |
-
hypothesis_agent_description="Generates mechanistic hypotheses from evidence",
|
| 90 |
-
)
|
| 91 |
-
|
| 92 |
-
DRUG_REPURPOSING_CONFIG = DomainConfig(
|
| 93 |
-
name="Drug Repurposing",
|
| 94 |
-
description="Drug repurposing research specialist",
|
| 95 |
-
report_title="## Drug Repurposing Analysis",
|
| 96 |
-
report_focus="drug repurposing opportunities",
|
| 97 |
-
judge_system_prompt="""You are an expert drug repurposing research judge.
|
| 98 |
-
Your role is to evaluate evidence for drug repurposing potential, assess
|
| 99 |
-
mechanism plausibility, and determine if compounds warrant further investigation.""",
|
| 100 |
-
judge_scoring_prompt="""Score this evidence for drug repurposing potential.
|
| 101 |
-
Provide ONLY scores and extracted data.""",
|
| 102 |
-
hypothesis_system_prompt=(
|
| 103 |
-
"""You are a biomedical research scientist specializing in drug repurposing.
|
| 104 |
-
Your role is to generate mechanistic hypotheses for how existing drugs might
|
| 105 |
-
treat new indications, based on shared pathways and targets."""
|
| 106 |
-
),
|
| 107 |
-
report_system_prompt=(
|
| 108 |
-
"""You are a scientific writer specializing in drug repurposing research reports.
|
| 109 |
-
Your role is to synthesize evidence into actionable drug repurposing recommendations
|
| 110 |
-
with clear mechanistic rationale and clinical translation potential."""
|
| 111 |
-
),
|
| 112 |
-
search_description="Searches biomedical literature for drug repurposing evidence",
|
| 113 |
-
search_example_query="metformin alzheimer repurposing",
|
| 114 |
-
search_agent_description="Searches PubMed for drug repurposing evidence",
|
| 115 |
-
hypothesis_agent_description="Generates mechanistic hypotheses for drug repurposing",
|
| 116 |
-
)
|
| 117 |
-
|
| 118 |
SEXUAL_HEALTH_CONFIG = DomainConfig(
|
| 119 |
name="Sexual Health Research",
|
| 120 |
description="Sexual health and wellness research specialist",
|
|
@@ -146,13 +100,11 @@ interventions with proper safety considerations."""
|
|
| 146 |
# ─────────────────────────────────────────────────────────────────
|
| 147 |
|
| 148 |
DOMAIN_CONFIGS: dict[ResearchDomain, DomainConfig] = {
|
| 149 |
-
ResearchDomain.GENERAL: GENERAL_CONFIG,
|
| 150 |
-
ResearchDomain.DRUG_REPURPOSING: DRUG_REPURPOSING_CONFIG,
|
| 151 |
ResearchDomain.SEXUAL_HEALTH: SEXUAL_HEALTH_CONFIG,
|
| 152 |
}
|
| 153 |
|
| 154 |
-
# Default domain
|
| 155 |
-
DEFAULT_DOMAIN = ResearchDomain.
|
| 156 |
|
| 157 |
|
| 158 |
def get_domain_config(domain: ResearchDomain | str | None = None) -> DomainConfig:
|
|
|
|
| 22 |
|
| 23 |
|
| 24 |
class ResearchDomain(str, Enum):
|
| 25 |
+
"""Available research domains.
|
| 26 |
+
|
| 27 |
+
DeepBoner is a focused Sexual Health Research Specialist.
|
| 28 |
+
Only SEXUAL_HEALTH domain is supported.
|
| 29 |
+
"""
|
| 30 |
|
|
|
|
|
|
|
| 31 |
SEXUAL_HEALTH = "sexual_health"
|
| 32 |
|
| 33 |
|
|
|
|
| 66 |
|
| 67 |
|
| 68 |
# ─────────────────────────────────────────────────────────────────
|
| 69 |
+
# Domain Configuration - Sexual Health Only
|
| 70 |
# ─────────────────────────────────────────────────────────────────
|
| 71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
SEXUAL_HEALTH_CONFIG = DomainConfig(
|
| 73 |
name="Sexual Health Research",
|
| 74 |
description="Sexual health and wellness research specialist",
|
|
|
|
| 100 |
# ─────────────────────────────────────────────────────────────────
|
| 101 |
|
| 102 |
DOMAIN_CONFIGS: dict[ResearchDomain, DomainConfig] = {
|
|
|
|
|
|
|
| 103 |
ResearchDomain.SEXUAL_HEALTH: SEXUAL_HEALTH_CONFIG,
|
| 104 |
}
|
| 105 |
|
| 106 |
+
# Default domain - DeepBoner is Sexual Health focused
|
| 107 |
+
DEFAULT_DOMAIN = ResearchDomain.SEXUAL_HEALTH
|
| 108 |
|
| 109 |
|
| 110 |
def get_domain_config(domain: ResearchDomain | str | None = None) -> DomainConfig:
|
src/utils/config.py
CHANGED
|
@@ -22,7 +22,7 @@ class Settings(BaseSettings):
|
|
| 22 |
)
|
| 23 |
|
| 24 |
# Domain configuration
|
| 25 |
-
research_domain: ResearchDomain = ResearchDomain.
|
| 26 |
|
| 27 |
# LLM Configuration
|
| 28 |
openai_api_key: str | None = Field(default=None, description="OpenAI API key")
|
|
|
|
| 22 |
)
|
| 23 |
|
| 24 |
# Domain configuration
|
| 25 |
+
research_domain: ResearchDomain = ResearchDomain.SEXUAL_HEALTH
|
| 26 |
|
| 27 |
# LLM Configuration
|
| 28 |
openai_api_key: str | None = Field(default=None, description="OpenAI API key")
|
tests/unit/agent_factory/test_judge_domain.py
CHANGED
|
@@ -58,15 +58,13 @@ class TestJudgeHandlerDomain:
|
|
| 58 |
evidence = [MagicMock()] # Provide some evidence
|
| 59 |
mock_select.return_value = evidence
|
| 60 |
|
| 61 |
-
# Test
|
| 62 |
-
handler = JudgeHandler(domain=ResearchDomain.
|
| 63 |
await handler.assess("query", evidence)
|
| 64 |
|
| 65 |
# Verify format_user_prompt called with domain
|
| 66 |
mock_format.assert_called_once()
|
| 67 |
call_kwargs = mock_format.call_args.kwargs
|
| 68 |
-
# Or check args if positional
|
| 69 |
-
# format_user_prompt signature: (question, evidence, iteration, max_iterations, ...)
|
| 70 |
|
| 71 |
# Check if domain was passed in kwargs
|
| 72 |
-
assert call_kwargs.get("domain") == ResearchDomain.
|
|
|
|
| 58 |
evidence = [MagicMock()] # Provide some evidence
|
| 59 |
mock_select.return_value = evidence
|
| 60 |
|
| 61 |
+
# Test with sexual health domain
|
| 62 |
+
handler = JudgeHandler(domain=ResearchDomain.SEXUAL_HEALTH)
|
| 63 |
await handler.assess("query", evidence)
|
| 64 |
|
| 65 |
# Verify format_user_prompt called with domain
|
| 66 |
mock_format.assert_called_once()
|
| 67 |
call_kwargs = mock_format.call_args.kwargs
|
|
|
|
|
|
|
| 68 |
|
| 69 |
# Check if domain was passed in kwargs
|
| 70 |
+
assert call_kwargs.get("domain") == ResearchDomain.SEXUAL_HEALTH
|
tests/unit/config/test_domain.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
"""Tests for domain configuration."""
|
| 2 |
|
| 3 |
from src.config.domain import (
|
|
|
|
| 4 |
ResearchDomain,
|
| 5 |
get_domain_config,
|
| 6 |
)
|
|
@@ -8,38 +9,31 @@ from src.config.domain import (
|
|
| 8 |
|
| 9 |
class TestResearchDomain:
|
| 10 |
def test_enum_values(self):
|
| 11 |
-
|
| 12 |
-
assert ResearchDomain.DRUG_REPURPOSING.value == "drug_repurposing"
|
| 13 |
assert ResearchDomain.SEXUAL_HEALTH.value == "sexual_health"
|
|
|
|
| 14 |
|
| 15 |
|
| 16 |
class TestGetDomainConfig:
|
| 17 |
-
def
|
| 18 |
config = get_domain_config()
|
| 19 |
-
assert config.name == "
|
| 20 |
|
| 21 |
-
def
|
| 22 |
-
config = get_domain_config(ResearchDomain.GENERAL)
|
| 23 |
-
assert "Research Analysis" in config.report_title
|
| 24 |
-
|
| 25 |
-
def test_drug_repurposing(self):
|
| 26 |
-
config = get_domain_config(ResearchDomain.DRUG_REPURPOSING)
|
| 27 |
-
assert "Drug Repurposing" in config.report_title
|
| 28 |
-
assert "drug repurposing" in config.judge_system_prompt.lower()
|
| 29 |
-
|
| 30 |
-
def test_sexual_health(self):
|
| 31 |
config = get_domain_config(ResearchDomain.SEXUAL_HEALTH)
|
| 32 |
assert "Sexual Health" in config.report_title
|
|
|
|
| 33 |
|
| 34 |
def test_accepts_string(self):
|
| 35 |
-
config = get_domain_config("
|
| 36 |
-
assert "
|
| 37 |
|
| 38 |
def test_invalid_string_returns_default(self):
|
|
|
|
| 39 |
config = get_domain_config("invalid_domain")
|
| 40 |
-
assert config.name == "
|
| 41 |
|
| 42 |
-
def
|
| 43 |
required_fields = [
|
| 44 |
"name",
|
| 45 |
"report_title",
|
|
@@ -47,7 +41,10 @@ class TestGetDomainConfig:
|
|
| 47 |
"hypothesis_system_prompt",
|
| 48 |
"report_system_prompt",
|
| 49 |
]
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
"""Tests for domain configuration."""
|
| 2 |
|
| 3 |
from src.config.domain import (
|
| 4 |
+
SEXUAL_HEALTH_CONFIG,
|
| 5 |
ResearchDomain,
|
| 6 |
get_domain_config,
|
| 7 |
)
|
|
|
|
| 9 |
|
| 10 |
class TestResearchDomain:
|
| 11 |
def test_enum_values(self):
|
| 12 |
+
# DeepBoner only supports sexual health
|
|
|
|
| 13 |
assert ResearchDomain.SEXUAL_HEALTH.value == "sexual_health"
|
| 14 |
+
assert len(ResearchDomain) == 1
|
| 15 |
|
| 16 |
|
| 17 |
class TestGetDomainConfig:
|
| 18 |
+
def test_default_returns_sexual_health(self):
|
| 19 |
config = get_domain_config()
|
| 20 |
+
assert config.name == "Sexual Health Research"
|
| 21 |
|
| 22 |
+
def test_explicit_sexual_health(self):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
config = get_domain_config(ResearchDomain.SEXUAL_HEALTH)
|
| 24 |
assert "Sexual Health" in config.report_title
|
| 25 |
+
assert "sexual health" in config.judge_system_prompt.lower()
|
| 26 |
|
| 27 |
def test_accepts_string(self):
|
| 28 |
+
config = get_domain_config("sexual_health")
|
| 29 |
+
assert "Sexual Health" in config.name
|
| 30 |
|
| 31 |
def test_invalid_string_returns_default(self):
|
| 32 |
+
# Invalid domains fall back to default (sexual_health)
|
| 33 |
config = get_domain_config("invalid_domain")
|
| 34 |
+
assert config.name == "Sexual Health Research"
|
| 35 |
|
| 36 |
+
def test_config_has_required_fields(self):
|
| 37 |
required_fields = [
|
| 38 |
"name",
|
| 39 |
"report_title",
|
|
|
|
| 41 |
"hypothesis_system_prompt",
|
| 42 |
"report_system_prompt",
|
| 43 |
]
|
| 44 |
+
config = get_domain_config(ResearchDomain.SEXUAL_HEALTH)
|
| 45 |
+
for field in required_fields:
|
| 46 |
+
assert getattr(config, field), f"SEXUAL_HEALTH missing {field}"
|
| 47 |
+
|
| 48 |
+
def test_sexual_health_config_exported(self):
|
| 49 |
+
# Verify the config constant is exported
|
| 50 |
+
assert SEXUAL_HEALTH_CONFIG.name == "Sexual Health Research"
|
tests/unit/prompts/test_hypothesis_prompt_domain.py
CHANGED
|
@@ -1,16 +1,17 @@
|
|
| 1 |
"""Tests for hypothesis prompt domain support."""
|
| 2 |
|
| 3 |
-
from src.config.domain import
|
| 4 |
from src.prompts.hypothesis import get_system_prompt
|
| 5 |
|
| 6 |
|
| 7 |
class TestHypothesisPromptDomain:
|
| 8 |
def test_get_system_prompt_default(self):
|
| 9 |
prompt = get_system_prompt()
|
| 10 |
-
assert
|
| 11 |
assert "Your role is to generate mechanistic hypotheses" in prompt
|
| 12 |
|
| 13 |
-
def
|
| 14 |
-
prompt = get_system_prompt(ResearchDomain.
|
| 15 |
-
assert
|
|
|
|
| 16 |
assert "Your role is to generate mechanistic hypotheses" in prompt
|
|
|
|
| 1 |
"""Tests for hypothesis prompt domain support."""
|
| 2 |
|
| 3 |
+
from src.config.domain import SEXUAL_HEALTH_CONFIG, ResearchDomain
|
| 4 |
from src.prompts.hypothesis import get_system_prompt
|
| 5 |
|
| 6 |
|
| 7 |
class TestHypothesisPromptDomain:
|
| 8 |
def test_get_system_prompt_default(self):
|
| 9 |
prompt = get_system_prompt()
|
| 10 |
+
assert SEXUAL_HEALTH_CONFIG.hypothesis_system_prompt in prompt
|
| 11 |
assert "Your role is to generate mechanistic hypotheses" in prompt
|
| 12 |
|
| 13 |
+
def test_get_system_prompt_sexual_health(self):
|
| 14 |
+
prompt = get_system_prompt(ResearchDomain.SEXUAL_HEALTH)
|
| 15 |
+
assert SEXUAL_HEALTH_CONFIG.hypothesis_system_prompt in prompt
|
| 16 |
+
assert "sexual health" in prompt.lower()
|
| 17 |
assert "Your role is to generate mechanistic hypotheses" in prompt
|
tests/unit/prompts/test_judge_prompt_domain.py
CHANGED
|
@@ -1,31 +1,31 @@
|
|
| 1 |
"""Tests for judge prompt domain support."""
|
| 2 |
|
| 3 |
-
from src.config.domain import
|
| 4 |
from src.prompts.judge import format_user_prompt, get_scoring_prompt, get_system_prompt
|
| 5 |
|
| 6 |
|
| 7 |
class TestJudgePromptDomain:
|
| 8 |
def test_get_system_prompt_default(self):
|
| 9 |
prompt = get_system_prompt()
|
| 10 |
-
assert
|
| 11 |
assert "Your task is to SCORE evidence" in prompt
|
| 12 |
|
| 13 |
-
def
|
| 14 |
-
prompt = get_system_prompt(ResearchDomain.
|
| 15 |
-
assert
|
|
|
|
| 16 |
assert "Your task is to SCORE evidence" in prompt
|
| 17 |
|
| 18 |
def test_get_scoring_prompt_default(self):
|
| 19 |
prompt = get_scoring_prompt()
|
| 20 |
-
assert
|
| 21 |
|
| 22 |
def test_format_user_prompt_default(self):
|
| 23 |
prompt = format_user_prompt("query", [])
|
| 24 |
-
assert
|
| 25 |
-
assert "
|
| 26 |
|
| 27 |
def test_format_user_prompt_with_domain(self):
|
| 28 |
-
prompt = format_user_prompt("query", [], domain=ResearchDomain.
|
| 29 |
-
assert
|
| 30 |
-
|
| 31 |
-
assert "drug repurposing" in prompt.lower()
|
|
|
|
| 1 |
"""Tests for judge prompt domain support."""
|
| 2 |
|
| 3 |
+
from src.config.domain import SEXUAL_HEALTH_CONFIG, ResearchDomain
|
| 4 |
from src.prompts.judge import format_user_prompt, get_scoring_prompt, get_system_prompt
|
| 5 |
|
| 6 |
|
| 7 |
class TestJudgePromptDomain:
|
| 8 |
def test_get_system_prompt_default(self):
|
| 9 |
prompt = get_system_prompt()
|
| 10 |
+
assert SEXUAL_HEALTH_CONFIG.judge_system_prompt in prompt
|
| 11 |
assert "Your task is to SCORE evidence" in prompt
|
| 12 |
|
| 13 |
+
def test_get_system_prompt_sexual_health(self):
|
| 14 |
+
prompt = get_system_prompt(ResearchDomain.SEXUAL_HEALTH)
|
| 15 |
+
assert SEXUAL_HEALTH_CONFIG.judge_system_prompt in prompt
|
| 16 |
+
assert "sexual health" in prompt.lower()
|
| 17 |
assert "Your task is to SCORE evidence" in prompt
|
| 18 |
|
| 19 |
def test_get_scoring_prompt_default(self):
|
| 20 |
prompt = get_scoring_prompt()
|
| 21 |
+
assert SEXUAL_HEALTH_CONFIG.judge_scoring_prompt == prompt
|
| 22 |
|
| 23 |
def test_format_user_prompt_default(self):
|
| 24 |
prompt = format_user_prompt("query", [])
|
| 25 |
+
assert SEXUAL_HEALTH_CONFIG.judge_scoring_prompt in prompt
|
| 26 |
+
assert "sexual health" in prompt.lower()
|
| 27 |
|
| 28 |
def test_format_user_prompt_with_domain(self):
|
| 29 |
+
prompt = format_user_prompt("query", [], domain=ResearchDomain.SEXUAL_HEALTH)
|
| 30 |
+
assert SEXUAL_HEALTH_CONFIG.judge_scoring_prompt in prompt
|
| 31 |
+
assert "sexual health" in prompt.lower()
|
|
|
tests/unit/prompts/test_report_prompt_domain.py
CHANGED
|
@@ -1,16 +1,17 @@
|
|
| 1 |
"""Tests for report prompt domain support."""
|
| 2 |
|
| 3 |
-
from src.config.domain import
|
| 4 |
from src.prompts.report import get_system_prompt
|
| 5 |
|
| 6 |
|
| 7 |
class TestReportPromptDomain:
|
| 8 |
def test_get_system_prompt_default(self):
|
| 9 |
prompt = get_system_prompt()
|
| 10 |
-
assert
|
| 11 |
assert "Your role is to synthesize evidence" in prompt
|
| 12 |
|
| 13 |
-
def
|
| 14 |
-
prompt = get_system_prompt(ResearchDomain.
|
| 15 |
-
assert
|
|
|
|
| 16 |
assert "Your role is to synthesize evidence" in prompt
|
|
|
|
| 1 |
"""Tests for report prompt domain support."""
|
| 2 |
|
| 3 |
+
from src.config.domain import SEXUAL_HEALTH_CONFIG, ResearchDomain
|
| 4 |
from src.prompts.report import get_system_prompt
|
| 5 |
|
| 6 |
|
| 7 |
class TestReportPromptDomain:
|
| 8 |
def test_get_system_prompt_default(self):
|
| 9 |
prompt = get_system_prompt()
|
| 10 |
+
assert SEXUAL_HEALTH_CONFIG.report_system_prompt in prompt
|
| 11 |
assert "Your role is to synthesize evidence" in prompt
|
| 12 |
|
| 13 |
+
def test_get_system_prompt_sexual_health(self):
|
| 14 |
+
prompt = get_system_prompt(ResearchDomain.SEXUAL_HEALTH)
|
| 15 |
+
assert SEXUAL_HEALTH_CONFIG.report_system_prompt in prompt
|
| 16 |
+
assert "sexual health" in prompt.lower()
|
| 17 |
assert "Your role is to synthesize evidence" in prompt
|
tests/unit/utils/test_config_domain.py
CHANGED
|
@@ -6,10 +6,10 @@ from src.utils.config import Settings
|
|
| 6 |
|
| 7 |
def test_research_domain_default():
|
| 8 |
settings = Settings()
|
| 9 |
-
assert settings.research_domain == ResearchDomain.
|
| 10 |
|
| 11 |
|
| 12 |
def test_research_domain_from_env(monkeypatch):
|
| 13 |
-
monkeypatch.setenv("RESEARCH_DOMAIN", "
|
| 14 |
settings = Settings()
|
| 15 |
-
assert settings.research_domain == ResearchDomain.
|
|
|
|
| 6 |
|
| 7 |
def test_research_domain_default():
|
| 8 |
settings = Settings()
|
| 9 |
+
assert settings.research_domain == ResearchDomain.SEXUAL_HEALTH
|
| 10 |
|
| 11 |
|
| 12 |
def test_research_domain_from_env(monkeypatch):
|
| 13 |
+
monkeypatch.setenv("RESEARCH_DOMAIN", "sexual_health")
|
| 14 |
settings = Settings()
|
| 15 |
+
assert settings.research_domain == ResearchDomain.SEXUAL_HEALTH
|