|
class BasicAgent: |
|
def __init__(self): |
|
print("BasicAgent initialized.") |
|
|
|
self.knowledge_base = { |
|
"What is your name?": "I am a basic agent.", |
|
"What is the capital of France?": "The capital of France is Paris.", |
|
"What is the largest mammal?": "The largest mammal is the blue whale.", |
|
|
|
} |
|
|
|
def __call__(self, question: str) -> str: |
|
print(f"Agent received question: {question[:50]}...") |
|
|
|
|
|
answer = self.knowledge_base.get(question.strip(), None) |
|
|
|
if answer: |
|
print(f"Agent returning predefined answer: {answer}") |
|
return answer |
|
else: |
|
|
|
fallback_answer = "Sorry, I don't know the answer to that question." |
|
print(f"Agent returning fallback answer: {fallback_answer}") |
|
return fallback_answer |
|
|