Update BasicAgent.py
Browse files- BasicAgent.py +5 -20
BasicAgent.py
CHANGED
@@ -1,25 +1,10 @@
|
|
1 |
class BasicAgent:
|
2 |
def __init__(self):
|
3 |
print("BasicAgent initialized.")
|
4 |
-
# Predefined question-answer pairs (for testing purposes)
|
5 |
-
self.knowledge_base = {
|
6 |
-
"What is your name?": "I am a basic agent.",
|
7 |
-
"What is the capital of France?": "The capital of France is Paris.",
|
8 |
-
"What is the largest mammal?": "The largest mammal is the blue whale.",
|
9 |
-
# Add more predefined Q&A pairs here
|
10 |
-
}
|
11 |
|
12 |
def __call__(self, question: str) -> str:
|
13 |
-
print(f"Agent received question: {question[:50]}...")
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
if answer:
|
19 |
-
print(f"Agent returning predefined answer: {answer}")
|
20 |
-
return answer
|
21 |
-
else:
|
22 |
-
# Fallback: Generate a generic response if the question is not in the knowledge base
|
23 |
-
fallback_answer = "Sorry, I don't know the answer to that question."
|
24 |
-
print(f"Agent returning fallback answer: {fallback_answer}")
|
25 |
-
return fallback_answer
|
|
|
1 |
class BasicAgent:
|
2 |
def __init__(self):
|
3 |
print("BasicAgent initialized.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
def __call__(self, question: str) -> str:
|
6 |
+
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
7 |
+
# Replace this with your own logic to answer the questions
|
8 |
+
fixed_answer = "This is a default answer."
|
9 |
+
print(f"Agent returning fixed answer: {fixed_answer}")
|
10 |
+
return fixed_answer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|