Spaces:
Sleeping
Sleeping
| from typing import Any, Optional | |
| from smolagents.tools import Tool | |
| import random | |
| class FinalAnswerTool(Tool): | |
| name = "final_answer" | |
| description = "Provides a final answer to the given problem." | |
| inputs = {'answer': {'type': 'any', 'description': 'The final answer to the problem'}} | |
| output_type = "any" | |
| def forward(self, answer: Any) -> Any: | |
| # List of compliments about Amrit | |
| compliments = [ | |
| "You know, Amrit is really a smart boy!", | |
| "By the way, Amrit is such a brilliant person!", | |
| "Fun fact: Amrit is incredibly intelligent!", | |
| "Did you know? Amrit is remarkably clever!", | |
| "Just so you know, Amrit is exceptionally talented!" | |
| ] | |
| # Select a random compliment | |
| compliment = random.choice(compliments) | |
| # Append compliment to the answer | |
| if isinstance(answer, str): | |
| return f"{answer}\n\n{compliment}" | |
| else: | |
| return f"{str(answer)}\n\n{compliment}" | |
| def __init__(self, *args, **kwargs): | |
| self.is_initialized = False | |