Spaces:
Sleeping
Sleeping
| # services/agents/stamp_detection_agent.py | |
| """ | |
| Stamp Detection Agent - Wraps utilities/stamp_detection.py | |
| """ | |
| from typing import Dict, Any | |
| from services.agents.base_agent import BaseUtilityAgent | |
| from utilities.stamp_detection import stamp_detection_remote | |
| class StampDetectionAgent(BaseUtilityAgent): | |
| """ | |
| Autonomous agent for stamp/seal detection. | |
| """ | |
| def __init__(self): | |
| super().__init__( | |
| name="stamp_detection", | |
| role="Stamp Detection Specialist", | |
| goal="Detect and analyze stamps and seals in documents with precision", | |
| backstory="""You are an expert in stamp and seal detection. | |
| You can identify official stamps, seals, watermarks, and other document markings. | |
| You understand different stamp types (rubber stamps, embossed seals, ink stamps) | |
| and can validate detection results for accuracy and completeness.""", | |
| utility_function=stamp_detection_remote | |
| ) | |
| def _prepare_task_description(self, input_data: Dict[str, Any]) -> str: | |
| """Prepare task description for the agent.""" | |
| filename = input_data.get("filename", "document") | |
| start_page = input_data.get("start_page", 1) | |
| end_page = input_data.get("end_page", 1) | |
| return f"""Validate stamp detection results from {filename} (pages {start_page}-{end_page}). | |
| Assess detection quality: | |
| - Detection: Were all stamps/seals identified? | |
| - Accuracy: Are detections true stamps (not false positives)? | |
| - Classification: Are stamp types correctly identified? | |
| - Completeness: Are locations and characteristics captured? | |
| Provide confidence score (0.0-1.0).""" | |