Spaces:
Build error
Build error
Update backend_app/rag_hf.py
Browse files- backend_app/rag_hf.py +12 -6
backend_app/rag_hf.py
CHANGED
|
@@ -138,12 +138,18 @@ CONTEXT:
|
|
| 138 |
ANSWER:
|
| 139 |
""".strip()
|
| 140 |
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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."
|