Fixed Office365 tool __init__.py files, tests, and get_tools() function (#7046)

## Description
Added Office365 tool modules to `__init__.py` files
## Issue
As described in Issue
https://github.com/hwchase17/langchain/issues/6936, the Office365
toolkit can't be loaded easily because it is not included in the
`__init__.py` files.
## Reviewer
@dev2049
This commit is contained in:
Santiago Delgado
2023-07-05 14:46:21 -05:00
committed by GitHub
parent 8a7c95e555
commit fa55c5a16b
5 changed files with 31 additions and 6 deletions

View File

@@ -55,6 +55,12 @@ _EXPECTED = [
"MoveFileTool",
"NavigateBackTool",
"NavigateTool",
"O365SearchEmails",
"O365SearchEvents",
"O365CreateDraftMessage",
"O365SendMessage",
"O365SendEvent",
"authenticate",
"OpenAPISpec",
"OpenWeatherMapQueryRun",
"PubmedQueryRun",

View File

@@ -9,11 +9,16 @@ import pytest
from langchain.tools.base import BaseTool
from langchain.tools.gmail.base import GmailBaseTool
from langchain.tools.office365.base import O365BaseTool
from langchain.tools.playwright.base import BaseBrowserTool
def get_non_abstract_subclasses(cls: Type[BaseTool]) -> List[Type[BaseTool]]:
to_skip = {BaseBrowserTool, GmailBaseTool} # Abstract but not recognized
to_skip = {
BaseBrowserTool,
GmailBaseTool,
O365BaseTool,
} # Abstract but not recognized
subclasses = []
for subclass in cls.__subclasses__():
if (