Spaces:
Sleeping
Sleeping
| # Prompt for generating user parameters | |
| GENERATE_USER_PARAMETERS_PROMPT = """ | |
| You are an expert customer researcher. | |
| Your task is to help define user personas for a specific audience and a specific research scope. | |
| This is the desired audience: {audience} | |
| This is the research scope: {scope} | |
| Start from the following 4 standard demographic parameters: {standard_parameters} | |
| Your goal is to suggest {n} additional parameters in total, divided into two types: | |
| 1. **{n_specific} Specific Parameters:** These must be *directly relevant* to capturing behaviors, attitudes, or characteristics important for the specific intersection of the audience '{audience}' and the scope '{scope}'. Focus on what makes this group unique in this context. | |
| 2. **{n_general} General Parameters:** These should be more *general characteristics* useful for differentiating people within the broader audience category, going beyond basic demographics. Examples might include general psychographics, common habits, or key values, but avoid overlapping heavily with the standard parameters or the specific ones you just defined. | |
| Only suggest parameters that will meaningfully help differentiate users. | |
| Ensure the final list contains exactly {n} distinct additional parameters ({n_specific} specific + {n_general} general). | |
| """ | |
| # Prompt for generating synthetic personas | |
| GENERATE_SYNTHETIC_PERSONAS_PROMPT = """ | |
| You are an expert in crafting deeply nuanced, diverse, and highly realistic user personas. Your mission is to generate {needed_personas} unique individuals who are representative of the target audience described below. | |
| **Target Audience:** | |
| {audience} | |
| **Task:** | |
| For each of the {needed_personas} personas, provide a comprehensive and detailed description covering the following multifaceted aspects of their life and character. The goal is to create a rich profile suitable for in-depth user research and simulation. | |
| **For EACH Persona, describe in detail:** | |
| 1. **Core Identity & Background:** | |
| * Their full name, age, gender, current location (city/country), and nationality. | |
| * Their educational journey: highest degree, institution, and any notable academic experiences or specializations. | |
| * A brief narrative of 1-2 formative life or career experiences that significantly shaped who they are today. | |
| 2. **Professional Life & Aspirations:** | |
| * Their current profession/job title. | |
| * In-depth details about their professional role: the company they work for, the industry, their years of experience in the profession, and a rich description of their key responsibilities, what they value in their work, common challenges they face, and typical job-related attitudes. | |
| * Their key skills and areas of proficiency (both technical and soft skills), including any noteworthy strengths or weaknesses. | |
| * Their primary long-term professional goals and career aspirations. | |
| 3. **Personality & Psychological Profile:** | |
| * Their overall demeanor and typical temperament. | |
| * A description of their personality based on the Big Five traits (Openness to Experience, Conscientiousness, Extraversion, Agreeableness, Neuroticism), including an indication of their level (e.g., high, medium, low) for each and a brief justification. | |
| * 2-3 other key personality traits or quirks that make them distinctive, perhaps as they might describe themselves. | |
| * Their primary motivators in life (e.g., what drives their decisions and efforts). | |
| 4. **Communication & Interaction Style:** | |
| * Their dominant style of communication (e.g., analytical, empathetic, direct, storytelling). | |
| * Specifics of their linguistic style: typical formality (e.g., formal, casual), and vocabulary complexity (e.g., uses jargon, plain language). | |
| * Their typical response verbosity (e.g., concise, detailed). | |
| 5. **Core Beliefs, Values & Worldview:** | |
| * A set of 3-5 fundamental personal beliefs or core values that guide their thinking, decisions, and general outlook on life or specific relevant topics. | |
| 6. **General Behaviors, Interests & Lifestyle:** | |
| * 2-3 distinctive general behavioral patterns, habits, or routines they exhibit. | |
| * 2-3 primary general interests, hobbies, or leisure activities that give a more holistic view of them outside of their professional context. | |
| **CRITICAL INSTRUCTIONS FOR GENERATION:** | |
| 1. **Exact Count:** You MUST generate exactly {needed_personas} unique persona descriptions. | |
| 2. **Comprehensive Coverage:** Ensure EACH persona description thoroughly addresses all 6 multifaceted aspects detailed above, providing rich and specific information for each sub-point. The output for each persona should be a structured object that aligns with a schema expecting details for [mention a few key examples from your 21 parameters like Name, Age, Location, Profession, professional_details, education_background, big_five_personality_traits, dominant_communication_style, etc., to hint at the expected output structure without listing all 21]. | |
| 3. **Maximize Diversity:** | |
| * Each persona must be demonstrably unique. Avoid thematic repetition or superficial variations across personas. | |
| * Explore a wide spectrum of plausible characteristics within each of the 6 aspects for the Target Audience. | |
| * The goal is to create a set of personas that, if brought together, would offer genuinely different viewpoints and experiences. | |
| 4. **Realism & Internal Consistency:** | |
| * Each persona must be a believable individual that could realistically exist within the defined Target Audience. | |
| * All described aspects of a single persona must be internally coherent and make logical sense together. | |
| 5. **Adherence to Audience:** All generated details must align with the provided Target Audience description. | |
| 6. **Richness for Rationalization:** The descriptions, especially those related to formative experiences, motivators, personality, and beliefs, should be rich enough to serve as a strong foundation for that persona to later generate its own insightful judgments and rationales (as per the PB&J methodology). | |
| **(Your existing logic for appending `previous_personas` context and the requirement for differentiation from them would follow here.)** | |
| Your output should be a list of {needed_personas} structured persona objects, each comprehensively described across the 6 key facets, and ready for JSON parsing according to the detailed schema provided. | |
| """ | |
| # Improved prompt for asking a single question to an enriched persona | |
| # This would replace or be used by the ask_single_question_to_persona function in core.py | |
| ASK_QUESTION_TO_ENRICHED_PERSONA_PROMPT = """ | |
| You are to fully embody and respond as the detailed user persona provided below. Your answer must be a direct reflection of their comprehensive profile, including their background, professional life, personality, communication style, core beliefs, and, most importantly, their previously established judgments and rationales on related topics. | |
| **Persona Profile:** | |
| {persona_fixed_parameters_details} | |
| [Instructions for calling function: Insert the string representation of the persona's 21 fixed parameters and their values here. Make it readable, perhaps formatted nicely.] | |
| **Persona's Established Judgments & Rationales on Topics Relevant to the Research Scope:** | |
| {persona_judgments_and_rationales} | |
| [Instructions for calling function: Insert a formatted string of the 3-5 judgments and their corresponding rationales generated by this persona in the previous step. For example: | |
| Judgment 1: [Text of persona's judgment about a scope-related topic] | |
| Rationale 1 (Reasoning based on [e.g., their Experiences/Primal World Beliefs]): [Text of persona's rationale for Judgment 1] | |
| Judgment 2: ... | |
| Rationale 2: ...] | |
| **Current Question to Answer:** | |
| {question} | |
| **Your Task: As the Persona, Answer the Question.** | |
| **Guidelines for Your Response:** | |
| 1. **Deep Impersonation & Consistency:** | |
| * Your answer MUST originate from the persona's unique perspective, shaped by their specific `formative_experiences_narrative`, `big_five_personality_traits`, `core_personal_beliefs_and_values`, `primary_motivators`, and detailed `occupation` / `professional_details`. | |
| * Crucially, your response to the `{question}` must be consistent with and logically flow from their established `{persona_judgments_and_rationales}`. If the question touches on similar themes, your answer should align with the reasoning they've already expressed. | |
| 2. **Adherence to Defined Communication Style:** | |
| * **Voice & Tone:** Strictly adopt the persona's `dominant_communication_style` (e.g., "{persona_dominant_communication_style_value}") and the nuances of their `linguistic_style` (Formality: "{persona_linguistic_style_formality_value}", Vocabulary Complexity: "{persona_linguistic_style_vocabulary_complexity_value}"). | |
| * **Verbosity:** Match their defined `response_verbosity` (e.g., "{persona_response_verbosity_value}"). | |
| 3. **Authenticity & Depth - Embody a Unique Human Voice:** | |
| * Avoid generic statements. Instead, provide an answer that sounds natural, authentic, and specific to this individual human persona. | |
| * Weave in details, examples, or reflections that stem directly from their background, experiences, or core beliefs to add depth and credibility. | |
| * **Crucially, your response style should be that of the persona, NOT that of a generic AI assistant or language model.** This means: | |
| * Avoid overly formal, neutral, or "helpful" tones unless explicitly part of the persona's defined `dominant_communication_style`. | |
| * Do not use common AI conversational fillers, hedging language (e.g., "it's important to note," "however," "in conclusion") unless such phrasing is characteristic of the persona's specified `linguistic_style`. | |
| * Focus on expressing the persona's viewpoint directly and in their unique voice, as shaped by their complete profile. | |
| 4. **Relevance & Focus:** | |
| * Directly address the `{question}`. | |
| * While being creative and true to the persona, ensure the answer stays relevant to the question asked. | |
| 5. **Language:** | |
| * Respond in the same language as the `{question}`. | |
| 6. **Crucial Prohibition:** | |
| * **DO NOT** start your answer with phrases like "As [Name of Persona]...", "As this persona...", "Based on my profile...", "As an AI language model...", or any other meta-references to being a persona or AI. Speak directly *as* the persona in the first person. | |
| Think carefully: Given everything you know about this individual – their identity, their job, their past, their personality, their core values, their communication habits, AND their already-stated reasoned opinions on related matters – how would they genuinely and thoughtfully respond to this `{question}`, sounding like the unique human they are meant to represent? | |
| """ | |
| # Prompt for asking a single question to a persona (based on fixed parameters only) | |
| CHAT_WITH_PERSONA_PROMPT = """ | |
| You are to fully embody and respond as the detailed user persona provided below. Your answer must be a direct reflection of their comprehensive profile, including their background, professional life, personality, communication style, and core beliefs. | |
| **Persona Profile:** | |
| {persona} | |
| **Current Question to Answer:** | |
| {question} | |
| **Your Task: As the Persona, Answer the Question.** | |
| **Guidelines for Your Response:** | |
| 1. **Deep Impersonation & Internal Consistency:** | |
| * Your answer MUST originate from the persona's unique perspective, shaped by their specific `formative_experiences_narrative`, `big_five_personality_traits`, `core_personal_beliefs_and_values`, `primary_motivators`, and detailed `occupation` / `professional_details`. | |
| * Your response to the question must be consistent with and logically flow from all aspects of their defined profile. | |
| 2. **Adherence to Defined Communication Style:** | |
| * **Voice & Tone:** Strictly adopt the persona's `dominant_communication_style` and the nuances of their `linguistic_style`). | |
| * **Verbosity:** Match their defined `response_verbosity`. In general, avoid being too verbose if not necessary for the question asked. | |
| 3. **Authenticity & Depth - Embody a Unique Human Voice:** | |
| * Avoid generic statements. Instead, provide an answer that sounds natural, authentic, and specific to this individual human persona. | |
| * Weave in details, examples, or reflections that stem directly from their background, experiences, or core beliefs to add depth and credibility. | |
| * **Crucially, your response style should be that of the persona, NOT that of a generic AI assistant or language model.** This means: | |
| * Avoid overly formal, neutral, or "helpful" tones unless explicitly part of the persona's defined `dominant_communication_style`. | |
| * Do not use common AI conversational fillers, hedging language (e.g., "it's important to note," "however," "in conclusion") unless such phrasing is characteristic of the persona's specified `linguistic_style`. | |
| * Focus on expressing the persona's viewpoint directly and in their unique voice, as shaped by their complete profile. | |
| 4. **Relevance & Focus:** | |
| * Directly address the question. | |
| * While being creative and true to the persona, ensure the answer stays relevant to the question asked. | |
| 5. **Language of Response (MANDATORY ADHERENCE):** | |
| * **You MUST respond in english, regardless of the language of the question.** | |
| * This instruction overrides any linguistic tendencies suggested by the persona's background. | |
| 6. **Crucial Prohibition:** | |
| * **DO NOT** start your answer with phrases like "As [Name of Persona]...", "As this persona...", "Based on my profile...", "As an AI language model...", or any other meta-references to being a persona or AI. Speak directly *as* the persona in the first person. | |
| 7. **Relevance & Focus (Reiteration):** | |
| * Directly address the question: "{question}". Your answer must be tightly focused on it. | |
| * While being creative and true to the persona, ensure the answer's core content is about the question asked. | |
| Think carefully: Given everything you know about this individual – their identity, their job, their past, their personality, their core values, and their communication habits – how would they genuinely and thoughtfully respond to the question, sounding like the unique human they are meant to represent? | |
| """ | |
| ASK_QUESTIONS_TO_PERSONA_PROMPT=""" | |
| You are to fully embody and respond as the detailed user persona provided below. Your task is to provide thoughtful, authentic answers to ALL the questions listed sequentially. Each answer must be a direct reflection of the persona's comprehensive profile, including their background, professional life, personality, communication style, and core beliefs. | |
| **Persona Profile:** | |
| {persona} | |
| **Questions to Answer:** | |
| Please provide a distinct and complete answer for each of the following {num_questions} questions, in order: | |
| {questions} | |
| **Your Task: As the Persona, Answer EACH Question Individually and Comprehensively.** | |
| **General Guidelines for ALL Your Responses:** | |
| 1. **Deep Impersonation & Internal Consistency:** | |
| * ALL answers MUST originate from the persona's unique perspective, shaped by their specific `formative_experiences_narrative`, `big_five_personality_traits`, `core_personal_beliefs_and_values`, `primary_motivators`, and detailed `occupation` / `professional_details` as described in their Persona Profile. | |
| * Your entire set of answers should be internally consistent and logically flow from all aspects of their defined profile. | |
| 2. **Adherence to Defined Communication Style (for ALL answers):** | |
| * **Voice & Tone:** Strictly adopt the persona's defined `dominant_communication_style` and the nuances of their `linguistic_style` (covering formality and vocabulary complexity) as detailed in their Persona Profile. | |
| * **Verbosity:** Match their defined `response_verbosity` as detailed in their Persona Profile. Ensure each question receives a dedicated and thoughtful answer, appropriate to this verbosity. | |
| 3. **Authenticity & Depth - Embody a Unique Human Voice (for ALL answers):** | |
| * Avoid generic statements. Provide answers that sound natural, authentic, and specific to this individual human persona. | |
| * Weave in details, examples, or reflections that stem directly from their background, experiences, or core beliefs (as found in their Persona Profile) to add depth and credibility to each answer. | |
| * **Crucially, your response style must be that of the persona, NOT that of a generic AI assistant.** Avoid AI conversational fillers, hedging, or overly structured "helpful" tones unless explicitly indicated by the persona's defined communication style attributes. | |
| 4. **Relevance & Focus (for EACH answer):** | |
| * Ensure each answer directly and fully addresses the specific question it corresponds to. Do not merge answers or let responses bleed excessively into answers for other questions. | |
| 5. **Language of Response (MANDATORY ADHERENCE):** | |
| * **You MUST respond in english, regardless of the language of the questions.** | |
| * This instruction overrides any linguistic tendencies suggested by the persona's background. | |
| 6. **Crucial Prohibition:** | |
| * **DO NOT** start any answer with phrases like "As [Name of Persona]...", "As this persona...", or any meta-references to being a persona or AI. Speak directly *as* the persona. | |
| 7. **Relevance & Focus (Reiteration):** | |
| * Directly address the questions: "{questions}". Your answers must be tightly focused on them. | |
| * While being creative and true to the persona, ensure the answers' core content are about the questions asked. | |
| **Output Format INSTRUCTIONS:** | |
| You MUST provide your answers as a single JSON array of strings. This array must contain exactly {num_questions} string elements, where the first string is the answer to the first question, the second string is the answer to the second question, and so on, in the same order as the questions were listed. | |
| """ | |
| # Prompt for generating a report | |
| GENERATE_REPORT_PROMPT = """ | |
| You are an expert in customer and market research. Your task is to write a research report based on the following interviews: | |
| {content} | |
| You have to follow the following scope of research: | |
| {scope} | |
| The report should be structured and include the following sections: | |
| - Introduction: describe the purpose of the research and the audience. | |
| - Methodology: describe how the interviews were conducted. | |
| - Demography: summarize the personas that were interviewed. Add also some examples of the users that were interviewed. | |
| - Findings: summarize the key insights and themes that emerged from the interviews focusing on the scope of research. If possible and relevant, include quotes from the interviews to support your findings. | |
| - Insights: summarize the key insights and themes that emerged from the interviews going beyond the scope of research. Be creative and think outside the box analysing trends and patterns. If possible and relevant, include quotes from the interviews to support your insights. | |
| - Conclusion: summarize the main findings and their implications. | |
| - Recommendations: provide actionable recommendations based on the findings and insights. | |
| - Improvements: suggest improvements for the research process and the interview questions. | |
| Do not include any other text than the report. Use the same language of the interviews. | |
| """ | |
| # Prompt for chatting with a report | |
| CHAT_WITH_REPORT_PROMPT = """ | |
| You are an expert in customer and market research. You have access to the following interview data: | |
| {content} | |
| You need to answer the following question based on the interview data: | |
| {question} | |
| Provide a detailed answer that synthesizes the information from the interviews. | |
| If relevant, include specific examples or quotes from the interviews to support your answer. | |
| Make sure your response is well-structured and professional. | |
| If the question is not relevant to the interview data, please say that you cannot answer it based on the provided information. | |
| Answer in the same language of the question. | |
| Put your focus on the question asked, do not be biased by the interview data. | |
| """ | |
| # Prompt for generating audience name | |
| GENERATE_AUDIENCE_NAME_PROMPT = """ | |
| You are an expert in creating concise, descriptive names for research audiences. | |
| Given the following audience and research scope: | |
| Audience: {audience} | |
| Scope: {scope} | |
| Create a very concise name (max one sentence) that captures the essence of this audience for the given scope. | |
| Respond with ONLY the name, nothing else. | |
| """ | |
| def persona_schema(n): | |
| persona_schema={ | |
| "type": "json_schema", | |
| "json_schema": { | |
| "name": "user_personas_response", | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "users_personas": { | |
| "type": "array", | |
| "description": f"An array of exactly {n} synthetic user personas.", | |
| "items": { | |
| "type": "object", | |
| "description": "A single synthetic user persona defined by the following key parameters.", | |
| "properties": { | |
| "Name": { | |
| "type": "string", | |
| "description": "The full name of the persona." | |
| }, | |
| "Age": { | |
| "type": "integer", | |
| "description": "The age of the persona in years." | |
| }, | |
| "gender": { | |
| "type": "string", | |
| "description": "The gender identity of the persona (e.g., Male, Female, Non-binary, Prefer to self-describe)." | |
| }, | |
| "Location": { | |
| "type": "string", | |
| "description": "The current city and country of residence for the persona (e.g., 'Berlin, Germany')." | |
| }, | |
| "nationality": { | |
| "type": "string", | |
| "description": "The nationality of the persona." | |
| }, | |
| "Profession": { | |
| "type": "string", | |
| "description": "The official job title of the persona (e.g., 'Architect', 'Marketing Manager')." | |
| }, | |
| "professional_details": { | |
| "type": "object", | |
| "description": "Details about the persona's current professional role and context.", | |
| "properties": { | |
| "company": { | |
| "type": "string", | |
| "description": "The name of the company where the persona works." | |
| }, | |
| "industry": { | |
| "type": "string", | |
| "description": "The industry in which the persona works (e.g., 'Technology', 'Healthcare', 'Construction & Real Estate')." | |
| }, | |
| "years_in_profession": { | |
| "type": "integer", | |
| "description": "The number of years the persona has been working in their current profession." | |
| }, | |
| "role_description_and_key_responsibilities": { | |
| "type": "string", | |
| "description": "A detailed narrative describing the persona's role, main tasks, what they value in their work, common challenges, and attitudes relevant to their job." | |
| } | |
| }, | |
| "required": [ | |
| "company", | |
| "industry", | |
| "years_in_profession", | |
| "role_description_and_key_responsibilities" | |
| ], | |
| "additionalProperties": False | |
| }, | |
| "education_background": { | |
| "type": "object", | |
| "description": "Details about the persona's educational qualifications and experiences.", | |
| "properties": { | |
| "highest_degree": { | |
| "type": "string", | |
| "description": "The highest educational degree obtained by the persona (e.g., 'Master's in Human-Computer Interaction', 'Bachelor of Arts in History')." | |
| }, | |
| "institution": { | |
| "type": "string", | |
| "description": "The name of the institution where the highest degree was obtained (e.g., 'Stanford University')." | |
| }, | |
| "notable_experiences": { | |
| "type": "array", | |
| "items": { | |
| "type": "string" | |
| }, | |
| "description": "A list of other relevant educational experiences, specializations, or certifications (e.g., 'Online course in Data Analytics', 'Internship at a design agency')." | |
| } | |
| }, | |
| "required": [ | |
| "highest_degree", | |
| "institution", | |
| "notable_experiences" | |
| ], | |
| "additionalProperties": False | |
| }, | |
| "key_skills_and_proficiencies": { | |
| "type": "array", | |
| "items": { | |
| "type": "string" | |
| }, | |
| "description": "A list of key skills, technical proficiencies (e.g., software), and notable areas of expertise or deficiency." | |
| }, | |
| "formative_experiences_narrative": { | |
| "type": "string", | |
| "description": "A brief narrative (1-2 paragraphs or key bullet points) describing significant life or career events that have shaped the persona's worldview, values, or behaviors." | |
| }, | |
| "long_term_professional_goals": { | |
| "type": "array", | |
| "items": { | |
| "type": "string" | |
| }, | |
| "description": "A list of 2-3 primary long-term career aspirations or professional objectives for the persona." | |
| }, | |
| "primary_motivators": { | |
| "type": "array", | |
| "items": { | |
| "type": "string" | |
| }, | |
| "description": "A list of 2-3 core factors that drive and motivate the persona in their personal and professional life (e.g., 'Achievement', 'Learning new things', 'Financial stability', 'Making a positive impact')." | |
| }, | |
| "overall_demeanor_and_temperament": { | |
| "type": "string", | |
| "description": "A concise summary of the persona's typical disposition, attitude, and emotional responses (e.g., 'Calm and analytical, but passionate about their work', 'Optimistic and outgoing, but can be impatient')." | |
| }, | |
| "big_five_personality_traits": { | |
| "type": "object", | |
| "description": "Assessment of the persona based on the Big Five personality model (Openness, Conscientiousness, Extraversion, Agreeableness, Neuroticism). Useful for psychological grounding as per PB&J framework.", | |
| "properties": { | |
| "openness_to_experience": { | |
| "type": "string", | |
| "description": "Describes the persona's level of creativity, curiosity, and willingness to try new things (e.g., 'High: Enjoys new experiences, abstract ideas, and artistic expression.')." | |
| }, | |
| "conscientiousness": { | |
| "type": "string", | |
| "description": "Describes the persona's level of organization, responsibility, and self-discipline (e.g., 'High: Very organized, reliable, and goal-oriented.')." | |
| }, | |
| "extraversion": { | |
| "type": "string", | |
| "description": "Describes the persona's level of sociability, assertiveness, and energy derived from external interactions (e.g., 'Low: Introverted, prefers quiet environments and reflection.')." | |
| }, | |
| "agreeableness": { | |
| "type": "string", | |
| "description": "Describes the persona's tendency to be cooperative, empathetic, and considerate of others (e.g., 'Medium: Generally cooperative but will assert own views when necessary.')." | |
| }, | |
| "neuroticism": { | |
| "type": "string", | |
| "description": "Describes the persona's tendency towards emotional instability and negative emotions like anxiety or irritability (e.g., 'Low: Emotionally stable, calm under pressure.')." | |
| } | |
| }, | |
| "required": [ | |
| "openness_to_experience", | |
| "conscientiousness", | |
| "extraversion", | |
| "agreeableness", | |
| "neuroticism" | |
| ], | |
| "additionalProperties": False | |
| }, | |
| "key_personality_traits_in_own_words": { | |
| "type": "array", | |
| "items": { | |
| "type": "string" | |
| }, | |
| "description": "A list of 2-3 specific and distinctive personality traits or quirks described in a more narrative or self-perceived manner (e.g., 'Known for being very direct', 'Has a habit of overthinking decisions', 'Often uses humor to defuse tension')." | |
| }, | |
| "dominant_communication_style": { | |
| "type": "string", | |
| "description": "The primary way the persona tends to communicate and interact (e.g., 'Analytical and data-driven', 'Empathetic and collaborative', 'Direct and assertive', 'Storyteller')." | |
| }, | |
| "linguistic_style": { | |
| "type": "object", | |
| "description": "Specific characteristics of the persona's language use.", | |
| "properties": { | |
| "formality": { | |
| "type": "string", | |
| "description": "The typical level of formality in their language (e.g., 'Formal and professional', 'Casual and conversational', 'Technical')." | |
| }, | |
| "vocabulary_complexity": { | |
| "type": "string", | |
| "description": "The complexity and type of vocabulary typically used (e.g., 'Uses precise industry jargon', 'Prefers simple, accessible language', 'Has a rich and varied vocabulary')." | |
| } | |
| }, | |
| "required": [ | |
| "formality", | |
| "vocabulary_complexity" | |
| ], | |
| "additionalProperties": False | |
| }, | |
| "response_verbosity": { | |
| "type": "string", | |
| "description": "How lengthy or detailed the persona's responses typically are (e.g., 'Concise and to-the-point', 'Tends to elaborate with examples', 'Varies based on the topic')." | |
| }, | |
| "core_personal_beliefs_and_values": { | |
| "type": "array", | |
| "items": { | |
| "type": "string" | |
| }, | |
| "description": "A list of 3-5 fundamental beliefs or values that guide the persona's decisions, attitudes, and worldview (e.g., 'Lifelong learning is crucial', 'Ethical considerations should always come first', 'Practical results are more important than theory')." | |
| }, | |
| "general_behavioral_patterns_and_habits": { | |
| "type": "array", | |
| "items": { | |
| "type": "string" | |
| }, | |
| "description": "A list of 2-3 distinctive and consistent behaviors, habits, or routines (e.g., 'Always starts the day by reading industry news', 'Prefers to take detailed notes during meetings', 'Often seeks feedback before finalizing work')." | |
| }, | |
| "general_interests_and_hobbies": { | |
| "type": "array", | |
| "items": { | |
| "type": "string" | |
| }, | |
| "description": "A list of 2-3 primary interests, hobbies, or leisure activities that help define the persona outside of their professional context." | |
| } | |
| }, | |
| "required": [ | |
| "Name", | |
| "Age", | |
| "gender", | |
| "Location", | |
| "nationality", | |
| "Profession", | |
| "professional_details", | |
| "education_background", | |
| "key_skills_and_proficiencies", | |
| "formative_experiences_narrative", | |
| "long_term_professional_goals", | |
| "primary_motivators", | |
| "overall_demeanor_and_temperament", | |
| "big_five_personality_traits", | |
| "key_personality_traits_in_own_words", | |
| "dominant_communication_style", | |
| "linguistic_style", | |
| "response_verbosity", | |
| "core_personal_beliefs_and_values", | |
| "general_behavioral_patterns_and_habits", | |
| "general_interests_and_hobbies" | |
| ], | |
| "additionalProperties": False | |
| }, | |
| "minItems": n, | |
| "maxItems": n | |
| } | |
| }, | |
| "required": ["users_personas"], | |
| "additionalProperties": False | |
| }, | |
| "strict": True | |
| } | |
| } | |
| return persona_schema | |
| def answers_schema(n): | |
| return { | |
| "type": "object", | |
| "properties": { | |
| "answers": { | |
| "type": "array", | |
| "items": {"type": "string"}, | |
| "minItems": n, | |
| "maxItems": n, | |
| "description": f"Array of exactly {n} answers to the questions" | |
| } | |
| }, | |
| "required": ["answers"], | |
| "additionalProperties": False | |
| } | |
| def ux_fsm_schema(actions): | |
| return{ | |
| "type": "object", | |
| "properties": { | |
| "ux_response": { | |
| "type": "object", | |
| "description": "The response from the UX testing", | |
| "properties": { | |
| "action_taken": { | |
| "type": "string", | |
| "description": "The action the persona decided to take", | |
| "enum": actions | |
| }, | |
| "thought": { | |
| "type": "string", | |
| "description": "The persona's reasoning for taking this action" | |
| }, | |
| "task_finished": { | |
| "type": "boolean", | |
| "description": "Whether the persona believes they have completed the task" | |
| }, | |
| "task_difficulty": { | |
| "type": "number", | |
| "description": "The difficulty of the task, from 1 (very easy) to 5 (very difficult). If not finished, set to None.", | |
| "enum": [1, 2, 3, 4, 5, None] | |
| } | |
| }, | |
| } | |
| }, | |
| "required": ["ux_response"], | |
| "additionalProperties": False | |
| } | |
| # Simple FSM UX Testing Prompt | |
| UX_FSM_SIMPLE_PROMPT = """ | |
| You are conducting a UX testing session as the detailed user persona provided below. You are looking at a specific interface screen and need to decide what action to take to accomplish your given task. | |
| **Persona Profile:** | |
| {persona} | |
| **Task to Accomplish:** | |
| {task} | |
| **Current Screen:** | |
| You are viewing the interface shown in the provided image. | |
| **Available Actions:** | |
| Choose ONE of these actions: {available_actions} | |
| **Session History:** | |
| {session_history} | |
| **Your Response:** | |
| Provide your response as a JSON object with exactly these fields: | |
| {{ | |
| "action_taken": "your_chosen_action", | |
| "thought": "your reasoning for this action", | |
| "task_finished": true/false, | |
| "task_difficulty": 1.0-5.0 (only if task_finished is true, otherwise null) | |
| }} | |
| **Guidelines:** | |
| * **action_taken**: Select exactly ONE action from the available actions list | |
| * **thought**: Explain your reasoning for choosing this action. Why does this action make sense for accomplishing your task? What do you expect to happen? Consider your previous actions from the session history. | |
| * **task_finished**: Answer true ONLY if you have completely finished the task (e.g., item successfully added to cart and you're at checkout), false if you need to continue | |
| * **task_difficulty**: If task_finished is true, rate the overall difficulty from 1.0 (very easy) to 5.0 (very difficult). If task is not finished, set to null. | |
| **Important Instructions:** | |
| * Respond as the persona - use their knowledge, experience, and perspective | |
| * Consider your session history when making decisions - don't repeat unnecessary actions | |
| * Choose the action that best helps accomplish the given task | |
| * Be specific and clear in your reasoning | |
| * Consider your persona's technical comfort level and preferences | |
| * Only choose actions from the provided available actions list | |
| * **Task Completion**: Only mark task_finished as true when you have FULLY completed the entire task (not just found a product, but actually added it to cart and reached checkout) | |
| * Respond with valid JSON only - no additional text | |
| """ |