Skip to content

Commit a3d8c0e

Browse files
authored
feat: vertex/gemini prompt caching (#2996)
1 parent 2075f26 commit a3d8c0e

File tree

16 files changed

+1285
-1878
lines changed

16 files changed

+1285
-1878
lines changed

.changeset/curly-frogs-pull.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"roo-cline": patch
3+
---
4+
5+
Use gemini provider when using Gemini on vertex ai

package-lock.json

Lines changed: 0 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,6 @@
404404
"@anthropic-ai/sdk": "^0.37.0",
405405
"@anthropic-ai/vertex-sdk": "^0.7.0",
406406
"@aws-sdk/client-bedrock-runtime": "^3.779.0",
407-
"@google-cloud/vertexai": "^1.9.3",
408407
"@google/genai": "^0.9.0",
409408
"@mistralai/mistralai": "^1.3.6",
410409
"@modelcontextprotocol/sdk": "^1.7.0",

src/api/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { AnthropicHandler } from "./providers/anthropic"
88
import { AwsBedrockHandler } from "./providers/bedrock"
99
import { OpenRouterHandler } from "./providers/openrouter"
1010
import { VertexHandler } from "./providers/vertex"
11+
import { AnthropicVertexHandler } from "./providers/anthropic-vertex"
1112
import { OpenAiHandler } from "./providers/openai"
1213
import { OllamaHandler } from "./providers/ollama"
1314
import { LmStudioHandler } from "./providers/lmstudio"
@@ -45,6 +46,7 @@ export interface ApiHandler {
4546

4647
export function buildApiHandler(configuration: ApiConfiguration): ApiHandler {
4748
const { apiProvider, ...options } = configuration
49+
4850
switch (apiProvider) {
4951
case "anthropic":
5052
return new AnthropicHandler(options)
@@ -55,7 +57,11 @@ export function buildApiHandler(configuration: ApiConfiguration): ApiHandler {
5557
case "bedrock":
5658
return new AwsBedrockHandler(options)
5759
case "vertex":
58-
return new VertexHandler(options)
60+
if (options.apiModelId?.startsWith("claude")) {
61+
return new AnthropicVertexHandler(options)
62+
} else {
63+
return new VertexHandler(options)
64+
}
5965
case "openai":
6066
return new OpenAiHandler(options)
6167
case "ollama":

0 commit comments

Comments
 (0)