File size: 562 Bytes
6a8d3fe
 
 
 
 
a78f812
 
 
6a8d3fe
43ff02f
6a8d3fe
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from typing import Any, Optional
from smolagents.tools import Tool

class FinalAnswerTool(Tool):
    name = "final_answer"
    description = "This tool sends the final answer to the user. This tool does not format the answer. Format the answer before using this tool."
    inputs = {'answer': {'type': 'any', 'description': 'A well formatted and short final answer to the user`s problem.'}}
    output_type = "string"

    def forward(self, answer: str) -> str:
        return answer

    def __init__(self, *args, **kwargs):
        self.is_initialized = False