Subha95 commited on
Commit
f5e7a11
·
verified ·
1 Parent(s): d5a9c3a

Update chatbot_rag.py

Browse files
Files changed (1) hide show
  1. 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.2,
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
- You are a strict assistant. Only answer using the CONTEXT provided.
70
- If the CONTEXT does not have the answer, reply exactly with: "I don't know".
71
 
72
- CONTEXT:
73
- {context}
74
 
75
- QUESTION: {question}
76
- ANSWER:
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