mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-21 05:52:35 +08:00
feat(cli): treat opus 4.8 as adaptive thinking model like 4.7
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@kilocode/cli": patch
|
||||
---
|
||||
|
||||
Treat Claude Opus 4.8 as an adaptive thinking model, matching Opus 4.7.
|
||||
@@ -125,7 +125,9 @@ function build(key: string, remote: Item, url: string, prev?: Model): Model {
|
||||
variants[effort] = {
|
||||
thinking: {
|
||||
type: "adaptive",
|
||||
...(model.api.id.includes("opus-4.7") ? { display: "summarized" } : {}),
|
||||
...(model.api.id.includes("opus-4.7") || model.api.id.includes("opus-4.8")
|
||||
? { display: "summarized" }
|
||||
: {}), // kilocode_change - treat opus-4.8 like opus-4.7
|
||||
},
|
||||
effort,
|
||||
}
|
||||
|
||||
@@ -542,7 +542,8 @@ function openaiReasoningEfforts(apiId: string, releaseDate: string): string[] |
|
||||
}
|
||||
|
||||
function anthropicAdaptiveEfforts(apiId: string): string[] | null {
|
||||
if (["opus-4-7", "opus-4.7"].some((v) => apiId.includes(v))) {
|
||||
if (["opus-4-7", "opus-4.7", "opus-4-8", "opus-4.8"].some((v) => apiId.includes(v))) {
|
||||
// kilocode_change - treat opus-4.8 like opus-4.7
|
||||
return ["low", "medium", "high", "xhigh", "max"]
|
||||
}
|
||||
if (["opus-4-6", "opus-4.6", "sonnet-4-6", "sonnet-4.6"].some((v) => apiId.includes(v))) {
|
||||
@@ -780,7 +781,8 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
|
||||
if (adaptiveEfforts) {
|
||||
let efforts = [...adaptiveEfforts]
|
||||
if (model.providerID === "github-copilot") {
|
||||
if (model.api.id.includes("opus-4.7")) {
|
||||
if (model.api.id.includes("opus-4.7") || model.api.id.includes("opus-4.8")) {
|
||||
// kilocode_change - treat opus-4.8 like opus-4.7
|
||||
efforts = ["medium"]
|
||||
}
|
||||
// Efforts currently supported are: low, medium, high
|
||||
@@ -792,7 +794,8 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
|
||||
{
|
||||
thinking: {
|
||||
type: "adaptive",
|
||||
...(model.api.id.includes("opus-4-7") || model.api.id.includes("opus-4.7")
|
||||
// kilocode_change - treat opus-4.8 like opus-4.7
|
||||
...(["opus-4-7", "opus-4.7", "opus-4-8", "opus-4.8"].some((v) => model.api.id.includes(v))
|
||||
? { display: "summarized" }
|
||||
: {}),
|
||||
},
|
||||
@@ -827,7 +830,8 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
|
||||
reasoningConfig: {
|
||||
type: "adaptive",
|
||||
maxReasoningEffort: effort,
|
||||
...(model.api.id.includes("opus-4-7") || model.api.id.includes("opus-4.7")
|
||||
// kilocode_change - treat opus-4.8 like opus-4.7
|
||||
...(["opus-4-7", "opus-4.7", "opus-4-8", "opus-4.8"].some((v) => model.api.id.includes(v))
|
||||
? { display: "summarized" }
|
||||
: {}),
|
||||
},
|
||||
|
||||
@@ -75,6 +75,50 @@ describe("ProviderTransform.variants - Claude Opus 4.7", () => {
|
||||
})
|
||||
})
|
||||
|
||||
test("opus-4-8 returns adaptive thinking variants including xhigh (native anthropic)", () => {
|
||||
const model = mockModel({
|
||||
api: {
|
||||
id: "claude-opus-4-8",
|
||||
url: "https://api.anthropic.com",
|
||||
npm: "@ai-sdk/anthropic",
|
||||
},
|
||||
})
|
||||
const result = ProviderTransform.variants(model)
|
||||
expect(Object.keys(result)).toEqual(["low", "medium", "high", "xhigh", "max"])
|
||||
expect(result.xhigh).toEqual({
|
||||
thinking: { type: "adaptive", display: "summarized" },
|
||||
effort: "xhigh",
|
||||
})
|
||||
})
|
||||
|
||||
test("opus-4.8 dot-form returns adaptive thinking variants via @ai-sdk/gateway", () => {
|
||||
const model = mockModel({
|
||||
id: "anthropic/claude-opus-4-8",
|
||||
api: {
|
||||
id: "anthropic/claude-opus-4.8",
|
||||
url: "https://gateway.ai",
|
||||
npm: "@ai-sdk/gateway",
|
||||
},
|
||||
})
|
||||
const result = ProviderTransform.variants(model)
|
||||
expect(Object.keys(result)).toEqual(["low", "medium", "high", "xhigh", "max"])
|
||||
})
|
||||
|
||||
test("opus-4-8 on bedrock returns adaptive reasoningConfig with xhigh", () => {
|
||||
const model = mockModel({
|
||||
api: {
|
||||
id: "anthropic.claude-opus-4-8",
|
||||
url: "https://bedrock.amazonaws.com",
|
||||
npm: "@ai-sdk/amazon-bedrock",
|
||||
},
|
||||
})
|
||||
const result = ProviderTransform.variants(model)
|
||||
expect(Object.keys(result)).toEqual(["low", "medium", "high", "xhigh", "max"])
|
||||
expect(result.xhigh).toEqual({
|
||||
reasoningConfig: { type: "adaptive", maxReasoningEffort: "xhigh", display: "summarized" },
|
||||
})
|
||||
})
|
||||
|
||||
test("opus-4-6 keeps original adaptive efforts without xhigh", () => {
|
||||
const model = mockModel({
|
||||
api: {
|
||||
|
||||
Reference in New Issue
Block a user