diff --git a/src/backend/base/langflow/base/tools/flow_tool.py b/src/backend/base/langflow/base/tools/flow_tool.py index 4f767e4dace..03936ac5839 100644 --- a/src/backend/base/langflow/base/tools/flow_tool.py +++ b/src/backend/base/langflow/base/tools/flow_tool.py @@ -1,9 +1,8 @@ from typing import Any, List, Optional, Type from asyncer import syncify -from langchain.tools import BaseTool from langchain_core.runnables import RunnableConfig -from langchain_core.tools import ToolException +from langchain_core.tools import BaseTool, ToolException from pydantic.v1 import BaseModel from langflow.base.flow_processing.utils import build_data_from_result_data, format_flow_output_data diff --git a/src/backend/base/langflow/components/tools/PythonCodeStructuredTool.py b/src/backend/base/langflow/components/tools/PythonCodeStructuredTool.py index ef3c3b8a854..3d70785458c 100644 --- a/src/backend/base/langflow/components/tools/PythonCodeStructuredTool.py +++ b/src/backend/base/langflow/components/tools/PythonCodeStructuredTool.py @@ -2,7 +2,7 @@ from typing import Any, Dict, List, Optional from langchain.agents import Tool -from langchain.tools import StructuredTool +from langchain_core.tools import StructuredTool from langflow.custom import CustomComponent from langflow.schema.dotdict import dotdict diff --git a/src/backend/base/langflow/components/tools/RetrieverTool.py b/src/backend/base/langflow/components/tools/RetrieverTool.py index 6a87bcbf983..43dfbcba636 100644 --- a/src/backend/base/langflow/components/tools/RetrieverTool.py +++ b/src/backend/base/langflow/components/tools/RetrieverTool.py @@ -1,4 +1,4 @@ -from langchain.tools.retriever import create_retriever_tool +from langchain_core.tools import create_retriever_tool from langflow.custom import CustomComponent from langflow.field_typing import BaseRetriever, Tool diff --git a/src/backend/base/langflow/components/tools/WikipediaAPI.py b/src/backend/base/langflow/components/tools/WikipediaAPI.py index 33cdaedb189..21c1660501f 100644 --- a/src/backend/base/langflow/components/tools/WikipediaAPI.py +++ b/src/backend/base/langflow/components/tools/WikipediaAPI.py @@ -1,4 +1,5 @@ -from langchain.tools import WikipediaQueryRun +from typing import cast +from langchain_community.tools import WikipediaQueryRun from langchain_community.utilities.wikipedia import WikipediaAPIWrapper from langflow.base.langchain_utilities.model import LCToolComponent @@ -34,7 +35,7 @@ def run_model(self) -> list[Data]: def build_tool(self) -> Tool: wrapper = self._build_wrapper() - return WikipediaQueryRun(api_wrapper=wrapper) + return cast(Tool, WikipediaQueryRun(api_wrapper=wrapper)) def _build_wrapper(self) -> WikipediaAPIWrapper: return WikipediaAPIWrapper( # type: ignore