-
Notifications
You must be signed in to change notification settings - Fork 610
feat(go/plugins/googlegenai): add multi-part tools support #3975
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
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @hugoaguirre, 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 introduces comprehensive support for multi-part tool responses within the Google GenAI plugin. This feature allows tools to provide richer and more diverse outputs, such as combining structured data with descriptive text or media, enhancing the interaction capabilities of AI models. The changes involve updating the underlying GenAI SDK, refining the internal data translation mechanisms to accommodate these new response types, and providing a practical example of how to define and utilize multi-part tools in a Genkit flow. 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 adds support for multi-part tool responses in the googlegenai plugin, which is a great feature enhancement. The changes involve updating the google.golang.org/genai dependency and modifying several files to handle the new data structures for multipart responses.
My review has identified a few issues:
- A potential bug in
go/ai/generate.gothat could corrupt message history by incorrectly appending all parts of an intermediate message instead of just the reasoning parts. - A leftover debug print statement in
go/plugins/googlegenai/gemini.go. - A broken test case in
go/plugins/googlegenai/gemini_test.gothat doesn't correctly test the new functionality. - A minor typo in the sample code in
go/samples/basic-gemini/main.go.
Please address these points to ensure the new feature is robust and the code is clean.
go/samples/basic-gemini/main.go
Outdated
| } | ||
|
|
||
| // Define a simple flow that uses the multipart tool | ||
| genkit.DefineStreamingFlow(g, "cardFlow", func(ctx context.Context, input InvitationCard, cb ai.ModelStreamCallback) ([]string, error) { |
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 doesn't generate anything for me. See for usage:
genkit/js/testapps/basic-gemini/src/index.ts
Line 307 in a4b330c
| ai.defineFlow( |
Put this in a new sample called multipart-tools.
| if p.Metadata == nil { | ||
| p.Metadata = make(map[string]any) | ||
| } | ||
| p.Metadata["signature"] = part.ThoughtSignature |
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.
@apascal07 Wanted to ask, is #3902 related to this signature handling for tool calls? or is it something else?
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.
It's for reasoning, it's a token that the model returns that must be propagated to subsequent calls in the conversation otherwise it will error.
No description provided.