feat(go/plugins/anthropic): support native structured output#4701
feat(go/plugins/anthropic): support native structured output#4701hugoaguirre wants to merge 8 commits intomainfrom
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 native support for structured JSON output when interacting with Anthropic models. By leveraging Anthropic's tool use capabilities, it allows developers to specify a JSON schema for the desired output, ensuring that model responses adhere to a predefined structure. This enhancement streamlines the integration of Anthropic models into applications that require reliable and parseable data formats, improving developer experience and reducing post-processing efforts. 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
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 adds support for native structured output in the Anthropic Go plugin. The changes look good overall. I've identified a few areas for improvement:
- Error Handling: There's a place where an error from
json.Marshalis ignored, which could lead to silent failures. - Maintainability: There's some duplicated code for checking structured output conditions and a hardcoded string that could be extracted into a constant.
- Testing: The new test for structured output could be more robust in its schema verification.
I've left specific comments with suggestions for these points.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request adds support for native structured output to the Anthropic Go plugin by leveraging the OutputConfig feature in the updated Anthropic SDK. The changes include updating the model capabilities, modifying the request creation to use OutputConfig for constrained JSON output, and making tool schemas stricter. New live tests have been added to verify the structured output functionality in both regular and streaming modes.
My review focuses on improving code maintainability by reducing duplication in tests, enhancing the robustness of the schema enforcement logic, and correcting a unit test that was verifying an outdated implementation pattern. Overall, this is a great feature addition.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request adds support for native structured output in the Anthropic Go plugin. The changes include updating the Anthropic SDK, modifying the model capabilities to declare support for constrained generation, and implementing the logic to use Anthropic's OutputConfig for structured output requests. New live tests have been added to verify this functionality for both streaming and non-streaming cases. The implementation looks solid, but I've identified a couple of areas where in-place modification of schemas could lead to side effects, and a minor redundancy in a test case.
Checklist (if applicable):