import pandas as pd from smolagents import Tool class CsvReaderTool(Tool): name = "csv_reader" description = "Extract CSV file content. Supported file extensions: .csv" inputs = { "file_path": { "type": "string", "description": "Path to the CSV file", } } output_type = "string" def forward(self, file_path) -> str: try: df = pd.read_csv(file_path) print(f"Describe CSV file:\n {df.describe()}") return df.to_json() except Exception as e: return f"Error processing CSV file: {str(e)}"