First_agent_template / tools /final_answer.py
jcleee's picture
Update tools/final_answer.py
6421802 verified
raw
history blame contribute delete
516 Bytes
from typing import Any
from smolagents.tools import Tool
class FinalAnswerTool(Tool):
name = "final_answer"
description = "Provides a final answer to the given problem."
inputs = {'answer': {'type': 'any', 'description': 'The final answer to the problem'}}
output_type = "any"
def forward(self, answer: Any) -> Any:
# ✅ This is what actually returns the value back to the agent
return answer
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)