Spaces:
Sleeping
Sleeping
| # tools/final_answer.py | |
| from typing import Callable, Any | |
| from smolagents import 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 |