-
Notifications
You must be signed in to change notification settings - Fork 17
Add gmail:search top-level tool #47
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
Conversation
This change adds a new top-level tool `/gmail:search` to the gemini-cli. It creates a `commands/gmail/search.toml` file that defines the command and instructs the agent to use `gmail.search` and `gmail.get` to find and display emails.
Add gmail:search top-level tool
Summary of ChangesHello @raybellwaves, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request integrates a new Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces a new top-level tool, gmail:search, by adding a search.toml configuration file. This file contains a prompt that guides an AI to search for emails using the gmail.search and gmail.get tools. While the prompt structure is logical, I've identified a significant performance concern. The current instructions could lead to an excessive number of API calls if a search yields many results. My review includes a suggestion to modify the prompt to limit the number of fetched emails, improving efficiency and user experience. Given the author's note that this change has not been tested, I strongly recommend thorough testing before merging to ensure it functions as expected and to validate the fix for the performance issue.
| 2) Call the `gmail.search` tool, passing the user's query as the `query` argument. | ||
| 3) The `gmail.search` tool returns a JSON object containing a list of emails (id and threadId). | ||
| 4) For each email found, you MUST call `gmail.get` with the `messageId` and `format='metadata'` to get the From, Subject, and Snippet. | ||
| 5) Format the result into a clear, readable list. | ||
| 6) If no emails are found, state that clearly. |
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.
The current instructions can lead to performance issues. If a search query returns many results, the instruction in step 4 (For each email found, you MUST call 'gmail.get'...) will trigger a large number of subsequent API calls (an N+1 problem). This can result in slow responses and could potentially hit API rate limits.
To make this more efficient and provide a better user experience, I recommend explicitly limiting the number of results in the initial search and then informing the user if more results are available. The gmail.search tool returns a resultSizeEstimate which can be used for this.
2) Call the `gmail.search` tool, passing the user's query as the `query` argument and setting `maxResults` to 5.
3) The `gmail.search` tool returns a JSON object containing a list of emails (id and threadId) and a `resultSizeEstimate`.
4) For each email found, you MUST call `gmail.get` with the `messageId` and `format='metadata'` to get the From, Subject, and Snippet.
5) Format the result into a clear, readable list. If the `resultSizeEstimate` is greater than the number of emails shown, inform the user (e.g., "Showing 5 of 27 results.").
6) If no emails are found, state that clearly.
allenhutchison
left a comment
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.
Thanks for the contribution. I tested this on several different queries this afternoon and it performs well.
Closes #46 ???
Note: this was from Jules (raybellwaves#1)
Haven't build, haven't tested and haven't spend to the time to understand this repo. Therefore, merge at your peril.