File size: 1,432 Bytes
734b5b4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | 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)
|