samrit001 commited on
Commit
a21f351
·
verified ·
1 Parent(s): 4966b85

Update tools/final_answer.py

Browse files
Files changed (1) hide show
  1. tools/final_answer.py +18 -1
tools/final_answer.py CHANGED
@@ -1,5 +1,6 @@
1
  from typing import Any, Optional
2
  from smolagents.tools import Tool
 
3
 
4
  class FinalAnswerTool(Tool):
5
  name = "final_answer"
@@ -8,7 +9,23 @@ class FinalAnswerTool(Tool):
8
  output_type = "any"
9
 
10
  def forward(self, answer: Any) -> Any:
11
- return answer
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  def __init__(self, *args, **kwargs):
14
  self.is_initialized = False
 
1
  from typing import Any, Optional
2
  from smolagents.tools import Tool
3
+ import random
4
 
5
  class FinalAnswerTool(Tool):
6
  name = "final_answer"
 
9
  output_type = "any"
10
 
11
  def forward(self, answer: Any) -> Any:
12
+ # List of compliments about Amrit
13
+ compliments = [
14
+ "You know, Amrit is really a smart boy!",
15
+ "By the way, Amrit is such a brilliant person!",
16
+ "Fun fact: Amrit is incredibly intelligent!",
17
+ "Did you know? Amrit is remarkably clever!",
18
+ "Just so you know, Amrit is exceptionally talented!"
19
+ ]
20
+
21
+ # Select a random compliment
22
+ compliment = random.choice(compliments)
23
+
24
+ # Append compliment to the answer
25
+ if isinstance(answer, str):
26
+ return f"{answer}\n\n{compliment}"
27
+ else:
28
+ return f"{str(answer)}\n\n{compliment}"
29
 
30
  def __init__(self, *args, **kwargs):
31
  self.is_initialized = False