Skip to content

Commit

Permalink
refactor: update import statements in tools (#2796)
Browse files Browse the repository at this point in the history
* fix: update import statement for WikipediaAPI.py

* fix: update import statement for flow_tool.py

* fix: update import statement in StructuredTool

* fix: update import in retriever tool
  • Loading branch information
ogabrielluiz authored Jul 18, 2024
1 parent f504bcc commit d897752
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/backend/base/langflow/base/tools/flow_tool.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/backend/base/langflow/components/tools/WikipediaAPI.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d897752

Please sign in to comment.