Skip to content
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

Google Calender Tool Added #1510

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

VedantS20
Copy link
Contributor

Added Google Calender Tool which does the basic functionalities such as

  • Getting The list of events from a certain date and time
  • Scheduling Events

This Fixes #1332 @manthanguptaa

I want to add few more functionalities which will need some more time .

  • Creating Recurring Events
  • Adding conference-related information, such as details of a Google Meet conference. in an event
  • Deleting / Updating a certain event
  • Managing User's Multiple Calenders, currently every action is getting performed on user's primary calender

)
raise ValueError("Credentials Path is invalid")

if not token_path:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

User authentication data is saved to a shared space, and everyone else will have access to someone else's calendar

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for raising this concern! I’d like to clarify that in current setup I'm assuming each user operates within their own deployment, and the token.json file is stored locally within the deployment environment. I’m not entirely sure about the specifics of how deployments and storage are handled in the current PhiData app setup. I would love to get input from the maintainers here to ensure we’re following best practices for securely handling credentials.

If there’s a recommended approach for isolating tokens or managing user-specific authentication, I’m happy to implement that.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the use of user_id examples. If the token will be stored as “{user_id}_token”, this will be enough for the first version.

The best way might be to use user storage, but that's a bit more complex.

cookbook/tools/googlecalender_tools.py Outdated Show resolved Hide resolved
cookbook/tools/googlecalender_tools.py Outdated Show resolved Hide resolved
tools=[GoogleCalenderTools(credentials_path="<PATH_TO_YOUR_CREDENTIALS_FILE>")],
show_tool_calls=True,
instructions=[GOOGLE_CALENDER_INSTRUCTION],
provider=MistralChat(api_key=os.getenv("MISTRAL_API_KEY")),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should automatically extract the MISTRAL_API_KEY in the MistralChat

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently api_key in Mistral Chat is an optional Parameter with Default value as None .
But you're correct ideally, it should take value from MISTRAL_API_KEY variable .

image

phi/tools/googlecalender.py Outdated Show resolved Hide resolved
@VedantS20 VedantS20 requested review from dirkbrnd and Romamo December 23, 2024 05:10
@gabfssilva
Copy link

this one is quite nice. just one thing: it's calendar, not calender.

@VedantS20
Copy link
Contributor Author

Ah, my bad! 😅 Thanks for catching that @gabfssilva —I'll fix it to 'calendar' right away.

@willemcdejongh
Copy link

Hey @VedantS20 Great work on this!
We want to get this merged soon. I was able to test the cookbook. All looked good and the instructions were clear enough to go through the setup. I did however encounter some issues with read only permissions to the default token_path = f"{os.path.dirname(credentials_path)}/token.json" path. Perhaps you could extend the instructions slightly to better explain this file and its usage. I found that just passing the path explicitly resolved all the issues
token_path="token.json"

@willemcdejongh
Copy link

Hi @VedantS20 Thank you for the updates. Will get this tested today 👍

@VedantS20
Copy link
Contributor Author

Thank you @willemcdejongh for pointing this out. defaulting the token.json file to the directory of the credentials_path can lead to issues in environments with read-only permissions. for now, I have kept the default location as the current working directory . This will work for most cases. I’ll also look into improving the default behavior by using platform-specific writable directories .
I have updated the cookbook which explains the usage of the token_path parameter.

@willemcdejongh
Copy link

@VedantS20 Please rebase onto main. We have already merged a part of this earlier this week. So its only these final updates of yours that need to get merged.

@VedantS20
Copy link
Contributor Author

Hey @willemcdejongh , can you please guide me through the process ? . I noticed that my earlier changes are not present in the main branch. Could you clarify which parts were merged earlier?

@willemcdejongh
Copy link

@VedantS20 I am wrong. It was not merged. You can just rebase your branch please and make sure there are no conflicts.

@VedantS20
Copy link
Contributor Author

Hey @willemcdejongh , While rebasing I'm getting Conflicts in the file cookbook/tools/linear_tools.py and phi/tools/linear_tools.py which I didn’t directly work on. I don’t have the full context for the changes in these files, so I’d like your input to ensure we resolve them correctly. Let me know how I should proceed.

@willemcdejongh
Copy link

Hey @VedantS20 I don't see any merge conflicts. I checked your branch, pulled all the latest changes for it and main. And was able to succesfully rebase with git rebase origin/main
Let me know if you don't manage to get it fixed then I can push the changes from my side. But would be good if you could also resolve from your side to confirm.

@VedantS20
Copy link
Contributor Author

my bad @willemcdejongh , my fork was not synced , I'll do the rebasing

@VedantS20
Copy link
Contributor Author

@willemcdejongh I accidentally synced my feature branch with main instead of syncing my fork's main branch ;( . Should I reset my branch and rebase onto the latest main?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Google Calendar as a tool
7 participants