mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-11-21 15:05:56 +00:00
fix(sse): map none/minimal effort to low on Gemini models without a minimal level
Gemini 4 Hydrogen declares low/medium/high/xhigh but no minimal, so reasoning_effort "none" resolved to an unsupported level and fell through to the configured high default with thoughts enabled. Fall back to low when minimal is unsupported; includeThoughts stays false for none.
This commit is contained in:
committed by
diegosouzapw
parent
939a1e931c
commit
085427318d
@@ -167,6 +167,11 @@ function nativeGeminiEffort(
|
||||
if (typeof rawEffort !== "string") return null;
|
||||
const effort = rawEffort.trim().toLowerCase();
|
||||
let thinkingLevel = NATIVE_GEMINI_EFFORT_LEVELS.get(effort);
|
||||
// Models without `minimal` (e.g. Gemini 4 Hydrogen) take their lowest level, so an
|
||||
// explicit opt-out never falls through to a higher configured default.
|
||||
if (thinkingLevel === "minimal" && !supported.includes("minimal") && supported.includes("low")) {
|
||||
thinkingLevel = "low";
|
||||
}
|
||||
if (thinkingLevel === "xhigh" && !supported.includes("xhigh") && supported.includes("high")) {
|
||||
thinkingLevel = "high";
|
||||
}
|
||||
|
||||
@@ -115,6 +115,27 @@ test("resolveNativeGeminiThinking routes xhigh and max to xhigh for gemini-4-hyd
|
||||
assert.deepEqual(defaultResult, { thinkingLevel: "high", includeThoughts: true });
|
||||
});
|
||||
|
||||
test("resolveNativeGeminiThinking maps none/minimal effort to low on gemini-4-hydrogen (no minimal level)", () => {
|
||||
// Hydrogen has no `minimal` level: an explicit opt-out must not fall through to
|
||||
// the `high` default with thoughts enabled.
|
||||
const noneResult = resolveNativeGeminiThinking("gemini-4-hydrogen", {
|
||||
reasoning_effort: "none",
|
||||
});
|
||||
assert.deepEqual(noneResult, { thinkingLevel: "low", includeThoughts: false });
|
||||
|
||||
const minimalResult = resolveNativeGeminiThinking("gemini-4-hydrogen", {
|
||||
reasoning_effort: "minimal",
|
||||
});
|
||||
assert.deepEqual(minimalResult, { thinkingLevel: "low", includeThoughts: true });
|
||||
});
|
||||
|
||||
test("resolveNativeGeminiThinking keeps minimal for none effort when the model supports it", () => {
|
||||
const result = resolveNativeGeminiThinking("gemini-3.5-flash-lite", {
|
||||
reasoning_effort: "none",
|
||||
});
|
||||
assert.deepEqual(result, { thinkingLevel: "minimal", includeThoughts: false });
|
||||
});
|
||||
|
||||
test("resolveNativeGeminiThinking clamps xhigh to high for models without xhigh", () => {
|
||||
const result = resolveNativeGeminiThinking("gemini-3.5-flash-lite", {
|
||||
reasoning_effort: "xhigh",
|
||||
|
||||
Reference in New Issue
Block a user