Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
@@ -27,7 +27,7 @@ IMPORTANT:
|
|
27 |
- Do not make up tool names.
|
28 |
- Do not loop unnecessarily.
|
29 |
- Provide FINAL ANSWER as soon as you are confident.
|
30 |
-
|
31 |
"""
|
32 |
|
33 |
TOOLS = [
|
@@ -51,11 +51,11 @@ class SimpleLangGraphAgent:
|
|
51 |
messages.append(HumanMessage(content=question))
|
52 |
|
53 |
state = {"messages": messages}
|
54 |
-
final_state = self.agent.invoke(state
|
55 |
|
56 |
for msg in final_state["messages"][::-1]:
|
57 |
if "FINAL ANSWER:" in msg.content.upper():
|
58 |
-
print(f"\n\n
|
59 |
return msg.content.split("FINAL ANSWER:")[-1].strip()
|
60 |
|
61 |
return "No FINAL ANSWER found."
|
|
|
27 |
- Do not make up tool names.
|
28 |
- Do not loop unnecessarily.
|
29 |
- Provide FINAL ANSWER as soon as you are confident.
|
30 |
+
- If wiki tool doesnt give you enough information, try again with a shorter query, or a more genral query. Dont use a query that is too specific.
|
31 |
"""
|
32 |
|
33 |
TOOLS = [
|
|
|
51 |
messages.append(HumanMessage(content=question))
|
52 |
|
53 |
state = {"messages": messages}
|
54 |
+
final_state = self.agent.invoke(state)
|
55 |
|
56 |
for msg in final_state["messages"][::-1]:
|
57 |
if "FINAL ANSWER:" in msg.content.upper():
|
58 |
+
print(f"\n\n thoughts = {msg.content.split('Thought:')[-1].strip()} \n\n")
|
59 |
return msg.content.split("FINAL ANSWER:")[-1].strip()
|
60 |
|
61 |
return "No FINAL ANSWER found."
|