File size: 940 Bytes
c52d511
497b662
ba25b4b
c52d511
ba25b4b
c52d511
ff69472
 
 
 
 
 
 
497b662
 
ba25b4b
497b662
 
ff69472
c52d511
497b662
ff69472
 
497b662
c52d511
497b662
c52d511
 
497b662
ff69472
 
497b662
ff69472
ba25b4b
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
# tools/final_answer.py
from typing import Callable, Any
from smolagents import tool

@tool
class FinalAnswerTool:
    """A tool that provides the final answer for the agent's response.
    
    This tool is used to format and return the final response from the agent.
    It ensures that the response is properly formatted and ready for presentation
    to the user.
    """
    
    name: str = "final_answer"
    description: str = "Tool for providing the final response to the user"

    def __call__(self, response: str) -> str:
        """Provide the final answer.
        
        Args:
            response: The response to be returned as the final answer
            
        Returns:
            The formatted final answer as a string
        """
        return response

    def __str__(self) -> str:
        """Get string representation.
        
        Returns:
            The tool's name
        """
        return self.name