mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-08 15:48:29 +00:00
* move base_tool to main package and consolidate tool desscription generation * update import path * update tests * update doc * add base_tool test * migrate agent delegation tools to use BaseTool * update tests * update import path for tool * fix lint * update param signature * add from_langchain to BaseTool for backwards support of langchain tools * fix the case where StructuredTool doesn't have func --------- Co-authored-by: c0dez <li@vitablehealth.com> Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com>
23 lines
670 B
Python
23 lines
670 B
Python
from typing import Type
|
|
|
|
from crewai.tools import BaseTool
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class MyCustomToolInput(BaseModel):
|
|
"""Input schema for MyCustomTool."""
|
|
|
|
argument: str = Field(..., description="Description of the argument.")
|
|
|
|
|
|
class MyCustomTool(BaseTool):
|
|
name: str = "Name of my tool"
|
|
description: str = (
|
|
"Clear description for what this tool is useful for, you agent will need this information to use it."
|
|
)
|
|
args_schema: Type[BaseModel] = MyCustomToolInput
|
|
|
|
def _run(self, argument: str) -> str:
|
|
# Implementation goes here
|
|
return "this is an example of a tool output, ignore it and move along."
|