fix(cron): flatten schedule schema for Gemini tool compatibility#221
Open
bohuslav-broza wants to merge 1 commit intovirattt:mainfrom
Open
fix(cron): flatten schedule schema for Gemini tool compatibility#221bohuslav-broza wants to merge 1 commit intovirattt:mainfrom
bohuslav-broza wants to merge 1 commit intovirattt:mainfrom
Conversation
Gemini API (v1beta) does not support 'oneOf' or 'const' in function declarations. Replacing the discriminatedUnion with a flat object with optional fields ensures the generated JSON schema is compatible with Google's API while maintaining existing logic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Gemini API (v1beta) currently does not support
oneOforconstkeywords in tool function declarations. Usingz.discriminatedUnionin thecrontool's schema generates a JSON schema with these keywords, causing a400 Bad Request(Invalid JSON payload) during initialization when using Gemini models.Changes
scheduleSchemainsrc/tools/cron/cron-tool.tsfrom a discriminated union to a flat object with optional fields.at,everyMs,expr) to indicate their requirement based on the selectedkind.Impact
CronScheduleremains safe as the flat object is a superset of the possible union members).Error Reference