feat(go/ai): added DefineMiddleware (Middleware V2)#4464
feat(go/ai): added DefineMiddleware (Middleware V2)#4464
DefineMiddleware (Middleware V2)#4464Conversation
Summary of ChangesHello @apascal07, 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 enhances the extensibility of the AI generation pipeline by introducing a comprehensive middleware system. It moves beyond simple model-level interception to offer granular control over the entire generation lifecycle, including tool usage and the iterative generation loop. This change provides a powerful mechanism for developers to inject custom logic, such as logging, metrics, or content filtering, at various critical points within the AI workflow, making the system more adaptable and observable. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
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.
Code Review
This pull request introduces a new, more powerful Middleware system for Go, which is a great enhancement. It adds hooks for Generate, Model, and Tool execution stages, deprecating the older ModelMiddleware. The implementation is solid and includes good test coverage. I've identified one bug related to data loss in tool responses and an opportunity to deduplicate some code. Overall, this is a well-executed feature.
MiddlewareMiddleware
MiddlewareDefineMiddleware (Middleware V2)
Checklist (if applicable):