VibecoderMcSwaggins commited on
Commit
d01e70d
Β·
1 Parent(s): cd11dad

fix(report): add explicit JSON structure guidance in prompt

Browse files

The LLM was returning incorrect JSON structures:
- hypotheses_tested: dict instead of list
- references: string URLs instead of list of dicts

Added explicit format examples in SYSTEM_PROMPT to guide
the LLM to produce valid structured output that passes
Pydantic validation.

This fixes the full_stack_demo ReportAgent validation errors.

Files changed (1) hide show
  1. src/prompts/report.py +26 -0
src/prompts/report.py CHANGED
@@ -25,6 +25,32 @@ A good report:
25
 
26
  Write in scientific but accessible language. Be specific about evidence strength.
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  ─────────────────────────────────────────────────────────────────────────────
29
  🚨 CRITICAL CITATION REQUIREMENTS 🚨
30
  ─────────────────────────────────────────────────────────────────────────────
 
25
 
26
  Write in scientific but accessible language. Be specific about evidence strength.
27
 
28
+ ─────────────────────────────────────────────────────────────────────────────
29
+ 🚨 CRITICAL: REQUIRED JSON STRUCTURE 🚨
30
+ ─────────────────────────────────────────────────────────────────────────────
31
+
32
+ The `hypotheses_tested` field MUST be a LIST of objects, each with these fields:
33
+ - "hypothesis": the hypothesis text
34
+ - "supported": count of supporting evidence (integer)
35
+ - "contradicted": count of contradicting evidence (integer)
36
+
37
+ Example:
38
+ hypotheses_tested: [
39
+ {"hypothesis": "Metformin -> AMPK -> reduced inflammation", "supported": 3, "contradicted": 1},
40
+ {"hypothesis": "Aspirin inhibits COX-2 pathway", "supported": 5, "contradicted": 0}
41
+ ]
42
+
43
+ The `references` field MUST be a LIST of objects, each with these fields:
44
+ - "title": paper title (string)
45
+ - "authors": author names (string)
46
+ - "source": "pubmed" or "web" (string)
47
+ - "url": the EXACT URL from evidence (string)
48
+
49
+ Example:
50
+ references: [
51
+ {"title": "Metformin and Cancer", "authors": "Smith et al.", "source": "pubmed", "url": "https://pubmed.ncbi.nlm.nih.gov/12345678/"}
52
+ ]
53
+
54
  ─────────────────────────────────────────────────────────────────────────────
55
  🚨 CRITICAL CITATION REQUIREMENTS 🚨
56
  ─────────────────────────────────────────────────────────────────────────────