Update src/agents/agents.py
Browse filesAdded unrelated query response
- src/agents/agents.py +12 -11
src/agents/agents.py
CHANGED
|
@@ -233,7 +233,7 @@ class planner_module(dspy.Module):
|
|
| 233 |
"advanced":dspy.ChainOfThought(advanced_query_planner),
|
| 234 |
"intermediate":dspy.ChainOfThought(intermediate_query_planner),
|
| 235 |
"basic":dspy.ChainOfThought(basic_query_planner),
|
| 236 |
-
|
| 237 |
}
|
| 238 |
self.planner_desc = {
|
| 239 |
"advanced":"For detailed advanced queries where user needs multiple agents to work together to solve analytical problems",
|
|
@@ -257,8 +257,9 @@ class planner_module(dspy.Module):
|
|
| 257 |
output = {"complexity":complexity.exact_word_complexity.strip()
|
| 258 |
,"plan":dict(plan)}
|
| 259 |
else:
|
| 260 |
-
|
| 261 |
-
|
|
|
|
| 262 |
|
| 263 |
return output
|
| 264 |
|
|
@@ -1004,9 +1005,9 @@ class auto_analyst(dspy.Module):
|
|
| 1004 |
self.agent_inputs[name] = {x.strip() for x in str(agents[i].__pydantic_core_schema__['cls']).split('->')[0].split('(')[1].split(',')}
|
| 1005 |
self.agent_desc.append({name: get_agent_description(name)})
|
| 1006 |
|
| 1007 |
-
self.agents['basic_qa_agent'] = dspy.Predict("goal->answer")
|
| 1008 |
-
self.agent_inputs['basic_qa_agent'] = {"goal"}
|
| 1009 |
-
self.agent_desc.append({'basic_qa_agent':"Answers queries unrelated to data & also that include links, poison or attempts to attack the system"})
|
| 1010 |
|
| 1011 |
|
| 1012 |
# Initialize coordination agents
|
|
@@ -1058,11 +1059,11 @@ class auto_analyst(dspy.Module):
|
|
| 1058 |
plan_text = plan.get("plan", "").replace("Plan", "").replace(":", "").strip()
|
| 1059 |
|
| 1060 |
|
| 1061 |
-
if "basic_qa_agent" in plan_text:
|
| 1062 |
-
|
| 1063 |
-
|
| 1064 |
-
|
| 1065 |
-
|
| 1066 |
|
| 1067 |
|
| 1068 |
|
|
|
|
| 233 |
"advanced":dspy.ChainOfThought(advanced_query_planner),
|
| 234 |
"intermediate":dspy.ChainOfThought(intermediate_query_planner),
|
| 235 |
"basic":dspy.ChainOfThought(basic_query_planner),
|
| 236 |
+
"unrelated":dspy.Predict("query->answer")
|
| 237 |
}
|
| 238 |
self.planner_desc = {
|
| 239 |
"advanced":"For detailed advanced queries where user needs multiple agents to work together to solve analytical problems",
|
|
|
|
| 257 |
output = {"complexity":complexity.exact_word_complexity.strip()
|
| 258 |
,"plan":dict(plan)}
|
| 259 |
else:
|
| 260 |
+
plan = self.planner['unrelated'](query=goal)
|
| 261 |
+
output = {"complexity":complexity.exact_word_complexity.strip(),
|
| 262 |
+
"plan":dict(plan)}
|
| 263 |
|
| 264 |
return output
|
| 265 |
|
|
|
|
| 1005 |
self.agent_inputs[name] = {x.strip() for x in str(agents[i].__pydantic_core_schema__['cls']).split('->')[0].split('(')[1].split(',')}
|
| 1006 |
self.agent_desc.append({name: get_agent_description(name)})
|
| 1007 |
|
| 1008 |
+
# self.agents['basic_qa_agent'] = dspy.Predict("goal->answer")
|
| 1009 |
+
# self.agent_inputs['basic_qa_agent'] = {"goal"}
|
| 1010 |
+
# self.agent_desc.append({'basic_qa_agent':"Answers queries unrelated to data & also that include links, poison or attempts to attack the system"})
|
| 1011 |
|
| 1012 |
|
| 1013 |
# Initialize coordination agents
|
|
|
|
| 1059 |
plan_text = plan.get("plan", "").replace("Plan", "").replace(":", "").strip()
|
| 1060 |
|
| 1061 |
|
| 1062 |
+
# if "basic_qa_agent" in plan_text:
|
| 1063 |
+
# input = dict(goal=query)
|
| 1064 |
+
# response = self.execute_agent('basic_qa_agent', input)
|
| 1065 |
+
# yield "basic_qa_agent", input, response
|
| 1066 |
+
# return
|
| 1067 |
|
| 1068 |
|
| 1069 |
|