ego commited on
Commit
4681215
·
1 Parent(s): b72dacf
__pycache__/prompts.cpython-312.pyc CHANGED
Binary files a/__pycache__/prompts.cpython-312.pyc and b/__pycache__/prompts.cpython-312.pyc differ
 
core/__pycache__/graph.cpython-312.pyc CHANGED
Binary files a/core/__pycache__/graph.cpython-312.pyc and b/core/__pycache__/graph.cpython-312.pyc differ
 
prompts.py CHANGED
@@ -27,13 +27,18 @@ RAG_PROMPT = ChatPromptTemplate.from_messages([
27
  ("human", RAG_HUMAN)
28
  ])
29
 
30
- REFLECTION_SYSTEM = """You are a senior editor grading an AI-generated answer.
31
- Evaluate if the answer is:
32
- 1. GROUNDED: Is the answer supported by the facts in the provided Context?
33
- 2. RELEVANT: Does it actually answer the User Question?
34
 
35
- Output exactly "yes" if the answer is both grounded and relevant.
36
- Output "no" if the answer contains information NOT in the context, is irrelevant, or if the assistant says it cannot answer."""
 
 
 
 
 
 
 
 
37
 
38
  REFLECTION_HUMAN = """Context:
39
  {context}
@@ -41,7 +46,7 @@ REFLECTION_HUMAN = """Context:
41
  User Question: {question}
42
  Generated Answer: {generation}
43
 
44
- Current Answer Quality status:"""
45
 
46
  REFLECTION_PROMPT = ChatPromptTemplate.from_messages([
47
  ("system", REFLECTION_SYSTEM),
 
27
  ("human", RAG_HUMAN)
28
  ])
29
 
30
+ REFLECTION_SYSTEM = """You are a balanced evaluator. Your goal is to ensure the generated answer is faithful to the context and addresses the user's question.
 
 
 
31
 
32
+ Criteria:
33
+ 1. **Groundedness**: Are the core claims supported by the context? (Allow professional phrasing).
34
+ 2. **Relevance**: Does the answer address the question?
35
+
36
+ Evaluation Guidelines:
37
+ - If the answer is mostly correct but uses different wording, output **yes**.
38
+ - If the answer is an honest "I cannot answer" because info is missing, output **yes**.
39
+ - Only output **no** if there is a CLEAR hallucination or if the answer is completely off-topic.
40
+
41
+ Output exactly "yes" or "no"."""
42
 
43
  REFLECTION_HUMAN = """Context:
44
  {context}
 
46
  User Question: {question}
47
  Generated Answer: {generation}
48
 
49
+ Evaluate:"""
50
 
51
  REFLECTION_PROMPT = ChatPromptTemplate.from_messages([
52
  ("system", REFLECTION_SYSTEM),