community[patch]: import flattening fix (#20110)

This PR should make it easier for linters to do type checking and for IDEs to jump to definition of code.

See #20050 as a template for this PR.
- As a byproduct: Added 3 missed `test_imports`.
- Added missed `SolarChat` in to __init___.py Added it into test_import
ut.
- Added `# type: ignore` to fix linting. It is not clear, why linting
errors appear after ^ changes.

---------

Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
This commit is contained in:
Leonid Ganeline
2024-04-10 10:01:19 -07:00
committed by GitHub
parent 12190ad728
commit 4cb5f4c353
60 changed files with 2973 additions and 163 deletions

View File

@@ -18,7 +18,433 @@ tool for the job.
"""
import importlib
from typing import Any
from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
from langchain_core.tools import (
BaseTool, # noqa: F401
StructuredTool, # noqa: F401
Tool, # noqa: F401
tool, # noqa: F401
)
from langchain_community.tools.ainetwork.app import (
AINAppOps, # noqa: F401
)
from langchain_community.tools.ainetwork.owner import (
AINOwnerOps, # noqa: F401
)
from langchain_community.tools.ainetwork.rule import (
AINRuleOps, # noqa: F401
)
from langchain_community.tools.ainetwork.transfer import (
AINTransfer, # noqa: F401
)
from langchain_community.tools.ainetwork.value import (
AINValueOps, # noqa: F401
)
from langchain_community.tools.arxiv.tool import (
ArxivQueryRun, # noqa: F401
)
from langchain_community.tools.azure_ai_services import (
AzureAiServicesDocumentIntelligenceTool, # noqa: F401
AzureAiServicesImageAnalysisTool, # noqa: F401
AzureAiServicesSpeechToTextTool, # noqa: F401
AzureAiServicesTextAnalyticsForHealthTool, # noqa: F401
AzureAiServicesTextToSpeechTool, # noqa: F401
)
from langchain_community.tools.azure_cognitive_services import (
AzureCogsFormRecognizerTool, # noqa: F401
AzureCogsImageAnalysisTool, # noqa: F401
AzureCogsSpeech2TextTool, # noqa: F401
AzureCogsText2SpeechTool, # noqa: F401
AzureCogsTextAnalyticsHealthTool, # noqa: F401
)
from langchain_community.tools.bearly.tool import (
BearlyInterpreterTool, # noqa: F401
)
from langchain_community.tools.bing_search.tool import (
BingSearchResults, # noqa: F401
BingSearchRun, # noqa: F401
)
from langchain_community.tools.brave_search.tool import (
BraveSearch, # noqa: F401
)
from langchain_community.tools.cogniswitch.tool import (
CogniswitchKnowledgeRequest, # noqa: F401
CogniswitchKnowledgeSourceFile, # noqa: F401
CogniswitchKnowledgeSourceURL, # noqa: F401
CogniswitchKnowledgeStatus, # noqa: F401
)
from langchain_community.tools.connery import (
ConneryAction, # noqa: F401
)
from langchain_community.tools.convert_to_openai import (
format_tool_to_openai_function, # noqa: F401
)
from langchain_community.tools.ddg_search.tool import (
DuckDuckGoSearchResults, # noqa: F401
DuckDuckGoSearchRun, # noqa: F401
)
from langchain_community.tools.e2b_data_analysis.tool import (
E2BDataAnalysisTool, # noqa: F401
)
from langchain_community.tools.edenai import (
EdenAiExplicitImageTool, # noqa: F401
EdenAiObjectDetectionTool, # noqa: F401
EdenAiParsingIDTool, # noqa: F401
EdenAiParsingInvoiceTool, # noqa: F401
EdenAiSpeechToTextTool, # noqa: F401
EdenAiTextModerationTool, # noqa: F401
EdenAiTextToSpeechTool, # noqa: F401
EdenaiTool, # noqa: F401
)
from langchain_community.tools.eleven_labs.text2speech import (
ElevenLabsText2SpeechTool, # noqa: F401
)
from langchain_community.tools.file_management import (
CopyFileTool, # noqa: F401
DeleteFileTool, # noqa: F401
FileSearchTool, # noqa: F401
ListDirectoryTool, # noqa: F401
MoveFileTool, # noqa: F401
ReadFileTool, # noqa: F401
WriteFileTool, # noqa: F401
)
from langchain_community.tools.gmail import (
GmailCreateDraft, # noqa: F401
GmailGetMessage, # noqa: F401
GmailGetThread, # noqa: F401
GmailSearch, # noqa: F401
GmailSendMessage, # noqa: F401
)
from langchain_community.tools.google_cloud.texttospeech import (
GoogleCloudTextToSpeechTool, # noqa: F401
)
from langchain_community.tools.google_places.tool import (
GooglePlacesTool, # noqa: F401
)
from langchain_community.tools.google_search.tool import (
GoogleSearchResults, # noqa: F401
GoogleSearchRun, # noqa: F401
)
from langchain_community.tools.google_serper.tool import (
GoogleSerperResults, # noqa: F401
GoogleSerperRun, # noqa: F401
)
from langchain_community.tools.graphql.tool import (
BaseGraphQLTool, # noqa: F401
)
from langchain_community.tools.human.tool import (
HumanInputRun, # noqa: F401
)
from langchain_community.tools.ifttt import (
IFTTTWebhook, # noqa: F401
)
from langchain_community.tools.interaction.tool import (
StdInInquireTool, # noqa: F401
)
from langchain_community.tools.jira.tool import (
JiraAction, # noqa: F401
)
from langchain_community.tools.json.tool import (
JsonGetValueTool, # noqa: F401
JsonListKeysTool, # noqa: F401
)
from langchain_community.tools.merriam_webster.tool import (
MerriamWebsterQueryRun, # noqa: F401
)
from langchain_community.tools.metaphor_search import (
MetaphorSearchResults, # noqa: F401
)
from langchain_community.tools.nasa.tool import (
NasaAction, # noqa: F401
)
from langchain_community.tools.office365.create_draft_message import (
O365CreateDraftMessage, # noqa: F401
)
from langchain_community.tools.office365.events_search import (
O365SearchEvents, # noqa: F401
)
from langchain_community.tools.office365.messages_search import (
O365SearchEmails, # noqa: F401
)
from langchain_community.tools.office365.send_event import (
O365SendEvent, # noqa: F401
)
from langchain_community.tools.office365.send_message import (
O365SendMessage, # noqa: F401
)
from langchain_community.tools.office365.utils import (
authenticate, # noqa: F401
)
from langchain_community.tools.openapi.utils.api_models import (
APIOperation, # noqa: F401
)
from langchain_community.tools.openapi.utils.openapi_utils import (
OpenAPISpec, # noqa: F401
)
from langchain_community.tools.openweathermap.tool import (
OpenWeatherMapQueryRun, # noqa: F401
)
from langchain_community.tools.playwright import (
ClickTool, # noqa: F401
CurrentWebPageTool, # noqa: F401
ExtractHyperlinksTool, # noqa: F401
ExtractTextTool, # noqa: F401
GetElementsTool, # noqa: F401
NavigateBackTool, # noqa: F401
NavigateTool, # noqa: F401
)
from langchain_community.tools.plugin import (
AIPluginTool, # noqa: F401
)
from langchain_community.tools.polygon.aggregates import (
PolygonAggregates, # noqa: F401
)
from langchain_community.tools.polygon.financials import (
PolygonFinancials, # noqa: F401
)
from langchain_community.tools.polygon.last_quote import (
PolygonLastQuote, # noqa: F401
)
from langchain_community.tools.polygon.ticker_news import (
PolygonTickerNews, # noqa: F401
)
from langchain_community.tools.powerbi.tool import (
InfoPowerBITool, # noqa: F401
ListPowerBITool, # noqa: F401
QueryPowerBITool, # noqa: F401
)
from langchain_community.tools.pubmed.tool import (
PubmedQueryRun, # noqa: F401
)
from langchain_community.tools.reddit_search.tool import (
RedditSearchRun, # noqa: F401
RedditSearchSchema, # noqa: F401
)
from langchain_community.tools.requests.tool import (
BaseRequestsTool, # noqa: F401
RequestsDeleteTool, # noqa: F401
RequestsGetTool, # noqa: F401
RequestsPatchTool, # noqa: F401
RequestsPostTool, # noqa: F401
RequestsPutTool, # noqa: F401
)
from langchain_community.tools.scenexplain.tool import (
SceneXplainTool, # noqa: F401
)
from langchain_community.tools.searchapi.tool import (
SearchAPIResults, # noqa: F401
SearchAPIRun, # noqa: F401
)
from langchain_community.tools.searx_search.tool import (
SearxSearchResults, # noqa: F401
SearxSearchRun, # noqa: F401
)
from langchain_community.tools.shell.tool import (
ShellTool, # noqa: F401
)
from langchain_community.tools.slack.get_channel import (
SlackGetChannel, # noqa: F401
)
from langchain_community.tools.slack.get_message import (
SlackGetMessage, # noqa: F401
)
from langchain_community.tools.slack.schedule_message import (
SlackScheduleMessage, # noqa: F401
)
from langchain_community.tools.slack.send_message import (
SlackSendMessage, # noqa: F401
)
from langchain_community.tools.sleep.tool import (
SleepTool, # noqa: F401
)
from langchain_community.tools.spark_sql.tool import (
BaseSparkSQLTool, # noqa: F401
InfoSparkSQLTool, # noqa: F401
ListSparkSQLTool, # noqa: F401
QueryCheckerTool, # noqa: F401
QuerySparkSQLTool, # noqa: F401
)
from langchain_community.tools.sql_database.tool import (
BaseSQLDatabaseTool, # noqa: F401
InfoSQLDatabaseTool, # noqa: F401
ListSQLDatabaseTool, # noqa: F401
QuerySQLCheckerTool, # noqa: F401
QuerySQLDataBaseTool, # noqa: F401
)
from langchain_community.tools.stackexchange.tool import (
StackExchangeTool, # noqa: F401
)
from langchain_community.tools.steam.tool import (
SteamWebAPIQueryRun, # noqa: F401
)
from langchain_community.tools.steamship_image_generation import (
SteamshipImageGenerationTool, # noqa: F401
)
from langchain_community.tools.vectorstore.tool import (
VectorStoreQATool, # noqa: F401
VectorStoreQAWithSourcesTool, # noqa: F401
)
from langchain_community.tools.wikipedia.tool import (
WikipediaQueryRun, # noqa: F401
)
from langchain_community.tools.wolfram_alpha.tool import (
WolframAlphaQueryRun, # noqa: F401
)
from langchain_community.tools.yahoo_finance_news import (
YahooFinanceNewsTool, # noqa: F401
)
from langchain_community.tools.you.tool import (
YouSearchTool, # noqa: F401
)
from langchain_community.tools.youtube.search import (
YouTubeSearchTool, # noqa: F401
)
from langchain_community.tools.zapier.tool import (
ZapierNLAListActions, # noqa: F401
ZapierNLARunAction, # noqa: F401
)
__all__ = [
"AINAppOps",
"AINOwnerOps",
"AINRuleOps",
"AINTransfer",
"AINValueOps",
"AIPluginTool",
"APIOperation",
"ArxivQueryRun",
"AzureAiServicesDocumentIntelligenceTool",
"AzureAiServicesImageAnalysisTool",
"AzureAiServicesSpeechToTextTool",
"AzureAiServicesTextAnalyticsForHealthTool",
"AzureAiServicesTextToSpeechTool",
"AzureCogsFormRecognizerTool",
"AzureCogsImageAnalysisTool",
"AzureCogsSpeech2TextTool",
"AzureCogsText2SpeechTool",
"AzureCogsTextAnalyticsHealthTool",
"BaseGraphQLTool",
"BaseRequestsTool",
"BaseSQLDatabaseTool",
"BaseSparkSQLTool",
"BaseTool",
"BearlyInterpreterTool",
"BingSearchResults",
"BingSearchRun",
"BraveSearch",
"ClickTool",
"CogniswitchKnowledgeRequest",
"CogniswitchKnowledgeSourceFile",
"CogniswitchKnowledgeSourceURL",
"CogniswitchKnowledgeStatus",
"ConneryAction",
"CopyFileTool",
"CurrentWebPageTool",
"DeleteFileTool",
"DuckDuckGoSearchResults",
"DuckDuckGoSearchRun",
"E2BDataAnalysisTool",
"EdenAiExplicitImageTool",
"EdenAiObjectDetectionTool",
"EdenAiParsingIDTool",
"EdenAiParsingInvoiceTool",
"EdenAiSpeechToTextTool",
"EdenAiTextModerationTool",
"EdenAiTextToSpeechTool",
"EdenaiTool",
"ElevenLabsText2SpeechTool",
"ExtractHyperlinksTool",
"ExtractTextTool",
"FileSearchTool",
"GetElementsTool",
"GmailCreateDraft",
"GmailGetMessage",
"GmailGetThread",
"GmailSearch",
"GmailSendMessage",
"GoogleCloudTextToSpeechTool",
"GooglePlacesTool",
"GoogleSearchResults",
"GoogleSearchRun",
"GoogleSerperResults",
"GoogleSerperRun",
"HumanInputRun",
"IFTTTWebhook",
"InfoPowerBITool",
"InfoSQLDatabaseTool",
"InfoSparkSQLTool",
"JiraAction",
"JsonGetValueTool",
"JsonListKeysTool",
"ListDirectoryTool",
"ListPowerBITool",
"ListSQLDatabaseTool",
"ListSparkSQLTool",
"MerriamWebsterQueryRun",
"MetaphorSearchResults",
"MoveFileTool",
"NasaAction",
"NavigateBackTool",
"NavigateTool",
"O365CreateDraftMessage",
"O365SearchEmails",
"O365SearchEvents",
"O365SendEvent",
"O365SendMessage",
"OpenAPISpec",
"OpenWeatherMapQueryRun",
"PolygonAggregates",
"PolygonFinancials",
"PolygonLastQuote",
"PolygonTickerNews",
"PubmedQueryRun",
"QueryCheckerTool",
"QueryPowerBITool",
"QuerySQLCheckerTool",
"QuerySQLDataBaseTool",
"QuerySparkSQLTool",
"ReadFileTool",
"RedditSearchRun",
"RedditSearchSchema",
"RequestsDeleteTool",
"RequestsGetTool",
"RequestsPatchTool",
"RequestsPostTool",
"RequestsPutTool",
"SceneXplainTool",
"SearchAPIResults",
"SearchAPIRun",
"SearxSearchResults",
"SearxSearchRun",
"ShellTool",
"SlackGetChannel",
"SlackGetMessage",
"SlackScheduleMessage",
"SlackSendMessage",
"SleepTool",
"StackExchangeTool",
"StdInInquireTool",
"SteamWebAPIQueryRun",
"SteamshipImageGenerationTool",
"StructuredTool",
"Tool",
"VectorStoreQATool",
"VectorStoreQAWithSourcesTool",
"WikipediaQueryRun",
"WolframAlphaQueryRun",
"WriteFileTool",
"YahooFinanceNewsTool",
"YouSearchTool",
"YouTubeSearchTool",
"ZapierNLAListActions",
"ZapierNLARunAction",
"authenticate",
"format_tool_to_openai_function",
"tool",
]
# Used for internal purposes
_DEPRECATED_TOOLS = {"PythonAstREPLTool", "PythonREPLTool"}