mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-31 05:15:32 +00:00
fix(opencode): support vertex opus adaptive reasoning (#29911)
This commit is contained in:
parent
16cae9a323
commit
b956e9a06f
2 changed files with 25 additions and 1 deletions
|
|
@ -597,7 +597,7 @@ function openaiCompatibleReasoningEfforts(id: 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
|
||||
const major = Number(version[1])
|
||||
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", () => {
|
||||
test("anthropic sonnet 4.6 returns adaptive reasoning options", () => {
|
||||
const model = createMockModel({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue