Commit 2401379
Fix Gemini schema validation by cleaning unsupported JSON Schema fields
Gemini's API uses a strict subset of JSON Schema and rejects:
- $schema field
- units (custom property field)
- title field
- definitions field
- $ref field
- other non-standard fields
Added cleanSchemaForGemini() function that filters the schema to only
include fields that Gemini accepts (type, properties, required,
description, items, enum, format, minimum, maximum, pattern, default).
This fixes the "Invalid JSON payload received. Unknown name" errors
when using tools with the --gemini flag in main-testai.go.
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>1 parent f6452f1 commit 2401379
1 file changed
Lines changed: 60 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
18 | 74 | | |
19 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
20 | 79 | | |
21 | 80 | | |
22 | 81 | | |
23 | | - | |
| 82 | + | |
24 | 83 | | |
25 | 84 | | |
26 | 85 | | |
| |||
0 commit comments