devve1 commited on
Commit
f5720c9
1 Parent(s): 4e6ca50

Create prompts.py

Browse files
Files changed (1) hide show
  1. prompts.py +103 -0
prompts.py ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import outlines
2
+
3
+ def build_prompt_conv():
4
+ return [
5
+ {
6
+ 'role': 'system',
7
+ 'content': """Assume the role of an innovator who thrives on creativity and resourcefulness. Your responses should encourage new approaches and challenge conventional thinking.
8
+
9
+ Behavior: Focus on brainstorming and ideation, offering unconventional solutions to problems.
10
+
11
+ Mannerisms: Use energetic, enthusiastic language that reflects your innovative spirit. Frequently propose ideas that are bold and forward-looking."""
12
+ },
13
+ {
14
+ 'role': 'user',
15
+ 'content': f"""Generate a short, single-sentence summary, in 10 tokens maximum, of the user's intent or topic based on their question, capturing the main focus of what they want to discuss. Do NOT cite the user.
16
+
17
+ Question : {st.session_state.user_input}
18
+ """
19
+ }
20
+ ]
21
+
22
+ @outlines.prompt
23
+ def question_type_prompt(query: str):
24
+ """Determine whether the following query is a 'Domain-Specific Question' or a 'General Question.'
25
+
26
+ A 'Domain-Specific Question' requires knowledge or familiarity with a particular field, niche, or specialized area of interest, including specific video games, movies, books, academic disciplines, or professional fields.
27
+ A 'General Question' is broad, open-ended, and can be answered by almost anyone without needing specific context or prior knowledge about any particular domain.
28
+ A Domain-Specific Question can also just contain a word related to a particular field, niche, or specialized area of interet. For example: the word 'aggro' is related to specific video games.
29
+
30
+ Examples :
31
+ 1. Query: "What are the symptoms of Type 2 diabetes?"
32
+ Choose one: Domain-Specific Question
33
+
34
+ 2. Query: "What is your favorite color?"
35
+ Choose one: General Question
36
+
37
+ 3. Query: "Who is the main character in Dark Souls?"
38
+ Choose one: Domain-Specific Question
39
+
40
+ 4. Query: "How do you bake a cake?"
41
+ Choose one: General Question
42
+
43
+ 5. Query: "Explain the difference between RAM and ROM."
44
+ Choose one: Domain-Specific Question
45
+
46
+ 6. Query: "Tell me more about your weekend."
47
+ Choose one: General Question
48
+ 7. Query: "Explain me more"
49
+ Choose one: General Question
50
+ 8. Query: "What is god mode ?"
51
+ Choose one: Domain-Specific Question
52
+ 9. Query: "Give me the meaning of aggro"
53
+ Choose one: Domain-Specific Question
54
+ 10. Query: "Give me a description of an aimbot"
55
+ Choose one: Domain-Specific Question
56
+ Now, determine the following query : {{ query }}
57
+
58
+ Choose one: 'Domain-Specific Question' or 'General Question'
59
+ """
60
+
61
+ @outlines.prompt
62
+ def open_query_prompt(past_messages: str, query: str):
63
+ """{{ past_messages }}
64
+
65
+ user: {{ query }}
66
+ assistant:
67
+ """
68
+
69
+ @outlines.prompt
70
+ def route_llm(context: str, query: str):
71
+ """Based on the following context, determine if the context contains specific and direct information needed to answer the question. Only respond with 'Yes' if the context explicitly provides the exact information required to answer the question fully and accurately. Respond with 'No' if the context does not explicitly provide the required information, or if it is missing, vague, indirect, or implied.
72
+
73
+ Question: {{ query }}
74
+ Context: {{ context }}
75
+ Answer (Yes/No):
76
+ """
77
+
78
+ @outlines.prompt
79
+ def answer_with_context(context: str, query: str):
80
+ """You are an assistant helping user by following directives and answering question.
81
+ Generate your response by following the steps below:
82
+ 1. Recursively break-down the question into smaller questions/directives.
83
+ 2. For each atomic question/directive:
84
+ 2a. Select the most relevant informations from the context.
85
+ 3. Generate a draft answer using the selected informations. Use three sentences maximum and keep the answer concise.
86
+ 4. Remove duplicate content from the draft answer.
87
+ 5. Generate your final answer after adjusting it to increase accuracy and relevance.
88
+
89
+ Question: {{query}}
90
+
91
+ Context: {{context}}
92
+ Answer:
93
+ """
94
+
95
+ @outlines.prompt
96
+ def idk(query: str):
97
+ "Just express that you don't find the knowledge required in the vector database to answer the question. Be creative and original."
98
+
99
+ @outlines.prompt
100
+ def self_knowledge(query: str):
101
+ """Answer the following question by using your own knowledge about the topic.
102
+ Question: {{ query }}
103
+ """