mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-07 07:59:29 +00:00
24 lines
646 B
Python
24 lines
646 B
Python
import logging
|
|
from typing import Literal
|
|
|
|
from crewai.tools import BaseTool
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
logger = logging.getLogger("lead_flow")
|
|
|
|
|
|
class LogLeadInput(BaseModel):
|
|
message: str = Field(description="The message to log.")
|
|
level: Literal["debug", "info", "warning", "error"] = "info"
|
|
|
|
|
|
class LogLeadTool(BaseTool):
|
|
name: str = "log_lead"
|
|
description: str = "Log a message about a lead that was not pursued."
|
|
args_schema: type[BaseModel] = LogLeadInput
|
|
|
|
def _run(self, message: str, level: str = "info") -> str:
|
|
logger.log(logging.getLevelName(level.upper()), message)
|
|
return message
|