-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Outlook integration toolkit #3465
base: main
Are you sure you want to change the base?
Conversation
1. outlookintegration.ts created 2. implement outlook api for read and send message 3. export the function to index.ts
Add description, name, and _call()
outlook getMessageTips integrated
…ase tool, auth using authFlowREST
…thFlowREST, resolved user login many times when agent call tool many times
…e, improve readMail, add test
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -0,0 +1,189 @@ | |||
import * as http from "http"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR adds a new HTTP request using the fetch
function in the getAccessToken
and refreshAccessToken
methods. This comment is flagging the change for maintainers to review.
@@ -0,0 +1,189 @@ | |||
import * as http from "http"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR adds code that explicitly accesses and reads environment variables via the getEnvironmentVariable
function, which should be reviewed by maintainers to ensure proper handling and usage of environment variables.
@@ -0,0 +1,103 @@ | |||
import { AuthFlowBase } from "./authFlowBase.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR introduces a new fetch request in the AuthFlowRefresh
class to refresh the access token using the refresh token. This comment is flagging the change for maintainers to review the addition of this new request.
@@ -0,0 +1,103 @@ | |||
import { AuthFlowBase } from "./authFlowBase.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work on the PR! I've flagged a change in the code that requires an environment variable using the getEnvironmentVariable
function. Please review this change to ensure it aligns with the project's requirements.
@@ -0,0 +1,66 @@ | |||
import { OutlookBase } from "./base.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR introduces a new external HTTP request using fetch
to fetch emails from the Microsoft Graph API. Please review this change to ensure it aligns with the project's requirements and best practices.
@@ -0,0 +1,87 @@ | |||
import { OutlookBase } from "./base.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is flagging the addition of a new external HTTP request using the fetch
function to send an email via the Microsoft Graph API. Please review this change to ensure it aligns with the project's requirements and best practices.
Hello Jacob, it looks like it is still pending approval, can you give the approval when you have time? Thank you so much! |
|
||
```typescript | ||
import { ChatOpenAI } from "langchain/chat_models/openai"; | ||
import { initializeAgentExecutorWithOptions } from "langchain/agents"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We deprecated this method in favor of createOpenAIFunctionsAgent
:
https://js.langchain.com/docs/modules/agents/agent_types/openai_functions_agent
Do you mind also putting this in the examples/
folder and importing it in a code block so that it gets linted?
or put them in the environment. | ||
|
||
```typescript | ||
import { AuthFlowREST } from "@langchain/community/tools/outlook"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So someone needs to run this script beforehand?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, if he doesn't have the tokens.
My take is that this is all just far too complicated to set up but I suppose there's no other way to authenticate? No concept of just an API key? |
I also think it is very complicated to set up. I think the "api key" you want is the accessToken, but it is hard to get (can't just copy from the web like the openai key). So I implemented the authFlowREST class to the get the key, but then another problem is the token expires quickly (1 hour). That's why I implemented authFlowRefresh to auto refresh the token. From my understanding of the Microsoft docs, there's no other way. |
Fixes # 3005 issue
Description: Added basic tools to interact with Microsoft Graph Api that can send or read user's emails. Classes to complete the authentication flows are also added to perform user login or provide accessToken that must be used for Microsoft Graph.
Issue: #3005
Dependencies: openurl package is used during user log in
Tag maintainer: @jacoblee93 , and any of the other maintainers if needed
Hello,
This is our first PR and we hope that our changes will be helpful to the community. We have run make format, make lint and make test locally before submitting the PR. To our knowledge, our changes do not introduce any new errors.
Our PR has added basic tools to interact with Microsoft Graph Api that can send or read user's emails. Classes to complete the authentication flows are also added to perform user login or provide accessToken that must be used for Microsoft Graph. Nonetheless, we have added tests to test our changes, note the test is dependent on the necessary credentials in .env . These changes were put together by me, @oscarchen178, @Qi123123Li, and @SimonLi1020 We're a group of students from UofT submitting this for a project. Please test the code and let us know if there are any issues.
Thank you in advance to the maintainers for their time.