fix(translator): drop JSON Schema keywords Gemini has no field for
Tool schemas carrying uniqueItems, contains, multipleOf, unevaluatedProperties, unevaluatedItems, or contentSchema get rejected by the Gemini API with "Unknown name ...: Cannot find field", failing the whole request. Add them to UNSUPPORTED_SCHEMA_CONSTRAINTS alongside the existing stripped keywords (minItems, maxItems, format, ...).
This commit is contained in:
@@ -7,7 +7,13 @@ import { OPENAI_BLOCK } from "../schema/index.js";
|
||||
export const UNSUPPORTED_SCHEMA_CONSTRAINTS = [
|
||||
// Basic constraints (not supported by Gemini API)
|
||||
"minLength", "maxLength", "exclusiveMinimum", "exclusiveMaximum",
|
||||
"minItems", "maxItems", "format",
|
||||
"minItems", "maxItems", "format", "multipleOf",
|
||||
// Array keywords the Gemini schema proto has no field for. Agent tool
|
||||
// schemas set these routinely, and one occurrence rejects the whole request
|
||||
// with "Unknown name ...: Cannot find field".
|
||||
"uniqueItems", "contains",
|
||||
// 2020-12 keywords with no Gemini equivalent
|
||||
"unevaluatedProperties", "unevaluatedItems", "contentSchema",
|
||||
// Claude rejects these in VALIDATED mode
|
||||
"default", "examples",
|
||||
// JSON Schema meta keywords
|
||||
|
||||
Reference in New Issue
Block a user