Update tool imports in constants.py

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-01-07 20:06:35 -03:00
commit 4c89bee640

View file

@ -1,18 +1,9 @@
from langchain import tools from langchain import tools
from langchain.agents import Tool from langchain.agents import Tool
from langchain.agents.load_tools import ( from langchain.agents.load_tools import _BASE_TOOLS, _EXTRA_LLM_TOOLS, _EXTRA_OPTIONAL_TOOLS, _LLM_TOOLS
_BASE_TOOLS,
_EXTRA_LLM_TOOLS,
_EXTRA_OPTIONAL_TOOLS,
_LLM_TOOLS,
)
from langchain.tools.json.tool import JsonSpec from langchain.tools.json.tool import JsonSpec
from langflow.interface.importing.utils import import_class from langflow.interface.importing.utils import import_class
from langflow.interface.tools.custom import ( from langflow.interface.tools.custom import PythonFunction, PythonFunctionTool
PythonFunctionTool,
PythonFunction,
)
FILE_TOOLS = {"JsonSpec": JsonSpec} FILE_TOOLS = {"JsonSpec": JsonSpec}
CUSTOM_TOOLS = { CUSTOM_TOOLS = {
@ -21,7 +12,7 @@ CUSTOM_TOOLS = {
"PythonFunction": PythonFunction, "PythonFunction": PythonFunction,
} }
OTHER_TOOLS = {tool: import_class(f"langchain.tools.{tool}") for tool in tools.__all__} OTHER_TOOLS = {tool: import_class(f"langchain_community.tools.{tool}") for tool in tools.__all__}
ALL_TOOLS_NAMES = { ALL_TOOLS_NAMES = {
**_BASE_TOOLS, **_BASE_TOOLS,