Spaces:
Sleeping
Sleeping
File size: 463 Bytes
e0aa535 dd11ffa e0aa535 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
from smolagents.tools import Tool
class ReadTextTool(Tool):
name = "read_text"
description = "Reads a text file and returns the text content."
inputs = {
"file_path": {
"type": "string",
"description": "The full path of the text file to read"
}
}
output_type = "string"
def forward(self, file_path: str) -> str:
with open(file_path, "r", encoding="utf-8") as f:
return f.read() |