Spaces:
Sleeping
Sleeping
Update chatbot_rag.py
Browse files- chatbot_rag.py +2 -1
chatbot_rag.py
CHANGED
|
@@ -53,7 +53,7 @@ def build_qa():
|
|
| 53 |
model=model,
|
| 54 |
tokenizer=tokenizer,
|
| 55 |
max_new_tokens=128,
|
| 56 |
-
temperature=0.
|
| 57 |
do_sample=True, # allow some randomness
|
| 58 |
top_p=0.9, # nucleus sampling to avoid loops
|
| 59 |
repetition_penalty=1.2, # 🚀 penalize repeats
|
|
@@ -71,6 +71,7 @@ def build_qa():
|
|
| 71 |
input_variables=["context", "question"],
|
| 72 |
template="""
|
| 73 |
Use the following context to answer the question.
|
|
|
|
| 74 |
- Answer in plain natural language.
|
| 75 |
- Do not include code, imports, functions, or explanations of how to implement code.
|
| 76 |
- If you don't know, just say "I don't know."
|
|
|
|
| 53 |
model=model,
|
| 54 |
tokenizer=tokenizer,
|
| 55 |
max_new_tokens=128,
|
| 56 |
+
temperature=0.3, # keeps answers deterministic but less rigid than 0
|
| 57 |
do_sample=True, # allow some randomness
|
| 58 |
top_p=0.9, # nucleus sampling to avoid loops
|
| 59 |
repetition_penalty=1.2, # 🚀 penalize repeats
|
|
|
|
| 71 |
input_variables=["context", "question"],
|
| 72 |
template="""
|
| 73 |
Use the following context to answer the question.
|
| 74 |
+
- Answer from the docs
|
| 75 |
- Answer in plain natural language.
|
| 76 |
- Do not include code, imports, functions, or explanations of how to implement code.
|
| 77 |
- If you don't know, just say "I don't know."
|