| 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) |
|
|