fix(opencode): default display summarized for gateway opus 4.7+ adaptive reasoning (#30027)
This commit is contained in:
@@ -697,6 +697,10 @@ export function variants(model: Provider.Model): Record<string, Record<string, a
|
|||||||
{
|
{
|
||||||
thinking: {
|
thinking: {
|
||||||
type: "adaptive",
|
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,
|
effort,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2681,12 +2681,14 @@ describe("ProviderTransform.variants", () => {
|
|||||||
expect(result.xhigh).toEqual({
|
expect(result.xhigh).toEqual({
|
||||||
thinking: {
|
thinking: {
|
||||||
type: "adaptive",
|
type: "adaptive",
|
||||||
|
display: "summarized",
|
||||||
},
|
},
|
||||||
effort: "xhigh",
|
effort: "xhigh",
|
||||||
})
|
})
|
||||||
expect(result.max).toEqual({
|
expect(result.max).toEqual({
|
||||||
thinking: {
|
thinking: {
|
||||||
type: "adaptive",
|
type: "adaptive",
|
||||||
|
display: "summarized",
|
||||||
},
|
},
|
||||||
effort: "max",
|
effort: "max",
|
||||||
})
|
})
|
||||||
@@ -2706,6 +2708,47 @@ describe("ProviderTransform.variants", () => {
|
|||||||
expect(Object.keys(result)).toEqual(["low", "medium", "high", "xhigh", "max"])
|
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", () => {
|
test("anthropic models return anthropic thinking options", () => {
|
||||||
const model = createMockModel({
|
const model = createMockModel({
|
||||||
id: "anthropic/claude-sonnet-4",
|
id: "anthropic/claude-sonnet-4",
|
||||||
|
|||||||
Reference in New Issue
Block a user