# Extract and combine content recursively from typing import Dict, Optional, Type from langchain.callbacks.manager import ( AsyncCallbackManagerForToolRun, CallbackManagerForToolRun, ) from langchain.pydantic_v1 import BaseModel as BaseModelV1 from langchain.pydantic_v1 import Field as FieldV1 from langchain_community.document_loaders import PlaywrightURLLoader from langchain_core.tools import BaseTool from logger import get_logger from models import BrainSettings from modules.contact_support.controller.settings import ContactsSettings from packages.emails.send_email import send_email from pydantic import BaseModel logger = get_logger(__name__) class EmailInput(BaseModelV1): text: str = FieldV1( ..., title="text", description="text to send in HTML email format. Use pretty formating, use bold, italic, next line, etc...", ) class EmailSenderTool(BaseTool): user_email: str name = "email-sender" description = "useful for when you need to send an email." args_schema: Type[BaseModel] = EmailInput brain_settings: BrainSettings = BrainSettings() contact_settings: ContactsSettings = ContactsSettings() def _run( self, text: str, run_manager: Optional[CallbackManagerForToolRun] = None ) -> Dict: html_body = f"""