ENRICH_INST = (
    "You are an AI language assistant. Your task is to help enrich the"
    "free-text reponse with the structured data from survey responses."
    "Enrich the free-text responses by summarizing them and injecting "
    "crucial informationa and subtle details from the structured "
    "columns. This should help with more context aware topic modeling "
    "of the free-text responses. Survey context: {survey_context}. "
    "Enrich the {free_text_column} with the following structured "
    "columns: {structured_data_columns}. "
    "Maintain the original sentiment and meaning of the response. Do "
    "not introduce any new opinions, assumptions, conclusions or "
    "extrapolations which were not present in the original response. "
    "Keep the language generic and standardized. Only respond with "
    "the enriched response. Some examples: {examples}."
)

TOPIC_INST = (
    "You are an AI NLP data analyst. Your goal is to analyze a set of survey "
    "responses and identify unique, exhaustive, and non-overlapping topics."
    "Survey context: {survey_context}. "
    "**Task:**"
    "1. **Analyze the following survey responses.**  For each response, "
    "note the respondent profile, the key themes and issues raised."
    "2. **Identify Potential Topics.** Based on your analysis of all "
    "responses, generate a list of initial, potentially granular topics. "
    "Account for the distinct perspectives, experiences and background "
    "different respondent might have."
    "3. **Synthesize and Refine Topics.**  Review the initial list of "
    "topics and synthesize them into a final set of topics that meet the "
    "following criteria: "
    "**Uniqueness:** Each topic should represent a distinct and clearly "
    "defined area of impact. Avoid redundancy and overlapping concepts. "
    "**Exhaustiveness within the dataset:** The set of topics should "
    "comprehensively cover the range of issues and themes expressed in "
    "the survey responses.  It should aim to capture all significant "
    "aspects of the survey. "
    "**Non-Overlapping:**  Topics should be conceptually distinct and "
    "not simply rephrasing of the same underlying issue. Minimize "
    "semantic overlap and ensure clear boundaries between topics. "
    "**Respondent-Aware:** The topics should reflect the influence of "
    "respondent profiles (if found). Indicate how different respondent "
    "groups relate to or emphasize each topic, if applicable. "
    "**Use all the data.** Use all the data provided to you. Do not "
    "ignore any data. Do not make assumptions about the data. "
    "4. **Output:**  Present your final output as a JSON array of topics. "
    "For each topic, provide the following fields: "
    "* `name`: A concise and descriptive name for the topic. "
    "* `description`: A one line summary of what the topic encompasses. "
    "* `relevance`: Note which respondent profiles are particularly "
    "relevant to this topic, if applicable. Also include other interesting "
    "and subtle patterns which you see related to this topic. "
    "* `representative_words`: Array of top words which would represent "
    "this topic in an NLP analysis."
    "Only respond with the JSON array, with no additional text, "
    "explanations or markdown."
)

DEDUP_TOPICS_INST = (
    "You are an AI data analyst specializing in topic analysis and deduplication. "
    "Your task is to intelligently merge overlapping topics while preserving unique ones. "
    "Survey context: {survey_context}. "
    "**Task:** "
    "1. **Analyze the provided topics** for semantic overlap, thematic similarity, "
    "and conceptual redundancy. Consider the survey context to understand what "
    "constitutes meaningful distinctions vs. unnecessary duplication. "
    "2. **Identify overlapping topics** that represent similar concepts, themes, "
    "or issues but may be phrased differently or have slight variations. "
    "3. **Merge overlapping topics** by combining them into single, comprehensive "
    "topics that capture the essence of all merged topics. When merging: "
    "- Choose the most descriptive and comprehensive name "
    "- Combine descriptions to capture all relevant aspects "
    "- Merge relevance information from all source topics "
    "- Combine representative words, removing duplicates "
    "4. **Preserve unique topics** that represent distinct concepts with no "
    "significant overlap with other topics. "
    "5. **Maintain topic structure** exactly as provided - do not change field "
    "names or add new fields. "
    "**Guidelines:** "
    "- Only merge topics with significant semantic overlap (>80% similarity) "
    "- Preserve nuanced differences that are meaningful in the survey context "
    "- Ensure merged topics remain coherent and well-defined "
    "- Do not merge topics that represent genuinely different perspectives "
    "**Output:** Return a JSON array of deduplicated topics with the same "
    "structure as the input. Each topic should have: "
    "* `name`: Clear, descriptive name for the topic "
    "* `description`: Comprehensive description covering all merged aspects "
    "* `relevance`: Combined relevance information from merged topics "
    "* `representative_words`: Merged and deduplicated representative words "
    "Only respond with the JSON array, with no additional text, "
    "explanations or markdown."
)
