fix(opencode): default display summarized for gateway opus 4.7+ adaptive reasoning (#30027)
This commit is contained in:
parent
52e288ea71
commit
3070b0f4ae
@ -697,6 +697,10 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
|
||||
{
|
||||
thinking: {
|
||||
type: "adaptive",
|
||||
// Opus 4.7+ flips the API default for `display` to "omitted", which
|
||||
// returns empty thinking blocks. Force "summarized" so summaries
|
||||
// survive (4.6/Sonnet 4.6 already default to "summarized").
|
||||
...(adaptiveOpus ? { display: "summarized" } : {}),
|
||||
},
|
||||
effort,
|
||||
},
|
||||
|
||||
@ -2681,12 +2681,14 @@ describe("ProviderTransform.variants", () => {
|
||||
expect(result.xhigh).toEqual({
|
||||
thinking: {
|
||||
type: "adaptive",
|
||||
display: "summarized",
|
||||
},
|
||||
effort: "xhigh",
|
||||
})
|
||||
expect(result.max).toEqual({
|
||||
thinking: {
|
||||
type: "adaptive",
|
||||
display: "summarized",
|
||||
},
|
||||
effort: "max",
|
||||
})
|
||||
@ -2706,6 +2708,47 @@ describe("ProviderTransform.variants", () => {
|
||||
expect(Object.keys(result)).toEqual(["low", "medium", "high", "xhigh", "max"])
|
||||
})
|
||||
|
||||
test("anthropic opus 4.8 forces display summarized for adaptive reasoning", () => {
|
||||
const model = createMockModel({
|
||||
id: "anthropic/claude-opus-4-8",
|
||||
providerID: "gateway",
|
||||
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"])
|
||||
expect(result.high).toEqual({
|
||||
thinking: {
|
||||
type: "adaptive",
|
||||
display: "summarized",
|
||||
},
|
||||
effort: "high",
|
||||
})
|
||||
})
|
||||
|
||||
test("anthropic opus 4.6 omits display so it keeps the summarized default", () => {
|
||||
const model = createMockModel({
|
||||
id: "anthropic/claude-opus-4-6",
|
||||
providerID: "gateway",
|
||||
api: {
|
||||
id: "anthropic/claude-opus-4-6",
|
||||
url: "https://gateway.ai",
|
||||
npm: "@ai-sdk/gateway",
|
||||
},
|
||||
})
|
||||
const result = ProviderTransform.variants(model)
|
||||
expect(Object.keys(result)).toEqual(["low", "medium", "high", "max"])
|
||||
expect(result.high).toEqual({
|
||||
thinking: {
|
||||
type: "adaptive",
|
||||
},
|
||||
effort: "high",
|
||||
})
|
||||
})
|
||||
|
||||
test("anthropic models return anthropic thinking options", () => {
|
||||
const model = createMockModel({
|
||||
id: "anthropic/claude-sonnet-4",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user