Spaces:
Sleeping
Sleeping
File size: 1,067 Bytes
c52d511 ba25b4b c52d511 ba25b4b c52d511 ff69472 ba25b4b c52d511 ff69472 c52d511 ff69472 c52d511 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 35 36 37 38 |
# tools/final_answer.py
from typing import 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.
Attributes:
name (str): The name identifier for the tool
description (str): A brief description of the tool's purpose
"""
name = "final_answer"
description = "A tool to provide the final answer"
def __call__(self, answer: str) -> str:
"""Process and return the final answer.
Args:
answer: The final answer text to be returned to the user
Returns:
str: The formatted final answer
"""
return answer
def __str__(self) -> str:
"""Return string representation of the tool.
Returns:
str: The tool's name
"""
return self.name |