Spaces:
Sleeping
Sleeping
| # services/agents/summarizer_agent.py | |
| """ | |
| Summarization Agent - Wraps utilities/summarizer.py | |
| """ | |
| from typing import Dict, Any | |
| from services.agents.base_agent import BaseUtilityAgent | |
| from utilities.summarizer import summarize_remote | |
| class SummarizerAgent(BaseUtilityAgent): | |
| """ | |
| Autonomous agent for document summarization. | |
| """ | |
| def __init__(self): | |
| super().__init__( | |
| name="summarize", | |
| role="Document Summarization Specialist", | |
| goal="Create concise, accurate summaries that capture key information and main points", | |
| backstory="""You are an expert in text summarization and information distillation. | |
| You can identify the most important information in documents, distinguish between | |
| main points and supporting details, and create summaries that preserve meaning | |
| while reducing length. You validate summaries for accuracy and completeness.""", | |
| utility_function=summarize_remote | |
| ) | |
| def _prepare_task_description(self, input_data: Dict[str, Any]) -> str: | |
| """Prepare task description for the agent.""" | |
| filename = input_data.get("filename", "document") | |
| has_text = "text" in input_data | |
| source = "provided text" if has_text else f"{filename}" | |
| return f"""Validate the summary generated from {source}. | |
| Assess summary quality: | |
| - Accuracy: Does summary correctly represent source content? | |
| - Completeness: Are key points captured? | |
| - Conciseness: Is summary appropriately condensed? | |
| - Coherence: Is summary well-structured and readable? | |
| Provide confidence score (0.0-1.0).""" | |