Commit ·
314810a
1
Parent(s): cee18af
chore(agent): enhance supervisor prompts and increase websearch recursion limit
Browse filesAdd "any" and "must" to make supervisor routing directives more emphatic and increase websearch recursion_limit from 3 to 6 to allow more thorough search results
- agent/agent.py +4 -5
- agent/agents/websearch.py +1 -1
agent/agent.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
-
import os
|
| 2 |
from datetime import datetime, timezone
|
| 3 |
from dotenv import load_dotenv
|
| 4 |
-
from colorama import Fore, Style
|
| 5 |
from langchain.agents import create_agent
|
| 6 |
from langchain_core.messages import HumanMessage
|
| 7 |
from agent.tools.math_solver import math_solver
|
|
@@ -19,9 +18,9 @@ def supervisor_agent():
|
|
| 19 |
f"You are a supervisor agent. "
|
| 20 |
f"Current time is: {datetime.now(timezone.utc).isoformat()}. "
|
| 21 |
f"Your memory are out of date. "
|
| 22 |
-
f"For math or calculation questions, use the math_solver tool. "
|
| 23 |
-
f"
|
| 24 |
-
f"
|
| 25 |
),
|
| 26 |
)
|
| 27 |
|
|
|
|
|
|
|
| 1 |
from datetime import datetime, timezone
|
| 2 |
from dotenv import load_dotenv
|
| 3 |
+
from colorama import Fore, Style # type: ignore[import]
|
| 4 |
from langchain.agents import create_agent
|
| 5 |
from langchain_core.messages import HumanMessage
|
| 6 |
from agent.tools.math_solver import math_solver
|
|
|
|
| 18 |
f"You are a supervisor agent. "
|
| 19 |
f"Current time is: {datetime.now(timezone.utc).isoformat()}. "
|
| 20 |
f"Your memory are out of date. "
|
| 21 |
+
f"For any math or calculation questions, use the math_solver tool. "
|
| 22 |
+
f"All questions that need real-time, must use the websearch_agent tool "
|
| 23 |
+
f"to get a concise and accurate final answer."
|
| 24 |
),
|
| 25 |
)
|
| 26 |
|
agent/agents/websearch.py
CHANGED
|
@@ -32,7 +32,7 @@ def websearch_agent(query: str) -> str:
|
|
| 32 |
try:
|
| 33 |
result = base_agent.invoke(
|
| 34 |
{"messages": [{"role": "user", "content": query}]},
|
| 35 |
-
config={"recursion_limit":
|
| 36 |
)
|
| 37 |
content = result["messages"][-1].content
|
| 38 |
if isinstance(content, list):
|
|
|
|
| 32 |
try:
|
| 33 |
result = base_agent.invoke(
|
| 34 |
{"messages": [{"role": "user", "content": query}]},
|
| 35 |
+
config={"recursion_limit": 6},
|
| 36 |
)
|
| 37 |
content = result["messages"][-1].content
|
| 38 |
if isinstance(content, list):
|