Tanifh commited on
Commit
79ed0a3
·
verified ·
1 Parent(s): e3eefc5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -56,10 +56,16 @@ if st.button("Send") and user_input:
56
  st.session_state["messages"].append(("user", user_input))
57
  st.chat_message("user").write(user_input)
58
 
 
 
 
 
 
 
59
  # Generate response
60
  try:
61
  response = st.session_state["model"].create_chat_completion(
62
- messages=[{"role": "user", "content": user_input}],
63
  max_tokens=1024, temperature=0.7, top_p=0.9
64
  )
65
  response_text = response["choices"][0]["message"]["content"].strip()
@@ -75,3 +81,4 @@ if st.button("Send") and user_input:
75
 
76
 
77
 
 
 
56
  st.session_state["messages"].append(("user", user_input))
57
  st.chat_message("user").write(user_input)
58
 
59
+ # ✅ Format messages using Phi-3 chat template
60
+ formatted_messages = [
61
+ {"role": "system", "content": "You are an AI assistant. Provide clear and concise answers."}
62
+ ]
63
+ formatted_messages += [{"role": "user", "content": user_input}]
64
+
65
  # Generate response
66
  try:
67
  response = st.session_state["model"].create_chat_completion(
68
+ messages=formatted_messages,
69
  max_tokens=1024, temperature=0.7, top_p=0.9
70
  )
71
  response_text = response["choices"][0]["message"]["content"].strip()
 
81
 
82
 
83
 
84
+