File size: 2,269 Bytes
c5cb7f4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# prompts.py
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.
"""

# Now we define the PromptTemplate objects:
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=[]
)