tharunchndrn commited on
Commit
e8111ad
·
verified ·
1 Parent(s): 0817de4

Update backend_app/rag_hf.py

Browse files
Files changed (1) hide show
  1. backend_app/rag_hf.py +12 -6
backend_app/rag_hf.py CHANGED
@@ -138,12 +138,18 @@ CONTEXT:
138
  ANSWER:
139
  """.strip()
140
 
141
- out = self.client.text_generation(
142
- prompt,
143
- max_new_tokens=250,
144
- temperature=0.2,
145
- return_full_text=False,
146
- ).strip()
 
 
 
 
 
 
147
 
148
  if not out:
149
  out = "I couldn’t find enough reliable information in the provided sources. Please rephrase or share more details."
 
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."