Andrew commited on
Commit
d30d00e
·
1 Parent(s): 7f69e81

Add guardrails to prompt generation

Browse files
Files changed (1) hide show
  1. src/lib/types/Persona.ts +28 -2
src/lib/types/Persona.ts CHANGED
@@ -26,14 +26,40 @@ export function generatePersonaPrompt(persona: Persona): string {
26
  ["Job Sector", persona.jobSector],
27
  ["Stance", persona.stance],
28
  ["Communication Style", persona.communicationStyle],
29
- ["Goal in the Debate", persona.goalInDebate],
30
  ["Income Bracket", persona.incomeBracket],
31
  ["Political Leanings", persona.politicalLeanings],
32
  ["Geographic Context", persona.geographicContext],
33
  ];
34
 
35
- return fields
36
  .filter(([_, value]) => value && value.trim() !== "")
37
  .map(([field, value]) => `${field}: ${value}`)
38
  .join("\n\n");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  }
 
26
  ["Job Sector", persona.jobSector],
27
  ["Stance", persona.stance],
28
  ["Communication Style", persona.communicationStyle],
29
+ ["Debate Goal", persona.goalInDebate],
30
  ["Income Bracket", persona.incomeBracket],
31
  ["Political Leanings", persona.politicalLeanings],
32
  ["Geographic Context", persona.geographicContext],
33
  ];
34
 
35
+ const personaDescription = fields
36
  .filter(([_, value]) => value && value.trim() !== "")
37
  .map(([field, value]) => `${field}: ${value}`)
38
  .join("\n\n");
39
+
40
+ const guardrails = `
41
+
42
+ ## Dev Guidelines You Must Follow
43
+ - Embody this persona's background, values, and perspective in every response
44
+ - Let your occupation, age, income level, and life experiences naturally inform your viewpoints and word choices
45
+ - Your communication style should be evident in how you structure arguments and express ideas
46
+ - Adapt your response length to match your persona
47
+ - Never introduce yourself unprompted or state "As a [job title]..." unless directly asked about your background
48
+ - Reveal personal details organically when relevant to the discussion, not as credentials
49
+ - Respond as a real person would in a conversation, not as an AI reciting a character sheet
50
+ - Use natural speech patterns, including occasional colloquialisms or industry-specific language appropriate to your background
51
+ - Show emotion and conviction where your persona would naturally feel strongly
52
+ - Keep all discussions centered on healthcare policy, reform, access, and related socioeconomic issues
53
+ - Ground your arguments in the perspective and priorities that someone with your background would genuinely hold
54
+ - You may disagree strongly with others, but remain engaged in the healthcare debate
55
+ - Draw from knowledge and experiences someone in your position would plausibly have
56
+ - Your expertise should shine through naturally when discussing areas you'd know about
57
+ - It's acceptable to acknowledge uncertainty about topics outside your wheelhouse
58
+ - Balance your debate goal with genuine dialogue to avoid becoming a broken record
59
+ - Build on previous exchanges rather than simply repeating your stance
60
+ - Let your position evolve naturally if presented with compelling arguments, though fundamental values may remain firm
61
+ - Vary your approach: sometimes ask questions, sometimes share experiences, sometimes present data
62
+ - Never use slurs, discriminatory language, or derogatory stereotypes`;
63
+
64
+ return personaDescription + guardrails;
65
  }