mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-25 08:03:39 +00:00
Signed-off-by: ChengZi <chen.zhang@zilliz.com> Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com> Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com> Co-authored-by: Dan O'Donovan <dan.odonovan@gmail.com> Co-authored-by: Tom Daniel Grande <tomdgrande@gmail.com> Co-authored-by: Grande <Tom.Daniel.Grande@statsbygg.no> Co-authored-by: Bagatur <baskaryan@gmail.com> Co-authored-by: ccurme <chester.curme@gmail.com> Co-authored-by: Harrison Chase <hw.chase.17@gmail.com> Co-authored-by: Tomaz Bratanic <bratanic.tomaz@gmail.com> Co-authored-by: ZhangShenao <15201440436@163.com> Co-authored-by: Friso H. Kingma <fhkingma@gmail.com> Co-authored-by: ChengZi <chen.zhang@zilliz.com> Co-authored-by: Nuno Campos <nuno@langchain.dev> Co-authored-by: Morgante Pell <morgantep@google.com>
56 lines
1.8 KiB
Python
56 lines
1.8 KiB
Python
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING, List
|
|
|
|
from langchain_core.tools import BaseTool
|
|
from langchain_core.tools.base import BaseToolkit
|
|
from pydantic import ConfigDict, Field
|
|
|
|
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
|
|
|
|
|
|
class O365Toolkit(BaseToolkit):
|
|
"""Toolkit for interacting with Office 365.
|
|
|
|
*Security Note*: This toolkit contains tools that can read and modify
|
|
the state of a service; e.g., by reading, creating, updating, deleting
|
|
data associated with this service.
|
|
|
|
For example, this toolkit can be used search through emails and events,
|
|
send messages and event invites, and create draft messages.
|
|
|
|
Please make sure that the permissions given by this toolkit
|
|
are appropriate for your use case.
|
|
|
|
See https://python.langchain.com/docs/security for more information.
|
|
|
|
Parameters:
|
|
account: Optional. The Office 365 account. Default is None.
|
|
"""
|
|
|
|
account: Account = Field(default_factory=authenticate)
|
|
|
|
model_config = ConfigDict(
|
|
arbitrary_types_allowed=True,
|
|
)
|
|
|
|
def get_tools(self) -> List[BaseTool]:
|
|
"""Get the tools in the toolkit."""
|
|
return [
|
|
O365SearchEvents(),
|
|
O365CreateDraftMessage(),
|
|
O365SearchEmails(),
|
|
O365SendEvent(),
|
|
O365SendMessage(),
|
|
]
|