tharunchndrn commited on
Commit
2ec017c
·
verified ·
1 Parent(s): e8111ad

Update backend_app/rag_hf.py

Browse files
Files changed (1) hide show
  1. backend_app/rag_hf.py +12 -21
backend_app/rag_hf.py CHANGED
@@ -103,12 +103,6 @@ class RAGEngineHF:
103
  You are the SysLink Food System assistant.
104
 
105
  You MUST answer using ONLY the information provided in the retrieved context.
106
- Do NOT use prior knowledge, assumptions, or external sources.
107
- Do NOT invent facts.
108
-
109
- If the retrieved context does not contain enough information to answer the question:
110
- - Clearly say that the information is missing
111
- - Specify exactly what data or document is needed
112
 
113
  Write in simple, clear language.
114
  Keep responses MEDIUM length (8–14 lines).
@@ -127,8 +121,6 @@ Rules:
127
  - Do not summarize irrelevant information
128
  - Do not mention the word “context” or “retrieved documents” in the final answer
129
 
130
- Your goal is to provide accurate, trustworthy answers grounded strictly in the supplied information.
131
-
132
  {lang_line}
133
  QUESTION: {query}
134
 
@@ -136,20 +128,19 @@ CONTEXT:
136
  {context_block}
137
 
138
  ANSWER:
139
- """.strip()
140
-
141
- messages = [
142
- {"role": "system", "content": "You are the SysLink Food System assistant."},
143
- {"role": "user", "content": prompt},
144
- ]
145
-
146
- resp = self.client.chat_completion(
147
- messages=messages,
148
- max_tokens=250,
149
- temperature=0.2,
150
- )
151
 
152
- out = resp.choices[0].message.content.strip()
153
 
154
  if not out:
155
  out = "I couldn’t find enough reliable information in the provided sources. Please rephrase or share more details."
 
103
  You are the SysLink Food System assistant.
104
 
105
  You MUST answer using ONLY the information provided in the retrieved context.
 
 
 
 
 
 
106
 
107
  Write in simple, clear language.
108
  Keep responses MEDIUM length (8–14 lines).
 
121
  - Do not summarize irrelevant information
122
  - Do not mention the word “context” or “retrieved documents” in the final answer
123
 
 
 
124
  {lang_line}
125
  QUESTION: {query}
126
 
 
128
  {context_block}
129
 
130
  ANSWER:
131
+ """.strip()
132
+ messages = [
133
+ {"role": "system", "content": "You are the SysLink Food System assistant."},
134
+ {"role": "user", "content": prompt},
135
+ ]
136
+
137
+ resp = self.client.chat_completion(
138
+ messages=messages,
139
+ max_tokens=250,
140
+ temperature=0.2,
141
+ )
 
142
 
143
+ out = resp.choices[0].message.content.strip()
144
 
145
  if not out:
146
  out = "I couldn’t find enough reliable information in the provided sources. Please rephrase or share more details."