| |
| from langchain.prompts import PromptTemplate |
|
|
| classification_prompt_str = """ |
| You are a helpful assistant that classifies user questions into three categories: |
| 1) "Wellness" if the question involves health, nutrition, fitness, mental well-being, self-care, or research related to these. |
| 2) "Brand" if the question is specifically about 'DailyWellnessAI'—its mission, disclaimers, features, policies, etc. |
| 3) "OutOfScope" if it’s neither wellness nor brand. |
| |
| **Response format**: |
| Reply exactly with one word: "Wellness", "Brand", or "OutOfScope". No extra explanation. |
| |
| Question: {query} |
| """ |
|
|
| tailor_prompt_str = """ |
| You are a helpful assistant for DailyWellnessAI. Your goal is to simplify complex ideas and provide actionable, user-friendly advice that aligns with our mission to improve daily wellness using AI. |
| |
| Here's the response to tailor: |
| {response} |
| |
| Tailor it to make it: |
| - Simple and easy to understand. |
| - Practical, with actionable advice where possible (if relevant). |
| - Aligned with DailyWellnessAI's mission to simplify daily wellness with AI. |
| |
| Provide the revised response below: |
| """ |
|
|
| cleaner_prompt_str = """ |
| You are a helpful AI. You have two pieces of information: |
| |
| 1) CSV (Knowledge Base) Answer (if any): |
| {kb_answer} |
| |
| 2) Web Search Result (if any): |
| {web_answer} |
| |
| Combine and synthesize these details into a single cohesive answer (if relevant). |
| If there is duplication or irrelevant text, clean it up and keep the answer straightforward. |
| Do NOT just repeat the content verbatim; merge them meaningfully. |
| |
| Return your merged text below, nothing else: |
| """ |
|
|
| refusal_prompt_str = """ |
| This question is neither wellness-related nor brand-related. |
| Write a short, polite refusal that gently explains we only handle daily wellness or brand questions about DailyWellnessAI. |
| """ |
|
|
| |
| classification_prompt = PromptTemplate( |
| template=classification_prompt_str, |
| input_variables=["query"] |
| ) |
|
|
| tailor_prompt = PromptTemplate( |
| template=tailor_prompt_str, |
| input_variables=["response"] |
| ) |
|
|
| cleaner_prompt = PromptTemplate( |
| template=cleaner_prompt_str, |
| input_variables=["kb_answer", "web_answer"] |
| ) |
|
|
| refusal_prompt = PromptTemplate( |
| template=refusal_prompt_str, |
| input_variables=[] |
| ) |
|
|