Source code for langchain_community.agent_toolkits.office365.toolkit

from __future__ import annotations

from typing import TYPE_CHECKING, List

from langchain_core.pydantic_v1 import Field
from langchain_core.tools import BaseToolkit

from langchain_community.tools import BaseTool
from langchain_community.tools.office365.create_draft_message import (
    O365CreateDraftMessage,
)
from langchain_community.tools.office365.events_search import O365SearchEvents
from langchain_community.tools.office365.messages_search import O365SearchEmails
from langchain_community.tools.office365.send_event import O365SendEvent
from langchain_community.tools.office365.send_message import O365SendMessage
from langchain_community.tools.office365.utils import authenticate

if TYPE_CHECKING:
    from O365 import Account


[docs]class O365Toolkit(BaseToolkit): """与Office 365交互的工具包。 *安全提示*: 此工具包包含可以读取和修改服务状态的工具; 例如,通过读取、创建、更新、删除与该服务相关联的数据。 例如,此工具包可用于搜索电子邮件和事件、发送消息和事件邀请以及创建草稿消息。 请确保此工具包授予的权限适合您的用例。 有关更多信息,请参见 https://python.langchain.com/docs/security。""" account: Account = Field(default_factory=authenticate) class Config: """Pydantic配置。""" arbitrary_types_allowed = True
[docs] def get_tools(self) -> List[BaseTool]: """获取工具包中的工具。""" return [ O365SearchEvents(), O365CreateDraftMessage(), O365SearchEmails(), O365SendEvent(), O365SendMessage(), ]