Rustamshry commited on
Commit
3029e1e
·
verified ·
1 Parent(s): f3ef1c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -14,9 +14,23 @@ base_model = AutoModelForCausalLM.from_pretrained(
14
 
15
  model = PeftModel.from_pretrained(base_model, "Rustamshry/Plantinga-RL").to("cpu")
16
 
 
 
 
 
 
 
 
 
 
17
 
18
  # --- Chatbot logic ---
19
  def generate_response(user_input, chat_history):
 
 
 
 
 
20
  if not user_input.strip():
21
  return chat_history, chat_history
22
 
 
14
 
15
  model = PeftModel.from_pretrained(base_model, "Rustamshry/Plantinga-RL").to("cpu")
16
 
17
+ system = """
18
+ Respond in the following format:
19
+ <reasoning>
20
+ Explain your reasoning here step-by-step.
21
+ </reasoning>
22
+ <answer>
23
+ Give the final answer here.
24
+ </answer>
25
+ """
26
 
27
  # --- Chatbot logic ---
28
  def generate_response(user_input, chat_history):
29
+
30
+ if not chat_history:
31
+ # Add the system message only once, at the beginning
32
+ chat_history = [{"role": "system", "content": system}]
33
+
34
  if not user_input.strip():
35
  return chat_history, chat_history
36