Roo-Code/src/api/providers/vertex.ts
Daniel 3b45d86df7
Add gemini pro 06 05 (#4386)
* feat: add gemini-2.5-pro-preview-06-05 to Gemini and Vertex providers and UI, identical to 05-06

* feat: add thinking variant for gemini-2.5-pro-preview-06-05

* feat: add gemini-2.5-pro-preview-06-05 support to OpenRouter

* fix: update gemini-2.5-pro-preview model references in OpenRouter

* fix: tests

* feat: enhance reasoning handling in Gemini and Vertex handlers

* feat: add google/gemini-2.5-pro-preview to required reasoning budget models

* fix: refactor thinkingConfig assignment for consistency in Gemini and Vertex handlers

* Fix Gemini reasoning

* Fix tsc error

* Fix tsc error

* Hack to exclude thinking tokens by default

* feat: add global region to VERTEX_REGIONS

---------

Co-authored-by: Shariq Riaz <ishariqriaz@gmail.com>
Co-authored-by: cte <cestreich@gmail.com>
2025-06-05 17:49:12 -04:00

27 lines
1.1 KiB
TypeScript

import { type ModelInfo, type VertexModelId, vertexDefaultModelId, vertexModels } from "@roo-code/types"
import type { ApiHandlerOptions } from "../../shared/api"
import { getModelParams } from "../transform/model-params"
import { GeminiHandler } from "./gemini"
import { SingleCompletionHandler } from "../index"
export class VertexHandler extends GeminiHandler implements SingleCompletionHandler {
constructor(options: ApiHandlerOptions) {
super({ ...options, isVertex: true })
}
override getModel() {
const modelId = this.options.apiModelId
let id = modelId && modelId in vertexModels ? (modelId as VertexModelId) : vertexDefaultModelId
const info: ModelInfo = vertexModels[id]
const params = getModelParams({ format: "gemini", modelId: id, model: info, settings: this.options })
// The `:thinking` suffix indicates that the model is a "Hybrid"
// reasoning model and that reasoning is required to be enabled.
// The actual model ID honored by Gemini's API does not have this
// suffix.
return { id: id.endsWith(":thinking") ? id.replace(":thinking", "") : id, info, ...params }
}
}