Spaces:
Sleeping
Sleeping
Update chatbot_rag.py
Browse files- chatbot_rag.py +7 -9
chatbot_rag.py
CHANGED
|
@@ -52,7 +52,7 @@ def build_qa():
|
|
| 52 |
model=model,
|
| 53 |
tokenizer=tokenizer,
|
| 54 |
max_new_tokens=256,
|
| 55 |
-
temperature=0.
|
| 56 |
do_sample=False,
|
| 57 |
return_full_text=False # 🚀 only return new text, avoids messy context echoes
|
| 58 |
)
|
|
@@ -65,16 +65,14 @@ def build_qa():
|
|
| 65 |
# 5. Prompt
|
| 66 |
prompt = PromptTemplate(
|
| 67 |
input_variables=["context", "question"],
|
| 68 |
-
template="""
|
| 69 |
-
|
| 70 |
-
If
|
| 71 |
|
| 72 |
-
CONTEXT:
|
| 73 |
-
{context}
|
| 74 |
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
"""
|
| 78 |
)
|
| 79 |
|
| 80 |
|
|
|
|
| 52 |
model=model,
|
| 53 |
tokenizer=tokenizer,
|
| 54 |
max_new_tokens=256,
|
| 55 |
+
temperature=0.0,
|
| 56 |
do_sample=False,
|
| 57 |
return_full_text=False # 🚀 only return new text, avoids messy context echoes
|
| 58 |
)
|
|
|
|
| 65 |
# 5. Prompt
|
| 66 |
prompt = PromptTemplate(
|
| 67 |
input_variables=["context", "question"],
|
| 68 |
+
template = """
|
| 69 |
+
Use the following context to answer the question at the end.
|
| 70 |
+
If you don't know the answer, just say "I don't know" — do not make up an answer.
|
| 71 |
|
|
|
|
|
|
|
| 72 |
|
| 73 |
+
Question: {question}
|
| 74 |
+
Answer (one short sentence):
|
| 75 |
+
"""
|
| 76 |
)
|
| 77 |
|
| 78 |
|