File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ export async function getUnboundModels(apiKey?: string | null): Promise<Record<s
2020 for ( const [ modelId , model ] of Object . entries ( rawModels ) ) {
2121 const modelInfo : ModelInfo = {
2222 maxTokens : model ?. maxTokens ? parseInt ( model . maxTokens ) : undefined ,
23- contextWindow : model ?. contextWindow ? parseInt ( model . contextWindow ) : 0 ,
23+ contextWindow : model ?. contextWindow ? parseInt ( model . contextWindow ) : 128_000 ,
2424 supportsImages : model ?. supportsImages ?? false ,
2525 supportsPromptCache : model ?. supportsPromptCaching ?? false ,
2626 supportsComputerUse : model ?. supportsComputerUse ?? false ,
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import { ApiStream, ApiStreamUsageChunk } from "../transform/stream"
99import { convertToOpenAiMessages } from "../transform/openai-format"
1010import { addCacheBreakpoints as addAnthropicCacheBreakpoints } from "../transform/caching/anthropic"
1111import { addCacheBreakpoints as addGeminiCacheBreakpoints } from "../transform/caching/gemini"
12+ import { addCacheBreakpoints as addVertexCacheBreakpoints } from "../transform/caching/vertex"
1213
1314import type { SingleCompletionHandler , ApiHandlerCreateMessageMetadata } from "../index"
1415import { RouterProvider } from "./router-provider"
@@ -70,6 +71,10 @@ export class UnboundHandler extends RouterProvider implements SingleCompletionHa
7071 addAnthropicCacheBreakpoints ( systemPrompt , openAiMessages )
7172 }
7273 }
74+ // Custom models from Vertex AI (no configuration) need to be handled differently.
75+ if ( modelId . startsWith ( "vertex-ai/google." ) || modelId . startsWith ( "vertex-ai/anthropic." ) ) {
76+ addVertexCacheBreakpoints ( messages )
77+ }
7378
7479 // Required by Anthropic; other providers default to max tokens allowed.
7580 let maxTokens : number | undefined
You can’t perform that action at this time.
0 commit comments