Skip to content

Commit 10d61fc

Browse files
authored
fix(vision): honor modelCapabilities text-only on native rows (#4501) (#4511)
1 parent 6d2e1af commit 10d61fc

2 files changed

Lines changed: 40 additions & 3 deletions

File tree

‎src/vision/eligibility.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,10 @@ function modelAcceptsImageInputWithCache(
156156
): boolean | undefined {
157157
if (candidate.native === true || (candidate.provider === "openai" && SUPPORTED_NATIVE_OPENAI_SLUGS.has(candidate.id))) {
158158
const nativeProvider = enrichedProviderForVision(config, candidate.provider, cache);
159-
if (nativeProvider && isModelVisionSidecarConsumer({
160-
noVisionModels: nativeProvider.noVisionModels, modelInputModalities: nativeProvider.modelInputModalities,
161-
}, candidate.id)) return false;
159+
if (nativeProvider && isModelVisionSidecarConsumer(nativeProvider, candidate.id)) return false;
160+
const declared = Object.hasOwn(nativeProvider?.modelCapabilities ?? {}, candidate.id)
161+
? nativeProvider?.modelCapabilities?.[candidate.id]?.inputModalities : undefined;
162+
if (declared !== undefined) return declared.includes("image");
162163
return advertisesImageInput(nativeInputModalities(candidate.id)) ?? true;
163164
}
164165
if (isVisionSidecarConsumerWithCache(config, candidate.provider, candidate.id, cache)) return false;

‎tests/vision/vision-eligibility.test.ts‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,42 @@ describe("vision eligibility core", () => {
227227
})).toBe(false);
228228
});
229229

230+
test("15. native model declared text-only via modelCapabilities is disqualified from vision describer eligibility (#4501)", () => {
231+
const config = configWithProviders({
232+
openai: {
233+
adapter: "openai-responses",
234+
baseUrl: "https://chatgpt.com/backend-api/codex",
235+
modelCapabilities: {
236+
"gpt-5.4-mini": { inputModalities: ["text"] },
237+
},
238+
},
239+
});
240+
const candidate: VisionCandidateModel = {
241+
provider: "openai",
242+
id: "gpt-5.4-mini",
243+
};
244+
expect(modelAcceptsImageInput(config, candidate)).toBe(false);
245+
expect(isVisionEligibleModel(config, candidate)).toBe(false);
246+
});
247+
248+
test("16. native model baseline declared text-only via modelCapabilities drops the baseline option (#4501)", () => {
249+
const config = configWithProviders({
250+
openai: {
251+
adapter: "openai-responses",
252+
baseUrl: "https://chatgpt.com/backend-api/codex",
253+
modelCapabilities: {
254+
[BASELINE_VISION_MODELS.openai]: { inputModalities: ["text"] },
255+
},
256+
},
257+
anthropic: {
258+
adapter: "anthropic",
259+
baseUrl: "https://api.anthropic.com",
260+
},
261+
});
262+
const options = visionEligibleModelOptions(config, [], ["openai", "anthropic"], "anthropic");
263+
expect(options.map(o => o.value)).toEqual([BASELINE_VISION_MODELS.anthropic]);
264+
});
265+
230266
test("5. openai baseline is present when that side is enabled", () => {
231267
const options = visionEligibleModelOptions(emptyConfig, [], ["openai"]);
232268
expect(options.map((o) => o.value)).toEqual([BASELINE_VISION_MODELS.openai]);

0 commit comments

Comments
 (0)