mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-11 00:58:30 +00:00
removing necessary crewai-tools dependency
This commit is contained in:
@@ -2,7 +2,6 @@ import os
|
|||||||
import uuid
|
import uuid
|
||||||
from typing import Any, Dict, List, Optional, Tuple
|
from typing import Any, Dict, List, Optional, Tuple
|
||||||
|
|
||||||
from crewai_tools import BaseTool as CrewAITool
|
|
||||||
from langchain.agents.agent import RunnableAgent
|
from langchain.agents.agent import RunnableAgent
|
||||||
from langchain.agents.tools import tool as LangChainTool
|
from langchain.agents.tools import tool as LangChainTool
|
||||||
from langchain.memory import ConversationSummaryMemory
|
from langchain.memory import ConversationSummaryMemory
|
||||||
@@ -280,12 +279,18 @@ class Agent(BaseModel):
|
|||||||
|
|
||||||
def _parse_tools(self, tools: List[Any]) -> List[LangChainTool]:
|
def _parse_tools(self, tools: List[Any]) -> List[LangChainTool]:
|
||||||
"""Parse tools to be used for the task."""
|
"""Parse tools to be used for the task."""
|
||||||
|
# tentatively try to import from crewai_tools import BaseTool as CrewAITool
|
||||||
tools_list = []
|
tools_list = []
|
||||||
for tool in tools:
|
try:
|
||||||
if isinstance(tool, CrewAITool):
|
from crewai_tools import BaseTool as CrewAITool
|
||||||
tools_list.append(tool.to_langchain())
|
|
||||||
else:
|
for tool in tools:
|
||||||
tools_list.append(tool)
|
if isinstance(tool, CrewAITool):
|
||||||
|
tools_list.append(tool.to_langchain())
|
||||||
|
else:
|
||||||
|
tools_list.append(tool)
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
tools_list.append(tool)
|
||||||
return tools_list
|
return tools_list
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
Reference in New Issue
Block a user