SanketAI commited on
Commit
c423b65
·
verified ·
1 Parent(s): 4e8b8bb

Update router.py

Browse files
Files changed (1) hide show
  1. router.py +24 -24
router.py CHANGED
@@ -1,24 +1,24 @@
1
- from agents import IntentAgent, SearchAgent, QAAgent, FutureWorksAgent , SummarizationAgent
2
- import streamlit as st
3
- class Router:
4
- def __init__(self):
5
- self.intent_agent = IntentAgent()
6
- self.agents = {
7
- "search": SearchAgent(),
8
- "qa": QAAgent(),
9
- "future_works": FutureWorksAgent(),
10
- "summarize": SummarizationAgent()
11
- }
12
-
13
- def route_query(self, query):
14
-
15
- intent = self.intent_agent.get_intent(query)
16
- agent = self.agents.get(intent)
17
- st.write(f"Using {intent} agent...")
18
- if agent:
19
- if intent == "search":
20
- ans , d = agent.solve(query)
21
- return ans , d
22
- return agent.solve(query) , None
23
- else:
24
- return "Sorry, I couldn't understand your query. Please give valid question" , None
 
1
+ from agents import IntentAgent, SearchAgent, QAAgent, FutureWorksAgent , SummarizationAgent
2
+ import streamlit as st
3
+ class Router:
4
+ def __init__(self):
5
+ self.intent_agent = IntentAgent()
6
+ self.agents = {
7
+ "search": SearchAgent(),
8
+ "qa": QAAgent(),
9
+ "future_works": FutureWorksAgent(),
10
+ "summarize": SummarizationAgent()
11
+ }
12
+
13
+ def route_query(self, query):
14
+
15
+ intent = self.intent_agent.get_intent(query)
16
+ agent = self.agents.get(intent)
17
+ st.write(f"Using {intent} agent...")
18
+ if agent:
19
+ if intent == "search":
20
+ ans , d = agent.solve(query)
21
+ return ans , d
22
+ return agent.solve(query) , None
23
+ else:
24
+ return "[Sorry, I couldn't understand your query. Please give valid question]" , None