Spaces:
Configuration error
Configuration error
File size: 1,669 Bytes
eceb45a | 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 41 42 43 44 45 46 47 | from agency_swarm.tools import BaseTool
from pydantic import Field
import re
class ReportReviewTool(BaseTool):
"""
This tool analyzes the content of draft reports, checking for completeness, accuracy, and quality.
It identifies any missing sections or errors in the report.
"""
report_content: str = Field(
..., description="The content of the draft report to be analyzed."
)
def run(self):
"""
Analyzes the report content for completeness, accuracy, and quality.
Identifies missing sections or errors in the report.
"""
# Define the expected sections in a report
expected_sections = [
"Introduction", "Methodology", "Results", "Discussion", "Conclusion"
]
# Check for missing sections
missing_sections = [
section for section in expected_sections if section not in self.report_content
]
# Check for common errors (e.g., spelling mistakes)
# This is a simple example using regex to find repeated words
errors = re.findall(r'\b(\w+)\s+\1\b', self.report_content)
# Check for quality (e.g., length of the report)
quality_issues = []
if len(self.report_content.split()) < 500:
quality_issues.append("The report is too short, consider adding more content.")
# Compile the analysis results
analysis_results = {
"missing_sections": missing_sections,
"errors": errors,
"quality_issues": quality_issues
}
# Return the analysis results as a string
return f"Analysis Results: {analysis_results}" |