Support rendering function calls and responses when sharing chat to markdown#8693
Support rendering function calls and responses when sharing chat to markdown#8693agmsb merged 2 commits intogoogle-gemini:mainfrom
Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @rramkumar1, 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 significantly improves the utility and readability of shared chat histories by extending the Markdown serialization feature. It ensures that complex interactions involving function calls and their subsequent responses are clearly represented, and introduces visual cues for chat participants, making the shared content more comprehensive and user-friendly.
Highlights
- Function Call and Response Rendering: The chat history serialization to Markdown now correctly renders function calls and their responses, presenting them as formatted JSON code blocks.
- Role Icons: Emoji icons (🧑💻 for user, ✨ for model) have been added to the Markdown output for chat roles, enhancing visual distinction.
- Test Coverage: New test cases have been introduced to validate the correct serialization of function calls and responses, and existing tests were updated to reflect the new icon formatting.
Using Gemini Code Assist
The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in pull request comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.
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
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request adds support for rendering function calls and responses when sharing a chat to markdown, and also introduces icons for user and model roles. The implementation is mostly correct, but I've identified a potential UX issue in how function responses are labeled in the markdown output. My review includes a suggestion to improve the clarity and accuracy of the generated markdown by using a 'tool' role for function responses instead of 'user'.
| const roleIcon = item.role === 'user' ? '🧑💻' : '✨'; | ||
| return `${roleIcon} **${item.role}**:\n\n${text}`; |
There was a problem hiding this comment.
While this correctly implements the feature according to the tests, labeling a functionResponse as coming from the user role in the markdown output can be misleading for the reader. A tool's response is not direct user input.
To improve clarity, I suggest we detect when a history item is a function response and label its role as tool in the output, perhaps with a corresponding icon like 🛠️. This provides a more accurate representation of the conversation flow.
Note that this change will require updating the corresponding test case in chatCommand.test.ts to expect 🛠️ **tool**: for function responses.
const isFunctionResponse =
item.parts?.length === 1 && !!item.parts[0].functionResponse;
if (isFunctionResponse) {
return `🛠️ **tool**:\n\n${text}`;
}
const roleIcon = item.role === 'user' ? '🧑💻' : '✨';
return `${roleIcon} **${item.role}**:\n\n${text}`;There was a problem hiding this comment.
Thanks for the suggestion, I can send a follow up PR for this later.
7b74f9c to
dbc0462
Compare
|
/assign @cornmander |
dbc0462 to
981ff55
Compare
|
@scidomino Are the e2e tests stuck or are they still running? |
5be2a9d
…arkdown (google-gemini#8693) Co-authored-by: Abhi <43648792+abhipatel12@users.noreply.github.com>
…arkdown (google-gemini#8693) Co-authored-by: Abhi <43648792+abhipatel12@users.noreply.github.com>
…s when sharing chat to markdown (google-gemini#8693)
…arkdown (google-gemini#8693) Co-authored-by: Abhi <43648792+abhipatel12@users.noreply.github.com>
TLDR
Support rendering function calls and responses when sharing chat to markdown and also add cool looking icons for the user and gemini roles.
Dive Deeper
This was not added in the initial implementation but is definitely a gap.
Reviewer Test Plan
Run
/chat share foo.mdand examine the outputs of the fileTesting Matrix
Linked issues / bugs
Resolves #8030