reduce import time by 6x (#1396)

* reduce import by 6x

* fix linting
This commit is contained in:
Brandon Hancock (bhancock_ai)
2024-10-06 16:55:32 -04:00
committed by GitHub
parent 0dfe3bcb0a
commit 5d8f8cbc79
7 changed files with 43 additions and 29 deletions

View File

@@ -1,4 +1,3 @@
from langchain.tools import StructuredTool
from crewai.agents.agent_builder.utilities.base_agent_tool import BaseAgentTools
@@ -6,6 +5,8 @@ class AgentTools(BaseAgentTools):
"""Default tools around agent delegation"""
def tools(self):
from langchain.tools import StructuredTool
coworkers = ", ".join([f"{agent.role}" for agent in self.agents])
tools = [
StructuredTool.from_function(

View File

@@ -1,4 +1,3 @@
from langchain.tools import StructuredTool
from pydantic import BaseModel, Field
from crewai.agents.cache import CacheHandler
@@ -14,6 +13,8 @@ class CacheTools(BaseModel):
)
def tool(self):
from langchain.tools import StructuredTool
return StructuredTool.from_function(
func=self.hit_cache,
name=self.name,