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

Add Gmail Thread Tools #159

Merged
merged 3 commits into from
Nov 20, 2024
Merged

Add Gmail Thread Tools #159

merged 3 commits into from
Nov 20, 2024

Conversation

EricGustin
Copy link
Contributor

PR Description

  1. This PR adds three new tools:
    • GetThread (by ID)
    • ListThreads
    • SearchThreads
  2. This PR updates the return type for various Gmail tools from str to dict.
  3. This PR adds evals and tests for the added tools

@EricGustin EricGustin changed the title Gmail Thread Tools Add Gmail Thread Tools Nov 19, 2024
@EricGustin EricGustin requested a review from a team November 19, 2024 23:20
@nbarbettini nbarbettini requested review from nbarbettini and removed request for a team November 20, 2024 17:46

emails = process_messages(service, messages)
return json.dumps({"emails": emails})
return {"emails": emails}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for dumping dumps!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

💩

Comment on lines +349 to +350
page_token: Annotated[
Optional[str], "Page token to retrieve a specific page of results in the list"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Q: Do we want to expose page_token to the LLM? It looks like it's used internally by our function to paginate up to max_results. Thinking out loud, I guess if the LLM specified a page token, it would start at that page and then continue up to max_results?

Copy link
Contributor Author

@EricGustin EricGustin Nov 20, 2024

Choose a reason for hiding this comment

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

I had this same debate myself. Ultimately I decided to leave it in, but I'm interested in what you think about the pros/cons that I weighed during that decision:

Pros

The following type of interaction is impossible without the page_token param:

User: "list 10 threads"
Assistant: "here are the 10 threads..."
User: "list the next 5 threads"

Cons

  1. more tokens to define the tool schema for a parameter that will likely not be needed most of the time
  2. Gives the LLM the opportunity to hallucinate the page_token param when using the LLM api. I did not see this happen during my testing, but that's not to say it couldn't happen!

"from": headers.get("from", ""),
"date": headers.get("date", ""),
"subject": headers.get("subject", "No subject"),
"subject": headers.get("subject", ""),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good change, ideally we don't insert many of these "interpretations" ourselves 👍

@nbarbettini
Copy link
Collaborator

nbarbettini commented Nov 20, 2024 via email

@EricGustin EricGustin merged commit 2798cc0 into main Nov 20, 2024
4 checks passed
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.

2 participants