Spaces:
Build error
Build error
Refactor agent structure by modularizing agent implementations into separate directories for web, data analysis, and media agents. Remove legacy code from agents.py, prompts.py, and tools.py, enhancing maintainability. Update main_v2.py to reflect new import paths and agent initialization. Add new tools for enhanced functionality, including web searching and data extraction. Update requirements.txt to include necessary dependencies for new tools.
837e221
unverified
from typing import List | |
import re | |
from smolagents import tool | |
def extract_dates(text: str) -> List[str]: | |
""" | |
Extract dates from text content. | |
Args: | |
text: Text content to extract dates from | |
Returns: | |
List of date strings found in the text | |
""" | |
# Simple regex patterns for date extraction | |
# These patterns can be expanded for better coverage | |
date_patterns = [ | |
r"\d{1,2}/\d{1,2}/\d{2,4}", # MM/DD/YYYY or DD/MM/YYYY | |
r"\d{1,2}-\d{1,2}-\d{2,4}", # MM-DD-YYYY or DD-MM-YYYY | |
r"\b(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]* \d{1,2},? \d{4}\b", # Month DD, YYYY | |
r"\b\d{1,2} (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]* \d{4}\b", # DD Month YYYY | |
] | |
results = [] | |
for pattern in date_patterns: | |
matches = re.findall(pattern, text, re.IGNORECASE) | |
results.extend(matches) | |
return results |