Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -94,6 +94,7 @@ def make_sympy_tool(func, name, description):
|
|
94 |
)
|
95 |
|
96 |
from sympy import simplify, expand, factor
|
|
|
97 |
|
98 |
sympy_tools = [
|
99 |
make_sympy_tool(simplify, "simplify", "Simplifies a symbolic expression"),
|
@@ -126,8 +127,15 @@ def pvsnp(problem):
|
|
126 |
print (output)'''
|
127 |
output = agent.invoke({"messages": "Use tools to answer: "+problem})
|
128 |
answer = output['messages'][5]
|
129 |
-
|
130 |
with the tools leveraged.''')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
return final_answer
|
132 |
|
133 |
|
|
|
94 |
)
|
95 |
|
96 |
from sympy import simplify, expand, factor
|
97 |
+
import textwrap
|
98 |
|
99 |
sympy_tools = [
|
100 |
make_sympy_tool(simplify, "simplify", "Simplifies a symbolic expression"),
|
|
|
127 |
print (output)'''
|
128 |
output = agent.invoke({"messages": "Use tools to answer: "+problem})
|
129 |
answer = output['messages'][5]
|
130 |
+
critic_answer = llm_response(f'''Given the problem: {problem} and the agent response: {answer}, come up with a user friendly explanation that highlights the answer along
|
131 |
with the tools leveraged.''')
|
132 |
+
final_answer = f"""
|
133 |
+
Agent's Response:
|
134 |
+
{textwrap.indent(textwrap.fill(agent_response, width=80), prefix=' ')}
|
135 |
+
|
136 |
+
Critic's Response:
|
137 |
+
{textwrap.indent(textwrap.fill(critic_response, width=80), prefix=' ')}
|
138 |
+
"""
|
139 |
return final_answer
|
140 |
|
141 |
|