mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-21 01:01:42 +00:00
Add Gemini 3 preview models to google-gemini-cli provider
- Add gemini-3-pro-preview and gemini-3-flash-preview to Cloud Code Assist - Handle thinkingLevel config for Gemini 3 (vs thinkingBudget for Gemini 2.x) - Gemini 3 Pro: LOW/HIGH levels only - Gemini 3 Flash: all four levels (MINIMAL/LOW/MEDIUM/HIGH)
This commit is contained in:
parent
299986f06b
commit
ee9b498380
5 changed files with 107 additions and 4 deletions
|
|
@ -237,12 +237,24 @@ function mapOptionsForApi<TApi extends Api>(
|
|||
}
|
||||
|
||||
case "google-gemini-cli": {
|
||||
// Cloud Code Assist uses thinking budget tokens like Gemini 2.5
|
||||
if (!options?.reasoning) {
|
||||
return { ...base, thinking: { enabled: false } } satisfies GoogleGeminiCliOptions;
|
||||
}
|
||||
|
||||
const effort = clampReasoning(options.reasoning)!;
|
||||
|
||||
// Gemini 3 models use thinkingLevel instead of thinkingBudget
|
||||
if (model.id.includes("3-pro") || model.id.includes("3-flash")) {
|
||||
return {
|
||||
...base,
|
||||
thinking: {
|
||||
enabled: true,
|
||||
level: getGeminiCliThinkingLevel(effort, model.id),
|
||||
},
|
||||
} satisfies GoogleGeminiCliOptions;
|
||||
}
|
||||
|
||||
// Gemini 2.x models use thinkingBudget
|
||||
const budgets: Record<ClampedReasoningEffort, number> = {
|
||||
minimal: 1024,
|
||||
low: 2048,
|
||||
|
|
@ -304,6 +316,31 @@ function getGemini3ThinkingLevel(effort: ClampedReasoningEffort, model: Model<"g
|
|||
}
|
||||
}
|
||||
|
||||
function getGeminiCliThinkingLevel(effort: ClampedReasoningEffort, modelId: string): ThinkingLevel {
|
||||
if (modelId.includes("3-pro")) {
|
||||
// Gemini 3 Pro only supports LOW/HIGH (for now)
|
||||
switch (effort) {
|
||||
case "minimal":
|
||||
case "low":
|
||||
return ThinkingLevel.LOW;
|
||||
case "medium":
|
||||
case "high":
|
||||
return ThinkingLevel.HIGH;
|
||||
}
|
||||
}
|
||||
// Gemini 3 Flash supports all four levels
|
||||
switch (effort) {
|
||||
case "minimal":
|
||||
return ThinkingLevel.MINIMAL;
|
||||
case "low":
|
||||
return ThinkingLevel.LOW;
|
||||
case "medium":
|
||||
return ThinkingLevel.MEDIUM;
|
||||
case "high":
|
||||
return ThinkingLevel.HIGH;
|
||||
}
|
||||
}
|
||||
|
||||
function getGoogleBudget(model: Model<"google-generative-ai">, effort: ClampedReasoningEffort): number {
|
||||
// See https://ai.google.dev/gemini-api/docs/thinking#set-budget
|
||||
if (model.id.includes("2.5-pro")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue