fix(opencode): support vertex opus adaptive reasoning (#29911)
This commit is contained in:
@@ -597,7 +597,7 @@ function openaiCompatibleReasoningEfforts(id: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function anthropicOpus47OrLater(apiId: string) {
|
function anthropicOpus47OrLater(apiId: string) {
|
||||||
const version = /opus-(\d+)[.-](\d+)(?:[.-]|$)/i.exec(apiId)
|
const version = /opus-(\d+)[.-](\d+)(?:[.@-]|$)/i.exec(apiId)
|
||||||
if (!version) return false
|
if (!version) return false
|
||||||
const major = Number(version[1])
|
const major = Number(version[1])
|
||||||
const minor = Number(version[2])
|
const minor = Number(version[2])
|
||||||
|
|||||||
@@ -3298,6 +3298,30 @@ describe("ProviderTransform.variants", () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe("@ai-sdk/google-vertex/anthropic", () => {
|
||||||
|
test("opus 4.8 uses adaptive reasoning for Vertex model IDs", () => {
|
||||||
|
const result = ProviderTransform.variants(
|
||||||
|
createMockModel({
|
||||||
|
id: "google-vertex-anthropic/claude-opus-4-8@default",
|
||||||
|
providerID: "google-vertex-anthropic",
|
||||||
|
api: {
|
||||||
|
id: "claude-opus-4-8@default",
|
||||||
|
url: "https://us-central1-aiplatform.googleapis.com",
|
||||||
|
npm: "@ai-sdk/google-vertex/anthropic",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
expect(Object.keys(result)).toEqual(["low", "medium", "high", "xhigh", "max"])
|
||||||
|
expect(result.high).toEqual({
|
||||||
|
thinking: {
|
||||||
|
type: "adaptive",
|
||||||
|
display: "summarized",
|
||||||
|
},
|
||||||
|
effort: "high",
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe("@ai-sdk/amazon-bedrock", () => {
|
describe("@ai-sdk/amazon-bedrock", () => {
|
||||||
test("anthropic sonnet 4.6 returns adaptive reasoning options", () => {
|
test("anthropic sonnet 4.6 returns adaptive reasoning options", () => {
|
||||||
const model = createMockModel({
|
const model = createMockModel({
|
||||||
|
|||||||
Reference in New Issue
Block a user