Maia Pelletier commited on
Commit ·
e5ce840
1
Parent(s): 5866eb5
update not enough context message
Browse files
app.py
CHANGED
|
@@ -231,6 +231,7 @@ class RAGChatbot:
|
|
| 231 |
Answer the user's question using only the information provided in the context.
|
| 232 |
If the context does not include the information needed to answer the question, clearly say:
|
| 233 |
"The provided context does not contain enough information to answer this question."
|
|
|
|
| 234 |
When answering:
|
| 235 |
|
| 236 |
Respond in English only.
|
|
@@ -272,7 +273,10 @@ Answer:"""
|
|
| 272 |
response_text = response_text.replace(f"[Context {i}]", replacement)
|
| 273 |
# Only append references when the model actually answered
|
| 274 |
no_answer_phrase = "The provided context does not contain enough information to answer this question."
|
| 275 |
-
|
|
|
|
|
|
|
|
|
|
| 276 |
# Deduplicate: one entry per unique source URL (or label)
|
| 277 |
seen = {}
|
| 278 |
for i, source_label in context_index_to_source.items():
|
|
|
|
| 231 |
Answer the user's question using only the information provided in the context.
|
| 232 |
If the context does not include the information needed to answer the question, clearly say:
|
| 233 |
"The provided context does not contain enough information to answer this question."
|
| 234 |
+
Do not alter or paraphrase this exact phrase.
|
| 235 |
When answering:
|
| 236 |
|
| 237 |
Respond in English only.
|
|
|
|
| 273 |
response_text = response_text.replace(f"[Context {i}]", replacement)
|
| 274 |
# Only append references when the model actually answered
|
| 275 |
no_answer_phrase = "The provided context does not contain enough information to answer this question."
|
| 276 |
+
no_answer_replacement = "The organic documents provided do not contain enough information to answer your question. For more information, try taking a look at the [Canadian Food Inspection Agency](https://inspection.canada.ca/en/food-labels/organic-products/) website."
|
| 277 |
+
if no_answer_phrase in response_text:
|
| 278 |
+
response_text = response_text.replace(no_answer_phrase, no_answer_replacement)
|
| 279 |
+
if no_answer_replacement not in response_text:
|
| 280 |
# Deduplicate: one entry per unique source URL (or label)
|
| 281 |
seen = {}
|
| 282 |
for i, source_label in context_index_to_source.items():
|