Spaces:
Sleeping
Sleeping
File size: 1,105 Bytes
fd18d93 8fe992b a21f351 8fe992b a21f351 8fe992b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 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
|