Spaces:
Sleeping
Sleeping
| from pdfminer.high_level import extract_text | |
| from smolagents import Tool | |
| class PdfReaderTool(Tool): | |
| name = "pdf_reader" | |
| description = "Extract PDF content. Supported file extensions: .pdf" | |
| inputs = { | |
| "file_path": { | |
| "type": "string", | |
| "description": "Path to the PDF file", | |
| } | |
| } | |
| output_type = "string" | |
| def forward(self, file_path) -> str: | |
| try: | |
| return extract_text(file_path) | |
| except Exception as e: | |
| return f"Error processing PDF file: {str(e)}" | |