mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-25 13:07:58 +00:00
Fix class promotion (#6187)
In LangChain, all module classes are enumerated in the `__init__.py` file of the correspondent module. But some classes were missed and were not included in the module `__init__.py` This PR: - added the missed classes to the module `__init__.py` files - `__init__.py:__all_` variable value (a list of the class names) was sorted - `langchain.tools.sql_database.tool.QueryCheckerTool` was renamed into the `QuerySQLCheckerTool` because it conflicted with `langchain.tools.spark_sql.tool.QueryCheckerTool` - changes to `pyproject.toml`: - added `pgvector` to `pyproject.toml:extended_testing` - added `pandas` to `pyproject.toml:[tool.poetry.group.test.dependencies]` - commented out the `streamlit` from `collbacks/__init__.py`, It is because now the `streamlit` requires Python >=3.7, !=3.9.7 - fixed duplicate names in `tools` - fixed correspondent ut-s #### Who can review? @hwchase17 @dev2049
This commit is contained in:
@@ -11,6 +11,7 @@ _EXPECTED = [
|
||||
"ConversationalChatAgent",
|
||||
"LLMSingleActionAgent",
|
||||
"MRKLChain",
|
||||
"OpenAIFunctionsAgent",
|
||||
"ReActChain",
|
||||
"ReActTextWorldAgent",
|
||||
"SelfAskWithSearchChain",
|
||||
|
@@ -21,7 +21,13 @@ def non_abstract_subclasses(
|
||||
return subclasses
|
||||
|
||||
|
||||
_PARSERS_TO_SKIP = {"FakeOutputParser", "BaseOutputParser"}
|
||||
# parsers defined not in the output_parsers module:
|
||||
_PARSERS_TO_SKIP = {
|
||||
"FakeOutputParser",
|
||||
"BaseOutputParser",
|
||||
"FinishedOutputParser",
|
||||
"RouterOutputParser",
|
||||
}
|
||||
_NON_ABSTRACT_PARSERS = non_abstract_subclasses(
|
||||
BaseOutputParser, to_skip=_PARSERS_TO_SKIP
|
||||
)
|
||||
|
@@ -61,9 +61,10 @@ def test_test_group_dependencies(poetry_conf: Mapping[str, Any]) -> None:
|
||||
test_group_deps = sorted(poetry_conf["group"]["test"]["dependencies"])
|
||||
|
||||
assert test_group_deps == [
|
||||
"duckdb-engine", # Should be removed
|
||||
"duckdb-engine",
|
||||
"freezegun",
|
||||
"lark", # Should be removed
|
||||
"lark",
|
||||
"pandas",
|
||||
"pytest",
|
||||
"pytest-asyncio",
|
||||
"pytest-cov",
|
||||
|
@@ -18,10 +18,9 @@ def _get_tool_classes(skip_tools_without_default_names: bool) -> List[Type[BaseT
|
||||
if isinstance(tool_class, type) and issubclass(tool_class, BaseTool):
|
||||
if tool_class in _EXCLUDE:
|
||||
continue
|
||||
if (
|
||||
skip_tools_without_default_names
|
||||
and tool_class.__fields__["name"].default is None
|
||||
):
|
||||
if skip_tools_without_default_names and tool_class.__fields__[
|
||||
"name"
|
||||
].default in [None, ""]:
|
||||
continue
|
||||
results.append(tool_class)
|
||||
return results
|
||||
|
@@ -4,15 +4,21 @@ from langchain.tools import __all__ as public_api
|
||||
_EXPECTED = [
|
||||
"AIPluginTool",
|
||||
"APIOperation",
|
||||
"ArxivQueryRun",
|
||||
"AzureCogsFormRecognizerTool",
|
||||
"AzureCogsImageAnalysisTool",
|
||||
"AzureCogsSpeech2TextTool",
|
||||
"AzureCogsText2SpeechTool",
|
||||
"BaseGraphQLTool",
|
||||
"BaseRequestsTool",
|
||||
"BaseSQLDatabaseTool",
|
||||
"BaseSparkSQLTool",
|
||||
"BaseTool",
|
||||
"BaseTool",
|
||||
"BaseTool",
|
||||
"BingSearchResults",
|
||||
"BingSearchRun",
|
||||
"BraveSearch",
|
||||
"ClickTool",
|
||||
"CopyFileTool",
|
||||
"CurrentWebPageTool",
|
||||
@@ -36,18 +42,41 @@ _EXPECTED = [
|
||||
"HumanInputRun",
|
||||
"IFTTTWebhook",
|
||||
"InfoPowerBITool",
|
||||
"InfoSQLDatabaseTool",
|
||||
"InfoSparkSQLTool",
|
||||
"JiraAction",
|
||||
"JsonGetValueTool",
|
||||
"JsonListKeysTool",
|
||||
"ListDirectoryTool",
|
||||
"ListPowerBITool",
|
||||
"ListSQLDatabaseTool",
|
||||
"ListSparkSQLTool",
|
||||
"MetaphorSearchResults",
|
||||
"MoveFileTool",
|
||||
"NavigateBackTool",
|
||||
"NavigateTool",
|
||||
"OpenAPISpec",
|
||||
"OpenWeatherMapQueryRun",
|
||||
"PubmedQueryRun",
|
||||
"PythonAstREPLTool",
|
||||
"PythonREPLTool",
|
||||
"QueryCheckerTool",
|
||||
"QueryPowerBITool",
|
||||
"QuerySQLCheckerTool",
|
||||
"QuerySQLDataBaseTool",
|
||||
"QuerySparkSQLTool",
|
||||
"ReadFileTool",
|
||||
"RequestsDeleteTool",
|
||||
"RequestsGetTool",
|
||||
"RequestsPatchTool",
|
||||
"RequestsPostTool",
|
||||
"RequestsPutTool",
|
||||
"SceneXplainTool",
|
||||
"SearxSearchResults",
|
||||
"SearxSearchRun",
|
||||
"ShellTool",
|
||||
"SleepTool",
|
||||
"StdInInquireTool",
|
||||
"SteamshipImageGenerationTool",
|
||||
"StructuredTool",
|
||||
"Tool",
|
||||
@@ -56,13 +85,11 @@ _EXPECTED = [
|
||||
"WikipediaQueryRun",
|
||||
"WolframAlphaQueryRun",
|
||||
"WriteFileTool",
|
||||
"YouTubeSearchTool",
|
||||
"ZapierNLAListActions",
|
||||
"ZapierNLARunAction",
|
||||
"tool",
|
||||
"YouTubeSearchTool",
|
||||
"BraveSearch",
|
||||
"PubmedQueryRun",
|
||||
"format_tool_to_openai_function",
|
||||
"tool",
|
||||
]
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user