-
Notifications
You must be signed in to change notification settings - Fork 812
simplify edit notebook tool and add google tool schema cleanup #7228
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
2ca82a1 to
74ee2aa
Compare
| "properties": tool.parameters.get("properties", {}), | ||
| "required": tool.parameters.get("required", []), | ||
| }, | ||
| "parameters": _clean_google_parameters( |
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 would be great to enforce this at build/test time instead of at runtime
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.
Yeah.., because it's a frontend tool, I'm not sure how we can test the zod schema against this. Do you have ideas?
Another option is to review the source code for gemini tools to only include allowed keys.
edit: I can check this
## 📝 Summary <!-- Provide a concise summary of what this pull request is addressing. If this PR fixes any issues, list them here by number (e.g., Fixes #123). --> ## 🔍 Description of Changes <!-- Detail the specific changes made in this pull request. Explain the problem addressed and how it was resolved. If applicable, provide before and after comparisons, screenshots, or any relevant details to help reviewers understand the changes easily. --> ## 📋 Checklist - [x] I have read the [contributor guidelines](https://github.com/marimo-team/marimo/blob/main/CONTRIBUTING.md). - [ ] For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on [Discord](https://marimo.io/discord?ref=pr), or the community [discussions](https://github.com/marimo-team/marimo/discussions) (Please provide a link if applicable). - [x] I have added tests for the changes made. - [x] I have run the code and verified that it works as expected.
📝 Summary
The motivation to clean up the edit notebook tool is that discriminated unions are more verbose in context size:
tool schema parameters with discriminated union
after simplifying
However, the google tools spec is still quite restrictive, even with the cleaned up edit notebook tool. So I implemented a thin wrapper inspired by #7211 on the backend to make sure schemas are compliant.
🔍 Description of Changes
📋 Checklist