Repository navigation
fix: drop unsupported JSON Schema format from tool parameters (422) - #4
Open
PetrIIvanov wants to merge 1 commit into
Open
PetrIIvanov wants to merge 1 commit into
PetrIIvanov wants to merge 1 commit into
Conversation
GigaChat API only accepts format 'date', 'date-time' or 'time'. Other JSON Schema formats such as 'uri' (used by webfetch tool schemas) cause the API to reject the request with 422 INVALID_PARAMS. sanitizeFunctionParameters now filters out any format value outside the allowed set.
Author
|
Локальная проверка (Node 20, эквивалент всех шагов CI):
Воспроизведение бага: GigaChat-API возвращал Фикс в |
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.
Problem
GigaChat API only accepts
formatvaluesdate,date-timeortime. opencode sends tool schemas (e.g. webfetch) withformat: "uri", which makes the API reject the whole request with422 INVALID_PARAMSbefore any response is produced.Fix
sanitizeFunctionParametersinsrc/plugin/tools.tsnow filters out anyformatvalue outside the allowed set, so unsupported formats are dropped from the schema instead of failing the request.Tests
Added a unit test covering that
format: "uri"is dropped whiledate/date-time/timeare preserved. All 77 tests pass.Fixes the GigaChat Translation Proxy Error
422 (Value properties.url.format must be one of: date, date-time, time).