You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(#3996): reject incompatible image-output Google requests
Reject tools, built-in tools, and structured output before dispatch whenever image output resolves enabled on Google gateway, direct Gemini API, or Vertex AI. The guard uses the same binding capability policy as request construction: explicit false, then explicit true, then exact models.dev Modalities.Output=image for an omitted image flag; unknown or unavailable metadata stays off. It never guesses from model names.
Return fixed safe incompatibility classes, enrich custom-tool errors from models.dev tool_call metadata when available, and keep provider text, prompts, names, and schemas out of user-visible guard errors.
return"this model does not support tool calls; use a tool-capable model or remove tools from the request"
45
+
casemodelinfo.ToolCallSupported:
46
+
return"this model supports tool calls, but not while image output is enabled; use a separate model or request for that combination"
47
+
}
48
+
}
49
+
50
+
names:=make([]string, len(e.Incompatibilities))
51
+
fori, c:=rangee.Incompatibilities {
52
+
names[i] =string(c)
53
+
}
54
+
returnfmt.Sprintf(
55
+
"this model is configured for image output (output_capabilities.image) and does not support %s in the same request; use a separate model or request for that combination",
56
+
strings.Join(names, ", "),
57
+
)
58
+
}
59
+
60
+
// checkImageOutputRequestCompatibility rejects, before any provider dispatch,
61
+
// an incompatible request when image output is enabled by configuration or the
0 commit comments