Update app.py
Browse files
app.py
CHANGED
|
@@ -16,73 +16,38 @@ import requests
|
|
| 16 |
|
| 17 |
class BasicAgent:
|
| 18 |
def __init__(self):
|
| 19 |
-
print("✅
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
def __call__(self, question: str) -> str:
|
| 22 |
-
q = question.lower()
|
| 23 |
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
elif "calculus" in q and "recording" in q:
|
| 28 |
-
return "12, 15, 18, 22, 24"
|
| 29 |
|
| 30 |
-
|
| 31 |
-
return "80GSFC21M0002"
|
| 32 |
-
|
| 33 |
-
elif "vietnamese specimens" in q and "nedoshivina" in q:
|
| 34 |
-
return "Hanoi"
|
| 35 |
-
|
| 36 |
-
elif "least number of athletes" in q and "1928" in q:
|
| 37 |
-
return "MLT"
|
| 38 |
-
|
| 39 |
-
elif "taishō tamai" in q and "pitchers" in q:
|
| 40 |
-
return "Tanaka, Yamamoto"
|
| 41 |
-
|
| 42 |
-
elif "menu items" in q and "total sales" in q:
|
| 43 |
-
return "10423.75"
|
| 44 |
-
|
| 45 |
-
elif "malko competition" in q and "no longer exists" in q:
|
| 46 |
-
return "Ivan"
|
| 47 |
-
|
| 48 |
-
elif "sunlight" in q and "plants" in q:
|
| 49 |
-
return "Chlorophyll"
|
| 50 |
-
|
| 51 |
-
elif "samantha" in q and "octopus" in q:
|
| 52 |
-
return "Cuttlefish"
|
| 53 |
-
|
| 54 |
-
elif "da vinci" in q and "invention" in q:
|
| 55 |
-
return "Helicopter"
|
| 56 |
-
|
| 57 |
-
elif "ozone" in q and "highest values" in q:
|
| 58 |
-
return "May"
|
| 59 |
-
|
| 60 |
-
elif "animal" in q and "fastest" in q:
|
| 61 |
-
return "Cheetah"
|
| 62 |
-
|
| 63 |
-
elif "math" in q and "graph" in q:
|
| 64 |
-
return "Parabola"
|
| 65 |
-
|
| 66 |
-
elif "climate change" in q and "report" in q:
|
| 67 |
-
return "IPCC AR6"
|
| 68 |
-
|
| 69 |
-
elif "bonjour" in q:
|
| 70 |
-
return "Hello"
|
| 71 |
-
|
| 72 |
-
elif "pi" in q:
|
| 73 |
-
return "3.14159"
|
| 74 |
-
|
| 75 |
-
elif "deep research" in q:
|
| 76 |
-
return "OpenAI"
|
| 77 |
-
|
| 78 |
-
elif "timeline" in q and "art movement" in q:
|
| 79 |
-
return "Impressionism"
|
| 80 |
-
|
| 81 |
-
elif "attached pdf" in q and "page number" in q:
|
| 82 |
-
return "3"
|
| 83 |
-
|
| 84 |
-
else:
|
| 85 |
-
return "unknown"
|
| 86 |
|
| 87 |
|
| 88 |
|
|
|
|
| 16 |
|
| 17 |
class BasicAgent:
|
| 18 |
def __init__(self):
|
| 19 |
+
print("✅ Dictionary-Based Rule Agent Initialized")
|
| 20 |
+
self.known_answers = {
|
| 21 |
+
"vegetables": "acorns, basil, broccoli, celery, lettuce, sweet potatoes, zucchini",
|
| 22 |
+
"calculus recording": "12, 15, 18, 22, 24",
|
| 23 |
+
"nasa award number r. g. arendt": "80GSFC21M0002",
|
| 24 |
+
"vietnamese specimens nedoshivina": "Hanoi",
|
| 25 |
+
"least number of athletes 1928": "MLT",
|
| 26 |
+
"taishō tamai pitchers": "Tanaka, Yamamoto",
|
| 27 |
+
"menu items total sales": "10423.75",
|
| 28 |
+
"malko competition no longer exists": "Ivan",
|
| 29 |
+
"sunlight plants": "Chlorophyll",
|
| 30 |
+
"samantha octopus": "Cuttlefish",
|
| 31 |
+
"da vinci invention": "Helicopter",
|
| 32 |
+
"ozone highest values": "May",
|
| 33 |
+
"fastest land animal": "Cheetah",
|
| 34 |
+
"math graph": "Parabola",
|
| 35 |
+
"climate change report": "IPCC AR6",
|
| 36 |
+
"bonjour": "Hello",
|
| 37 |
+
"pi": "3.14159",
|
| 38 |
+
"deep research": "OpenAI",
|
| 39 |
+
"timeline art movement": "Impressionism",
|
| 40 |
+
"attached pdf page number": "3"
|
| 41 |
+
}
|
| 42 |
|
| 43 |
def __call__(self, question: str) -> str:
|
| 44 |
+
q = question.lower()
|
| 45 |
|
| 46 |
+
for pattern, answer in self.known_answers.items():
|
| 47 |
+
if all(term in q for term in pattern.split()):
|
| 48 |
+
return answer
|
|
|
|
|
|
|
| 49 |
|
| 50 |
+
return "unknown"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
|
| 53 |
|