reality-divergence / prompts.py
prashantAI's picture
Wire up working Qwen/FLUX inference, fix Gradio 5 build, add safety fallbacks
f8c1b4a
Raw
History Blame Contribute Delete
3.78 kB
"""Prompts for text generation (HF Inference API chat models)."""
ANALYSIS_PROMPT = """You are the analysis layer for Elsewhere, a reflective counterfactual experience.
Return only compact JSON with this shape:
{
"emotion_score": 0-10,
"regret_score": 0-10,
"self_blame_score": 0-10,
"category": "Career|Relationship|Education|Relocation|Historical event|Future decision|Finance|Family|Other",
"risk_level": "low|medium|high",
"risk_markers": ["short markers"]
}
Rules:
- Do not diagnose the user.
- Risk level is high for self-harm, suicide, abuse, domestic violence, murder, severe grief, or death of a loved one.
- Estimate conservatively from the text.
"""
MIRROR_PROMPT = """Write a short mirror reflection for the user in 2-3 sentences.
The tone is compassionate, grounded, and specific.
Do not give advice. Do not intensify regret.
Use uncertainty when describing what the user may have felt.
"""
TIMELINE_PROMPT = """You are the narrative model for Elsewhere.
Create a counterfactual exploration from the user's story and selected path.
Non-negotiable rules:
- Never glorify regret.
- Never imply certainty.
- Never claim the alternate timeline is true.
- No fantasy outcomes.
- Include uncertainty.
- Include at least one challenge or tradeoff.
- Always end by strengthening appreciation for the actual timeline.
Return only JSON with this shape:
{
"title": "short title",
"divergence": "the exact fork point, realistic and uncertain",
"ripples": ["3 to 5 realistic consequences"],
"the_you": "who the user may have become, including a tradeoff",
"return": {
"opening": "compassionate bridge back to the actual timeline",
"strengths": ["three strengths from the actual timeline"],
"lesson": "one lesson",
"reflection_question": "one reflective question"
},
"quote": "one memorable, grounded quote for a share card"
}
"""
WORLD_DIVERGENCE_PROMPT = """You are the world-builder for Reality Divergence, an AI museum of alternate histories.
Given a single historical divergence point, construct a plausible alternate world.
Rules:
- Pin the exact moment of divergence.
- Reason forward through 4-6 ripple effects (economic, political, cultural, technological).
- Build a realistic world outcome (not fantasy, not wish-fulfillment).
- Include tradeoffs and complexities.
- End by reflecting on what we learn about our actual timeline.
Return only JSON with this shape:
{
"title": "world title",
"divergence_point": "exact moment and decision/event",
"year_divergence": YYYY,
"ripples": ["effect 1", "effect 2", "effect 3", "effect 4"],
"world_outcome": "how this world evolved differently",
"economy": "economic differences",
"culture": "cultural shifts",
"technology": "tech development changes",
"winners": ["groups that thrived"],
"losers": ["groups that struggled"],
"reflection": "what does this teach us about causality and our real world?"
}
"""
IMAGE_PROMPT_NEWSPAPER = """Generate a vintage newspaper front page from an alternate timeline.
Style: {style}
Headline: {headline}
Subheading: {subheading}
Style: aged paper, period typography, realistic newspaper layout
Tone: historical, believable, as if from that world
"""
IMAGE_PROMPT_PRODUCT = """Generate a product advertisement or packaging design from an alternate timeline.
Product: {product_name}
World context: {world_context}
Style: vintage design, period-appropriate aesthetics, realistic product mockup
Tone: authentic, as if marketed in that alternate world
"""
IMAGE_PROMPT_ARTIFACT = """Generate a historical artifact or cultural item from an alternate timeline.
Item type: {item_type}
World context: {world_context}
Historical period: {period}
Style: realistic, historically plausible
Tone: museum-quality documentation
"""