Spaces:
Sleeping
Sleeping
Update src/simple_rag.py
Browse files- src/simple_rag.py +1 -12
src/simple_rag.py
CHANGED
|
@@ -107,20 +107,9 @@ def ask_question(query_text: str, k: int = 3):
|
|
| 107 |
|
| 108 |
# Construct structured messages instead of using PROMPT_TEMPLATE
|
| 109 |
messages = [
|
| 110 |
-
{
|
| 111 |
-
"role": "system",
|
| 112 |
-
"content": (
|
| 113 |
-
"You are a helpful assistant. "
|
| 114 |
-
"Answer the question based ONLY on the context provided. "
|
| 115 |
-
"If the user asks in Khmer, respond in Khmer. "
|
| 116 |
-
"If the user asks in English, respond in English. "
|
| 117 |
-
"Use clear, concise sentences, max 50 words. "
|
| 118 |
-
"Do not mention context or metadata."
|
| 119 |
-
)
|
| 120 |
-
},
|
| 121 |
{
|
| 122 |
"role": "user",
|
| 123 |
-
"content": f"
|
| 124 |
}
|
| 125 |
]
|
| 126 |
|
|
|
|
| 107 |
|
| 108 |
# Construct structured messages instead of using PROMPT_TEMPLATE
|
| 109 |
messages = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
{
|
| 111 |
"role": "user",
|
| 112 |
+
"content": f"""Base your answer only on the following context:\n\n{context_text}\n\nQuestion: {query_text}\nAnswer:"""
|
| 113 |
}
|
| 114 |
]
|
| 115 |
|