pluto90 commited on
Commit
12008d9
·
verified ·
1 Parent(s): 13d079c

Upload 4 files

Browse files
app/core/prompts/evaluator_prompt.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # evaluator_prompt.py
2
+
3
+ from langchain_core.prompts import PromptTemplate
4
+
5
+ evaluator_prompt = PromptTemplate(
6
+ input_variables=["query", "answer", "context"],
7
+ template="""
8
+ Evaluate the AI response.
9
+
10
+ Rules:
11
+ - Be strict
12
+ - Output ONLY valid JSON
13
+ - No explanation
14
+
15
+ Query:
16
+ {query}
17
+
18
+ Answer:
19
+ {answer}
20
+
21
+ Context:
22
+ {context}
23
+
24
+ Return:
25
+ {
26
+ "relevance_score": number (0 to 1),
27
+ "context_usage": number (0 to 1),
28
+ "hallucination": true/false
29
+ }
30
+ """
31
+ )
app/core/prompts/general_prompt.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain_core.prompts import PromptTemplate
2
+
3
+
4
+ general_prompt= PromptTemplate(
5
+ input_variables= ["query"],
6
+ template= (
7
+ "Answer clearly and concisely.\n"
8
+ "Do NOT rely on any external document.\n"
9
+ "Avoid long explanations.\n"
10
+ "Use bullet points if helpful.\n"
11
+ "Max 150 words.\n\n"
12
+ "Question:\n{query}\n\n"
13
+ "Answer:"
14
+ )
15
+ )
app/core/prompts/rag_prompt.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # rag_prompt.py
2
+ from langchain_core.prompts import PromptTemplate
3
+
4
+
5
+ rag_prompt = PromptTemplate(
6
+ input_variables=["context", "query"],
7
+ template=(
8
+ "You are a document intelligence system.\n"
9
+ "Answer ONLY using the provided context.\n"
10
+ "If answer is not present, say: 'Not in document'.\n\n"
11
+
12
+ "Keep response concise:\n"
13
+ "- Short explanation\n"
14
+ "- Bullet points if useful\n"
15
+ "- Max 120 words\n\n"
16
+
17
+ "Avoid repeating the question.\n\n"
18
+
19
+ "Context:\n{context}\n\n"
20
+ "Question:\n{query}\n\n"
21
+ "Answer:"
22
+ )
23
+ )
app/core/prompts/router_prompt.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain_core.prompts import PromptTemplate
2
+
3
+ router_prompt= PromptTemplate(
4
+ input_variables=["query"],
5
+ template="""
6
+ Classify the query into ONE:
7
+
8
+ - rag → requires user's uploaded document
9
+ - general → general knowledge
10
+
11
+ Query:
12
+ {query}
13
+
14
+ Return ONLY one word:
15
+ rag or general
16
+ """
17
+ )