reddmann007 commited on
Commit
6103347
·
verified ·
1 Parent(s): 5d7d804

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -9
app.py CHANGED
@@ -63,18 +63,16 @@ if prompt := st.chat_input("Ask me a complex math question!"):
63
  with st.chat_message("assistant"):
64
  with st.spinner("Thinking..."):
65
  try:
66
- # Change this line:
67
- # response = agent_executor.invoke({"messages": [("user", prompt)]})
68
-
69
- # To this:
70
- response = agent_executor.invoke({
71
- "messages": [system_message, ("user", prompt)]
72
- })
73
-
74
- # Get the final response from the message list
75
  final_answer = response["messages"][-1].content
76
 
77
  st.markdown(final_answer)
78
  st.session_state.messages.append({"role": "assistant", "content": final_answer})
 
79
  except Exception as e:
80
  st.error(f"An error occurred: {e}")
 
63
  with st.chat_message("assistant"):
64
  with st.spinner("Thinking..."):
65
  try:
66
+ # ALL lines below 'try' must be indented 4 spaces further
67
+ # We pass the system_message rules directly here
68
+ response = agent_executor.invoke({
69
+ "messages": [system_message, ("user", prompt)]
70
+ })
71
+
 
 
 
72
  final_answer = response["messages"][-1].content
73
 
74
  st.markdown(final_answer)
75
  st.session_state.messages.append({"role": "assistant", "content": final_answer})
76
+
77
  except Exception as e:
78
  st.error(f"An error occurred: {e}")