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, Dict, Any | |
import re | |
from smolagents import tool | |
def find_in_page(page_content: Dict[str, Any], query: str) -> List[str]: | |
""" | |
Find occurrences of a query string in page content. | |
Args: | |
page_content: Page content returned by browse_webpage | |
query: String to search for in the page | |
Returns: | |
List of sentences or sections containing the query | |
""" | |
results = [] | |
if "content" in page_content: | |
content = page_content["content"] | |
# Split content into sentences | |
sentences = re.split(r"(?<=[.!?])\s+", content) | |
# Find sentences containing the query | |
for sentence in sentences: | |
if query.lower() in sentence.lower(): | |
results.append(sentence) | |
return results |