First_agent / tools /final_answer.py
cjb97's picture
reset
fe8bf03
raw
history blame
960 Bytes
from typing import Optional
class FinalAnswerTool:
"""A tool that allows the agent to provide a final answer to the user's query."""
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 f"FINAL ANSWER: {answer}"
def __str__(self) -> str:
return "final_answer"
@property
def name(self) -> str:
return "final_answer"
@property
def description(self) -> str:
return "Use this tool to provide a final answer to the user's query."
@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."
}