Download src/agents/export_rendering_agent.py from techprotrade/annator: direct link, hf CLI and curl.
- Browser
- Download file 1.43 kB
-
https://huggingface.co/techprotrade/annator/resolve/fb26dc8decbf6fbcdf145aa5f9debd7eca5cae35/src/agents/export_rendering_agent.py
- Command line
-
hf download hf://techprotrade/annator@fb26dc8decbf6fbcdf145aa5f9debd7eca5cae35/src/agents/export_rendering_agent.py
-
curl -L -o export_rendering_agent.py https://huggingface.co/techprotrade/annator/resolve/fb26dc8decbf6fbcdf145aa5f9debd7eca5cae35/src/agents/export_rendering_agent.py
1.43 kB
| from typing import Dict, Any | |
| from .base_agent import LLMAgent | |
| class ExportRenderingAgent(LLMAgent): | |
| name = "export_rendering_agent" | |
| description = "Handles final PDF export and rendering - ensures output quality and format compliance" | |
| def build_prompt(self, pdf, results: Dict[str, Any]) -> str: | |
| summary = results.get("summary", {}) | |
| return f"""Prepare to export the processed PDF. | |
| Summary of processing: | |
| - Pages processed: {summary.get("pages_processed", 0)} | |
| - Tables detected: {summary.get("total_tables", 0)} | |
| - All content validated: {summary.get("all_valid", False)} | |
| Determine: | |
| 1. What format should the output be (PDF/A, standard PDF, etc.)? | |
| 2. Should any compression or optimization be applied? | |
| 3. Are there any special rendering requirements? | |
| 4. What metadata should be included? | |
| Provide final export configuration.""" | |
| def execute( | |
| self, pdf, results: Dict[str, Any], output_path: str, reasoning: str = "" | |
| ) -> Dict[str, Any]: | |
| return { | |
| "exported": True, | |
| "output_path": output_path, | |
| "format": "PDF", | |
| "pages_exported": results.get("summary", {}).get("pages_processed", 0), | |
| "reasoning": reasoning, | |
| } | |
| def process(self, pdf, results: Dict[str, Any], output_path: str) -> None: | |
| reasoning = self.think(self.build_prompt(pdf, results)) | |
| self.execute(pdf, results, output_path, reasoning) | |