Update router.py
Browse files
router.py
CHANGED
|
@@ -33,7 +33,7 @@ class RouterAgent(BaseAgent):
|
|
| 33 |
self.agents[agent_type] = agent
|
| 34 |
self.agent_descriptions[agent_type] = description
|
| 35 |
|
| 36 |
-
def __call__(self, question: str, **kwargs) -> str:
|
| 37 |
"""
|
| 38 |
Process the question using pure LLM reasoning to select the appropriate agent.
|
| 39 |
|
|
@@ -55,12 +55,13 @@ class RouterAgent(BaseAgent):
|
|
| 55 |
|
| 56 |
# Delegate to the selected specialized agent
|
| 57 |
if agent_type in self.agents:
|
| 58 |
-
return self.agents[agent_type](question, **kwargs)
|
| 59 |
|
| 60 |
# Fallback to research agent if available
|
| 61 |
if "research_question" in self.agents:
|
| 62 |
print(f"Agent '{agent_type}' not found. Falling back to research_question agent.")
|
| 63 |
return self.agents["research_question"](question, **kwargs)
|
|
|
|
| 64 |
|
| 65 |
# Ultimate fallback
|
| 66 |
return f"No appropriate agent found for question type: {agent_type}"
|
|
@@ -118,7 +119,7 @@ class RouterAgent(BaseAgent):
|
|
| 118 |
Consider the question's content, type, and any contextual clues provided.
|
| 119 |
|
| 120 |
Return ONLY the agent type identifier as a single word, with no additional explanation or text.
|
| 121 |
-
For example: "research_question" or "
|
| 122 |
"""
|
| 123 |
|
| 124 |
user_prompt = f"""
|
|
|
|
| 33 |
self.agents[agent_type] = agent
|
| 34 |
self.agent_descriptions[agent_type] = description
|
| 35 |
|
| 36 |
+
def __call__(self, question: str, file_name: str = None, **kwargs) -> str:
|
| 37 |
"""
|
| 38 |
Process the question using pure LLM reasoning to select the appropriate agent.
|
| 39 |
|
|
|
|
| 55 |
|
| 56 |
# Delegate to the selected specialized agent
|
| 57 |
if agent_type in self.agents:
|
| 58 |
+
return self.agents[agent_type](question, file_name, **kwargs)
|
| 59 |
|
| 60 |
# Fallback to research agent if available
|
| 61 |
if "research_question" in self.agents:
|
| 62 |
print(f"Agent '{agent_type}' not found. Falling back to research_question agent.")
|
| 63 |
return self.agents["research_question"](question, **kwargs)
|
| 64 |
+
|
| 65 |
|
| 66 |
# Ultimate fallback
|
| 67 |
return f"No appropriate agent found for question type: {agent_type}"
|
|
|
|
| 119 |
Consider the question's content, type, and any contextual clues provided.
|
| 120 |
|
| 121 |
Return ONLY the agent type identifier as a single word, with no additional explanation or text.
|
| 122 |
+
For example: "research_question" or "audio_transcript"
|
| 123 |
"""
|
| 124 |
|
| 125 |
user_prompt = f"""
|