mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-24 15:43:54 +00:00
Deprecate StdInquireTool (#3850)
- Deprecate StdInInquire tool (dup of HumanInputRun) - Expose missing tools from `langchain.tools`
This commit is contained in:
parent
b1d69d3e7a
commit
d7e17fc8fe
@ -27,6 +27,13 @@ from langchain.tools.playwright import (
|
||||
from langchain.tools.plugin import AIPluginTool
|
||||
from langchain.tools.scenexplain.tool import SceneXplainTool
|
||||
from langchain.tools.shell.tool import ShellTool
|
||||
from langchain.tools.vectorstore.tool import (
|
||||
VectorStoreQATool,
|
||||
VectorStoreQAWithSourcesTool,
|
||||
)
|
||||
from langchain.tools.wikipedia.tool import WikipediaQueryRun
|
||||
from langchain.tools.wolfram_alpha.tool import WolframAlphaQueryRun
|
||||
from langchain.tools.zapier.tool import ZapierNLAListActions, ZapierNLARunAction
|
||||
|
||||
__all__ = [
|
||||
"AIPluginTool",
|
||||
@ -60,4 +67,10 @@ __all__ = [
|
||||
"WriteFileTool",
|
||||
"BaseTool",
|
||||
"SceneXplainTool",
|
||||
"VectorStoreQAWithSourcesTool",
|
||||
"VectorStoreQATool",
|
||||
"WikipediaQueryRun",
|
||||
"WolframAlphaQueryRun",
|
||||
"ZapierNLARunAction",
|
||||
"ZapierNLAListActions",
|
||||
]
|
||||
|
@ -1 +1,5 @@
|
||||
"""Bing Search API toolkit."""
|
||||
|
||||
from langchain.tools.bing_search.tool import BingSearchResults, BingSearchRun
|
||||
|
||||
__all__ = ["BingSearchRun", "BingSearchResults"]
|
||||
|
@ -1 +1,5 @@
|
||||
"""Google Places API Toolkit."""
|
||||
|
||||
from langchain.tools.google_places.tool import GooglePlacesTool
|
||||
|
||||
__all__ = ["GooglePlacesTool"]
|
||||
|
@ -1 +1,5 @@
|
||||
"""Google Search API Toolkit."""
|
||||
|
||||
from langchain.tools.google_search.tool import GoogleSearchResults, GoogleSearchRun
|
||||
|
||||
__all__ = ["GoogleSearchRun", "GoogleSearchResults"]
|
||||
|
@ -1 +1,5 @@
|
||||
"""Tool for asking for human input."""
|
||||
|
||||
from langchain.tools.human.tool import HumanInputRun
|
||||
|
||||
__all__ = ["HumanInputRun"]
|
||||
|
@ -1,32 +1,17 @@
|
||||
"""Tools for interacting with the user."""
|
||||
|
||||
|
||||
from typing import Optional
|
||||
import warnings
|
||||
from typing import Any
|
||||
|
||||
from langchain.callbacks.manager import (
|
||||
AsyncCallbackManagerForToolRun,
|
||||
RunManager,
|
||||
)
|
||||
from langchain.tools.base import BaseTool
|
||||
from langchain.tools.human.tool import HumanInputRun
|
||||
|
||||
|
||||
class StdInInquireTool(BaseTool):
|
||||
def StdInInquireTool(*args: Any, **kwargs: Any) -> HumanInputRun:
|
||||
"""Tool for asking the user for input."""
|
||||
|
||||
name: str = "Inquire"
|
||||
description: str = (
|
||||
"useful if you do not have enough information to"
|
||||
" effectively use other tools. Input is best as a clarifying"
|
||||
" question (to disambiguate) or a request for more context."
|
||||
warnings.warn(
|
||||
"StdInInquireTool will be deprecated in the future. "
|
||||
"Please use HumanInputRun instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
|
||||
def _run(self, prompt: str, run_manager: Optional[RunManager] = None) -> str:
|
||||
"""Prompt the user for more input."""
|
||||
return input(f"\n{prompt}")
|
||||
|
||||
async def _arun(
|
||||
self,
|
||||
query: str,
|
||||
run_manager: Optional[AsyncCallbackManagerForToolRun] = None,
|
||||
) -> str:
|
||||
raise NotImplementedError(f"{self.__class__.__name__} does not support async")
|
||||
return HumanInputRun(*args, **kwargs)
|
||||
|
@ -1 +1,8 @@
|
||||
"""Wolfram Alpha API toolkit."""
|
||||
|
||||
|
||||
from langchain.tools.wolfram_alpha.tool import WolframAlphaQueryRun
|
||||
|
||||
__all__ = [
|
||||
"WolframAlphaQueryRun",
|
||||
]
|
||||
|
@ -1 +1,8 @@
|
||||
"""Zapier Tool."""
|
||||
|
||||
from langchain.tools.zapier.tool import ZapierNLAListActions, ZapierNLARunAction
|
||||
|
||||
__all__ = [
|
||||
"ZapierNLARunAction",
|
||||
"ZapierNLAListActions",
|
||||
]
|
||||
|
@ -21,7 +21,8 @@ def get_non_abstract_subclasses(cls: Type[BaseTool]) -> List[Type[BaseTool]]:
|
||||
and subclass not in to_skip
|
||||
):
|
||||
subclasses.append(subclass)
|
||||
subclasses.extend(get_non_abstract_subclasses(subclass))
|
||||
sc = get_non_abstract_subclasses(subclass)
|
||||
subclasses.extend(sc)
|
||||
return subclasses
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user