-
Notifications
You must be signed in to change notification settings - Fork 281
feat(tool): add ToolSchemaModule to support @ToolParam parsing. #783
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
Change-Id: I28a2a15bba1b4a9773ec5e085b44afd6aa70cebb Co-developed-by: Cursor <[email protected]> Co-authored-by: Cursor <[email protected]>
Summary of ChangesHello @LearningGp, 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 JSON schema generation capabilities for tools by introducing a dedicated module to process custom Highlights
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.
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 ToolSchemaModule to enable parsing of @ToolParam annotations on POJO fields for JSON schema generation, which is a great feature. The implementation is clean and includes a comprehensive set of unit tests. My main feedback is to address an inconsistency where the name attribute of @ToolParam is ignored by this new module, unlike its handling for method parameters. I've provided a suggestion to align this behavior for better consistency and predictability.
agentscope-core/src/main/java/io/agentscope/core/tool/ToolSchemaModule.java
Show resolved
Hide resolved
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.
Pull request overview
This PR adds ToolSchemaModule to enable @ToolParam annotation support for POJO fields in JSON schema generation. This complements the existing Jackson annotation support and provides a consistent annotation approach for both tool method parameters and structured output POJO fields.
Changes:
- Introduces
ToolSchemaModulethat integrates with victools JSON schema generator to read@ToolParamannotations on POJO fields - Integrates the new module into
JsonSchemaUtilsto apply it globally to all schema generation - Adds comprehensive unit tests for the module covering all annotation scenarios
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| ToolSchemaModule.java | New module implementing victools Module interface to process @ToolParam annotations on POJO fields for description and required metadata |
| ToolSchemaModuleTest.java | Comprehensive unit tests covering annotated/unannotated fields, required/optional behavior, and edge cases |
| JsonSchemaUtils.java | Integrates ToolSchemaModule into the static schema generator configuration with PROPERTY_REQUIRED_FALSE_BY_DEFAULT option |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Change-Id: I3840c72af9d869783e5a9a57304ee2f872cf5b7a Co-developed-by: Cursor <[email protected]> Co-authored-by: Cursor <[email protected]>
AgentScope-Java Version
1.0.8
Description
feat(tool): add ToolSchemaModule to support @ToolParam parsing.
Checklist
Please check the following items before code is ready to be reviewed.
mvn spotless:applymvn test)