-
Notifications
You must be signed in to change notification settings - Fork 15.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: update integration api refs (#25195)
- [x] toolkits - [x] retrievers (in this repo)
- Loading branch information
Showing
11 changed files
with
675 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,9 +39,81 @@ class GmailToolkit(BaseToolkit): | |
See https://python.langchain.com/docs/security for more information. | ||
Setup: | ||
You will need a Google credentials.json file to use this toolkit. | ||
See instructions here: https://python.langchain.com/v0.2/docs/integrations/tools/gmail/#setup | ||
Key init args: | ||
api_resource: Optional. The Google API resource. Default is None. | ||
Instantiate: | ||
.. code-block:: python | ||
from langchain_google_community import GmailToolkit | ||
toolkit = GmailToolkit() | ||
Tools: | ||
.. code-block:: python | ||
toolkit.get_tools() | ||
.. code-block:: none | ||
[GmailCreateDraft(api_resource=<googleapiclient.discovery.Resource object at 0x1094509d0>), | ||
GmailSendMessage(api_resource=<googleapiclient.discovery.Resource object at 0x1094509d0>), | ||
GmailSearch(api_resource=<googleapiclient.discovery.Resource object at 0x1094509d0>), | ||
GmailGetMessage(api_resource=<googleapiclient.discovery.Resource object at 0x1094509d0>), | ||
GmailGetThread(api_resource=<googleapiclient.discovery.Resource object at 0x1094509d0>)] | ||
Use within an agent: | ||
.. code-block:: python | ||
from langchain_openai import ChatOpenAI | ||
from langgraph.prebuilt import create_react_agent | ||
llm = ChatOpenAI(model="gpt-4o-mini") | ||
agent_executor = create_react_agent(llm, tools) | ||
example_query = "Draft an email to [email protected] thanking them for coffee." | ||
events = agent_executor.stream( | ||
{"messages": [("user", example_query)]}, | ||
stream_mode="values", | ||
) | ||
for event in events: | ||
event["messages"][-1].pretty_print() | ||
.. code-block:: none | ||
================================[1m Human Message [0m================================= | ||
Draft an email to [email protected] thanking them for coffee. | ||
==================================[1m Ai Message [0m================================== | ||
Tool Calls: | ||
create_gmail_draft (call_slGkYKZKA6h3Mf1CraUBzs6M) | ||
Call ID: call_slGkYKZKA6h3Mf1CraUBzs6M | ||
Args: | ||
message: Dear Fake, | ||
I wanted to take a moment to thank you for the coffee yesterday. It was a pleasure catching up with you. Let's do it again soon! | ||
Best regards, | ||
[Your Name] | ||
to: ['[email protected]'] | ||
subject: Thank You for the Coffee | ||
=================================[1m Tool Message [0m================================= | ||
Name: create_gmail_draft | ||
Draft created. Draft Id: r-7233782721440261513 | ||
==================================[1m Ai Message [0m================================== | ||
I have drafted an email to [email protected] thanking them for the coffee. You can review and send it from your email draft with the subject "Thank You for the Coffee". | ||
Parameters: | ||
api_resource: Optional. The Google API resource. Default is None. | ||
""" | ||
""" # noqa: E501 | ||
|
||
api_resource: Resource = Field(default_factory=build_resource_service) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.