feat: add input validation to MathAgent for math-specific queries

- Updated `mock_multi_agent.py` to ensure agent only responds to valid math inputs
- Prevented irrelevant queries from being processed by MathAgent
pull/819/head
Pavan Kumar 3 days ago committed by ascender1729
parent 50a11f3fd6
commit b172ce0b24

@ -25,6 +25,15 @@ class MathAgent:
async def process(self, task: str):
try:
# Check if input is math-related
math_keywords = ['add', 'plus', '+', 'multiply', 'times', '*', 'x', 'divide', '/', 'by']
if not any(keyword in task.lower() for keyword in math_keywords):
return {
"agent": self.agent.agent_name,
"task": task,
"response": "Please provide a mathematical operation (add, multiply, or divide)"
}
response = await self.agent.arun(task)
return {
"agent": self.agent.agent_name,

Loading…
Cancel
Save