File size: 1,082 Bytes
ea40075
 
8fe992b
ea40075
 
 
 
 
b17c6bc
f46411c
 
 
 
 
 
fe8bf03
 
ea40075
 
fe8bf03
 
 
 
 
 
 
ea40075
8681609
 
565c28e
fe8bf03
 
4a671bb
fe8bf03
 
 
 
 
 
 
565c28e
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
33
34
35
36
37
38
39
40
41
from smolagents.tools import Tool
from typing import Any, Optional

class FinalAnswerTool(Tool):
    """Tool for providing a final answer to the user's query."""
    
    name = "final_answer"
    description = "Use this tool to provide your final answer to the user's question."
    output_type = "string"
    inputs = {
        "answer": {
            "type": "string",
            "description": "The final answer to provide to the user."
        }
    }
    
    def __call__(self, answer: str) -> str:
        """
        Provide a final answer to the user's query.
        
        Args:
            answer: The final answer to provide to the user.
            
        Returns:
            A confirmation message.
        """
        return answer

    forward = __call__

    def __str__(self) -> str:
        return "final_answer"
    
    @property
    def signature(self) -> str:
        return "final_answer(answer: str) -> str"
    
    def argument_descriptions(self) -> dict:
        return {
            "answer": "The final answer to provide to the user."
        }