Skip to content
Merged
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 src/api/providers/unbound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { ApiStream, ApiStreamUsageChunk } from "../transform/stream"
import { convertToOpenAiMessages } from "../transform/openai-format"
import { addCacheBreakpoints as addAnthropicCacheBreakpoints } from "../transform/caching/anthropic"
import { addCacheBreakpoints as addGeminiCacheBreakpoints } from "../transform/caching/gemini"
import { addCacheBreakpoints as addVertexCacheBreakpoints } from "../transform/caching/vertex"

import type { SingleCompletionHandler, ApiHandlerCreateMessageMetadata } from "../index"
import { RouterProvider } from "./router-provider"
Expand Down Expand Up @@ -70,6 +71,10 @@ export class UnboundHandler extends RouterProvider implements SingleCompletionHa
addAnthropicCacheBreakpoints(systemPrompt, openAiMessages)
}
}
// Custom models from Vertex AI (no configuration) need to be handled differently.
if (modelId.startsWith("vertex-ai/google.") || modelId.startsWith("vertex-ai/anthropic.")) {
addVertexCacheBreakpoints(messages)
}

// Required by Anthropic; other providers default to max tokens allowed.
let maxTokens: number | undefined
Expand Down
Loading