Stefan888 commited on
Commit
5dd05ba
·
1 Parent(s): b7d70c9

fix answering

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -76,6 +76,9 @@ def assistant(state: AgentState):
76
  system_prompt = SystemMessage(
77
  content=f"""
78
  You are an expert assistant. Try to answer the question as accurately as possible.
 
 
 
79
  You can use the following tools to help you:
80
  {textual_description_of_tool}
81
  """
@@ -166,8 +169,8 @@ class BasicAgent:
166
 
167
  print(f"Initial state: {initial_state}")
168
  answer = compiled_graph.invoke(initial_state)
169
- print(f"Agent returning answer: {answer}")
170
- return answer
171
 
172
  def run_and_submit_all( profile: gr.OAuthProfile | None):
173
  """
 
76
  system_prompt = SystemMessage(
77
  content=f"""
78
  You are an expert assistant. Try to answer the question as accurately as possible.
79
+ If you don't know the answer, you can use the tools available to you.
80
+ But try to answer the question first and only use the tools if you are not sure.
81
+ If you get a response from a tool, try to come to the final answer.
82
  You can use the following tools to help you:
83
  {textual_description_of_tool}
84
  """
 
169
 
170
  print(f"Initial state: {initial_state}")
171
  answer = compiled_graph.invoke(initial_state)
172
+ print(f"Agent returning answer: {answer.get('answer')}")
173
+ return answer.get("answer")
174
 
175
  def run_and_submit_all( profile: gr.OAuthProfile | None):
176
  """