Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/three-rings-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"roo-cline": patch
---

Enable Gemini prompt caching by default
4 changes: 2 additions & 2 deletions evals/packages/types/src/roo-code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ export const providerSettingsSchema = z.object({
// Generic
includeMaxTokens: z.boolean().optional(),
reasoningEffort: reasoningEffortsSchema.optional(),
promptCachingEnabled: z.boolean().optional(),
promptCachingDisabled: z.boolean().optional(),
diffEnabled: z.boolean().optional(),
fuzzyMatchThreshold: z.number().optional(),
modelTemperature: z.number().nullish(),
Expand Down Expand Up @@ -507,7 +507,7 @@ const providerSettingsRecord: ProviderSettingsRecord = {
// Generic
includeMaxTokens: undefined,
reasoningEffort: undefined,
promptCachingEnabled: undefined,
promptCachingDisabled: undefined,
diffEnabled: undefined,
fuzzyMatchThreshold: undefined,
modelTemperature: undefined,
Expand Down
6 changes: 3 additions & 3 deletions src/api/providers/__tests__/gemini.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ describe("Caching Logic", () => {
apiKey: "test-key",
apiModelId: "gemini-1.5-flash-latest", // Use a model that supports caching
geminiApiKey: "test-key",
promptCachingEnabled: true, // Enable caching for these tests
promptCachingDisabled: false,
})

handlerWithCache["client"] = {
Expand All @@ -309,8 +309,8 @@ describe("Caching Logic", () => {
} as any
})

it("should not use cache if promptCachingEnabled is false", async () => {
handlerWithCache["options"].promptCachingEnabled = false
it("should not use cache if promptCachingDisabled is true", async () => {
handlerWithCache["options"].promptCachingDisabled = true
const stream = handlerWithCache.createMessage(systemPrompt, mockMessagesLong, cacheKey)

for await (const _ of stream) {
Expand Down
2 changes: 1 addition & 1 deletion src/api/providers/gemini.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class GeminiHandler extends BaseProvider implements SingleCompletionHandl
// https://ai.google.dev/gemini-api/docs/tokens?lang=node
const isCacheAvailable =
info.supportsPromptCache &&
this.options.promptCachingEnabled &&
!this.options.promptCachingDisabled &&
cacheKey &&
contentsLength > 4 * CONTEXT_CACHE_TOKEN_MINIMUM

Expand Down
2 changes: 1 addition & 1 deletion src/api/providers/openrouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class OpenRouterHandler extends BaseProvider implements SingleCompletionH
openAiMessages = convertToR1Format([{ role: "user", content: systemPrompt }, ...messages])
}

const isCacheAvailable = promptCache.supported && (!promptCache.optional || this.options.promptCachingEnabled)
const isCacheAvailable = promptCache.supported && (!promptCache.optional || !this.options.promptCachingDisabled)

// https://openrouter.ai/docs/features/prompt-caching
if (isCacheAvailable) {
Expand Down
2 changes: 1 addition & 1 deletion src/exports/roo-code.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ type ProviderSettings = {
modelMaxThinkingTokens?: number | undefined
includeMaxTokens?: boolean | undefined
reasoningEffort?: ("low" | "medium" | "high") | undefined
promptCachingEnabled?: boolean | undefined
promptCachingDisabled?: boolean | undefined
diffEnabled?: boolean | undefined
fuzzyMatchThreshold?: number | undefined
modelTemperature?: (number | null) | undefined
Expand Down
2 changes: 1 addition & 1 deletion src/exports/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ type ProviderSettings = {
modelMaxThinkingTokens?: number | undefined
includeMaxTokens?: boolean | undefined
reasoningEffort?: ("low" | "medium" | "high") | undefined
promptCachingEnabled?: boolean | undefined
promptCachingDisabled?: boolean | undefined
diffEnabled?: boolean | undefined
fuzzyMatchThreshold?: number | undefined
modelTemperature?: (number | null) | undefined
Expand Down
4 changes: 2 additions & 2 deletions src/schemas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ export const providerSettingsSchema = z.object({
// Generic
includeMaxTokens: z.boolean().optional(),
reasoningEffort: reasoningEffortsSchema.optional(),
promptCachingEnabled: z.boolean().optional(),
promptCachingDisabled: z.boolean().optional(),
diffEnabled: z.boolean().optional(),
fuzzyMatchThreshold: z.number().optional(),
modelTemperature: z.number().nullish(),
Expand Down Expand Up @@ -524,7 +524,7 @@ const providerSettingsRecord: ProviderSettingsRecord = {
// Generic
includeMaxTokens: undefined,
reasoningEffort: undefined,
promptCachingEnabled: undefined,
promptCachingDisabled: undefined,
diffEnabled: undefined,
fuzzyMatchThreshold: undefined,
modelTemperature: undefined,
Expand Down
4 changes: 2 additions & 2 deletions webview-ui/src/components/settings/PromptCachingControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export const PromptCachingControl = ({ apiConfiguration, setApiConfigurationFiel
<>
<div>
<VSCodeCheckbox
checked={apiConfiguration.promptCachingEnabled}
onChange={(e: any) => setApiConfigurationField("promptCachingEnabled", e.target.checked)}>
checked={apiConfiguration.promptCachingDisabled}
onChange={(e: any) => setApiConfigurationField("promptCachingDisabled", e.target.checked)}>
<label className="block font-medium mb-1">{t("settings:promptCaching.label")}</label>
</VSCodeCheckbox>
<div className="text-sm text-vscode-descriptionForeground mt-1">
Expand Down
4 changes: 2 additions & 2 deletions webview-ui/src/i18n/locales/ca/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@
}
},
"promptCaching": {
"label": "Habilitar emmagatzematge en caché de prompts",
"description": "Quan està habilitat, Roo utilitzarà aquest model amb la memòria cau de prompts activada per reduir costos."
"label": "Desactivar la memòria cau de prompts",
"description": "Quan està marcat, Roo no utilitzarà la memòria cau de prompts per a aquest model."
},
"temperature": {
"useCustom": "Utilitzar temperatura personalitzada",
Expand Down
4 changes: 2 additions & 2 deletions webview-ui/src/i18n/locales/de/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@
}
},
"promptCaching": {
"label": "Prompt-Caching aktivieren",
"description": "Wenn aktiviert, wird Roo dieses Modell mit aktiviertem Prompt-Caching verwenden, um Kosten zu reduzieren."
"label": "Prompt-Caching deaktivieren",
"description": "Wenn aktiviert, wird Roo für dieses Modell kein Prompt-Caching verwenden."
},
"temperature": {
"useCustom": "Benutzerdefinierte Temperatur verwenden",
Expand Down
4 changes: 2 additions & 2 deletions webview-ui/src/i18n/locales/en/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@
}
},
"promptCaching": {
"label": "Enable prompt caching",
"description": "When enabled, Roo will use this model with prompt caching turned on in order to reduce costs."
"label": "Disable prompt caching",
"description": "When checked, Roo will not use prompt caching for this model."
},
"temperature": {
"useCustom": "Use custom temperature",
Expand Down
4 changes: 2 additions & 2 deletions webview-ui/src/i18n/locales/es/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@
}
},
"promptCaching": {
"label": "Habilitar caché de prompts",
"description": "Cuando está habilitado, Roo usará este modelo con el caché de prompts activado para reducir costos."
"label": "Desactivar caché de prompts",
"description": "Cuando está marcado, Roo no utilizará el caché de prompts para este modelo."
},
"temperature": {
"useCustom": "Usar temperatura personalizada",
Expand Down
4 changes: 2 additions & 2 deletions webview-ui/src/i18n/locales/fr/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@
}
},
"promptCaching": {
"label": "Activer la mise en cache des prompts",
"description": "Lorsque cette option est activée, Roo utilisera ce modèle avec la mise en cache des prompts activée afin de réduire les coûts."
"label": "Désactiver la mise en cache des prompts",
"description": "Lorsque cette option est cochée, Roo n'utilisera pas la mise en cache des prompts pour ce modèle."
},
"temperature": {
"useCustom": "Utiliser une température personnalisée",
Expand Down
4 changes: 2 additions & 2 deletions webview-ui/src/i18n/locales/hi/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@
}
},
"promptCaching": {
"label": "प्रॉम्प्ट कैशिंग सक्षम करें",
"description": "जब सक्षम किया जाता है, तो Roo लागत को कम करने के लिए प्रॉम्प्ट कैशिंग चालू के साथ इस मॉडल का उपयोग करेगा।"
"label": "प्रॉम्प्ट कैशिंग अक्षम करें",
"description": "जब चेक किया जाता है, तो Roo इस मॉडल के लिए प्रॉम्प्ट कैशिंग का उपयोग नहीं करेगा।"
},
"temperature": {
"useCustom": "कस्टम तापमान का उपयोग करें",
Expand Down
4 changes: 2 additions & 2 deletions webview-ui/src/i18n/locales/it/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@
}
},
"promptCaching": {
"label": "Abilita cache dei prompt",
"description": "Quando abilitato, Roo utilizzerà questo modello con la cache dei prompt attivata per ridurre i costi."
"label": "Disattiva la cache dei prompt",
"description": "Quando selezionato, Roo non utilizzerà la cache dei prompt per questo modello."
},
"temperature": {
"useCustom": "Usa temperatura personalizzata",
Expand Down
4 changes: 2 additions & 2 deletions webview-ui/src/i18n/locales/ja/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@
}
},
"promptCaching": {
"label": "プロンプトキャッシングを有効化",
"description": "有効にすると、Rooはコスト削減のためにプロンプトキャッシングを有効にしてこのモデルを使用します。"
"label": "プロンプトキャッシュを無効化",
"description": "チェックすると、Rooはこのモデルに対してプロンプトキャッシュを使用しません。"
},
"temperature": {
"useCustom": "カスタム温度を使用",
Expand Down
4 changes: 2 additions & 2 deletions webview-ui/src/i18n/locales/ko/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@
}
},
"promptCaching": {
"label": "프롬프트 캐싱 활성화",
"description": "활성화하면 Roo는 비용 절감을 위해 프롬프트 캐싱을 켠 상태로 이 모델을 사용합니다."
"label": "프롬프트 캐싱 비활성화",
"description": "체크하면 Roo가 이 모델에 대해 프롬프트 캐싱을 사용하지 않습니다."
},
"temperature": {
"useCustom": "사용자 정의 온도 사용",
Expand Down
4 changes: 2 additions & 2 deletions webview-ui/src/i18n/locales/pl/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@
}
},
"promptCaching": {
"label": "Włącz buforowanie podpowiedzi",
"description": "Po włączeniu, Roo będzie używać tego modelu z włączonym buforowaniem promptów w celu zmniejszenia kosztów."
"label": "Wyłącz buforowanie promptów",
"description": "Po zaznaczeniu, Roo nie będzie używać buforowania promptów dla tego modelu."
},
"temperature": {
"useCustom": "Użyj niestandardowej temperatury",
Expand Down
4 changes: 2 additions & 2 deletions webview-ui/src/i18n/locales/pt-BR/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@
}
},
"promptCaching": {
"label": "Ativar cache de prompts",
"description": "Quando ativado, o Roo usará este modelo com o cache de prompts ativado para reduzir custos."
"label": "Desativar cache de prompts",
"description": "Quando marcado, o Roo não usará o cache de prompts para este modelo."
},
"temperature": {
"useCustom": "Usar temperatura personalizada",
Expand Down
4 changes: 2 additions & 2 deletions webview-ui/src/i18n/locales/ru/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@
}
},
"promptCaching": {
"label": "Включить кэширование подсказок",
"description": "Если включено, Roo будет использовать эту модель с включенным кэшированием подсказок для снижения затрат."
"label": "Отключить кэширование промптов",
"description": "Если отмечено, Roo не будет использовать кэширование промптов для этой модели."
},
"temperature": {
"useCustom": "Использовать пользовательскую температуру",
Expand Down
4 changes: 2 additions & 2 deletions webview-ui/src/i18n/locales/tr/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@
}
},
"promptCaching": {
"label": "Prompt önbelleğini etkinleştir",
"description": "Etkinleştirildiğinde, Roo maliyetleri azaltmak için prompt önbelleği açık olan bu modeli kullanacaktır."
"label": "Prompt önbelleğini devre dışı bırak",
"description": "İşaretlendiğinde, Roo bu model için prompt önbelleğini kullanmayacaktır."
},
"temperature": {
"useCustom": "Özel sıcaklık kullan",
Expand Down
4 changes: 2 additions & 2 deletions webview-ui/src/i18n/locales/vi/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@
}
},
"promptCaching": {
"label": "Bật bộ nhớ đệm prompt",
"description": "Khi được bật, Roo sẽ sử dụng mô hình này với bộ nhớ đệm prompt được bật để giảm chi phí."
"label": "Tắt bộ nhớ đệm prompt",
"description": "Khi được chọn, Roo sẽ không sử dụng bộ nhớ đệm prompt cho mô hình này."
},
"temperature": {
"useCustom": "Sử dụng nhiệt độ tùy chỉnh",
Expand Down
4 changes: 2 additions & 2 deletions webview-ui/src/i18n/locales/zh-CN/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@
}
},
"promptCaching": {
"label": "启用提示词缓存",
"description": "启用后 Roo 将使用提示词缓存功能以降低成本。"
"label": "禁用提示词缓存",
"description": "选中后,Roo 将不会为此模型使用提示词缓存。"
},
"temperature": {
"useCustom": "使用自定义温度",
Expand Down
4 changes: 2 additions & 2 deletions webview-ui/src/i18n/locales/zh-TW/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@
}
},
"promptCaching": {
"label": "啟用提示快取",
"description": "啟用後,Roo 將使用提示快取功能以降低成本。"
"label": "停用提示詞快取",
"description": "勾選後,Roo 將不會為此模型使用提示詞快取。"
},
"temperature": {
"useCustom": "使用自訂溫度",
Expand Down