First_agent / tools /final_answer.py
cjb97's picture
error fixes
565c28e
raw
history blame
1.08 kB
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."
}