Skip to content

Commit 0d90a22

Browse files
authored
feat: update some ai sdk packages and uuse adaptive reasoning for opus 4.6 on vertex/bedrock/anthropic (anomalyco#13439)
1 parent 34ebe81 commit 0d90a22

3 files changed

Lines changed: 51 additions & 11 deletions

File tree

bun.lock

Lines changed: 18 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/opencode/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@
5151
"@actions/core": "1.11.1",
5252
"@actions/github": "6.0.1",
5353
"@agentclientprotocol/sdk": "0.14.1",
54-
"@ai-sdk/amazon-bedrock": "3.0.74",
55-
"@ai-sdk/anthropic": "2.0.58",
54+
"@ai-sdk/amazon-bedrock": "3.0.79",
55+
"@ai-sdk/anthropic": "2.0.62",
5656
"@ai-sdk/azure": "2.0.91",
5757
"@ai-sdk/cerebras": "1.0.36",
5858
"@ai-sdk/cohere": "2.0.22",
59-
"@ai-sdk/deepinfra": "1.0.33",
59+
"@ai-sdk/deepinfra": "1.0.36",
6060
"@ai-sdk/gateway": "2.0.30",
6161
"@ai-sdk/google": "2.0.52",
6262
"@ai-sdk/google-vertex": "3.0.98",

packages/opencode/src/provider/transform.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,22 @@ export namespace ProviderTransform {
458458
// https://v5.ai-sdk.dev/providers/ai-sdk-providers/anthropic
459459
case "@ai-sdk/google-vertex/anthropic":
460460
// https://v5.ai-sdk.dev/providers/ai-sdk-providers/google-vertex#anthropic-provider
461+
462+
if (model.api.id.includes("opus-4-6") || model.api.id.includes("opus-4.6")) {
463+
const efforts = ["low", "medium", "high", "max"]
464+
return Object.fromEntries(
465+
efforts.map((effort) => [
466+
effort,
467+
{
468+
thinking: {
469+
type: "adaptive",
470+
},
471+
effort,
472+
},
473+
]),
474+
)
475+
}
476+
461477
return {
462478
high: {
463479
thinking: {
@@ -475,6 +491,20 @@ export namespace ProviderTransform {
475491

476492
case "@ai-sdk/amazon-bedrock":
477493
// https://v5.ai-sdk.dev/providers/ai-sdk-providers/amazon-bedrock
494+
if (model.api.id.includes("opus-4-6") || model.api.id.includes("opus-4.6")) {
495+
const efforts = ["low", "medium", "high", "max"]
496+
return Object.fromEntries(
497+
efforts.map((effort) => [
498+
effort,
499+
{
500+
reasoningConfig: {
501+
type: "adaptive",
502+
maxReasoningEffort: effort,
503+
},
504+
},
505+
]),
506+
)
507+
}
478508
// For Anthropic models on Bedrock, use reasoningConfig with budgetTokens
479509
if (model.api.id.includes("anthropic")) {
480510
return {

0 commit comments

Comments
 (0)