fix(provider): exclude chat models from textVerbosity setting (#11363)

This commit is contained in:
Ryan Vogel
2026-01-30 15:57:01 -05:00
committed by opencode
parent f51bd28ed8
commit 4a56491e42
2 changed files with 75 additions and 0 deletions

View File

@@ -594,9 +594,12 @@ export namespace ProviderTransform {
result["reasoningEffort"] = "medium"
}
// Only set textVerbosity for non-chat gpt-5.x models
// Chat models (e.g. gpt-5.2-chat-latest) only support "medium" verbosity
if (
input.model.api.id.includes("gpt-5.") &&
!input.model.api.id.includes("codex") &&
!input.model.api.id.includes("-chat") &&
input.model.providerID !== "azure"
) {
result["textVerbosity"] = "low"

View File

@@ -103,6 +103,78 @@ describe("ProviderTransform.options - setCacheKey", () => {
})
})
describe("ProviderTransform.options - gpt-5 textVerbosity", () => {
const sessionID = "test-session-123"
const createGpt5Model = (apiId: string) =>
({
id: `openai/${apiId}`,
providerID: "openai",
api: {
id: apiId,
url: "https://api.openai.com",
npm: "@ai-sdk/openai",
},
name: apiId,
capabilities: {
temperature: true,
reasoning: true,
attachment: true,
toolcall: true,
input: { text: true, audio: false, image: true, video: false, pdf: false },
output: { text: true, audio: false, image: false, video: false, pdf: false },
interleaved: false,
},
cost: { input: 0.03, output: 0.06, cache: { read: 0.001, write: 0.002 } },
limit: { context: 128000, output: 4096 },
status: "active",
options: {},
headers: {},
}) as any
test("gpt-5.2 should have textVerbosity set to low", () => {
const model = createGpt5Model("gpt-5.2")
const result = ProviderTransform.options({ model, sessionID, providerOptions: {} })
expect(result.textVerbosity).toBe("low")
})
test("gpt-5.1 should have textVerbosity set to low", () => {
const model = createGpt5Model("gpt-5.1")
const result = ProviderTransform.options({ model, sessionID, providerOptions: {} })
expect(result.textVerbosity).toBe("low")
})
test("gpt-5.2-chat-latest should NOT have textVerbosity set (only supports medium)", () => {
const model = createGpt5Model("gpt-5.2-chat-latest")
const result = ProviderTransform.options({ model, sessionID, providerOptions: {} })
expect(result.textVerbosity).toBeUndefined()
})
test("gpt-5.1-chat-latest should NOT have textVerbosity set (only supports medium)", () => {
const model = createGpt5Model("gpt-5.1-chat-latest")
const result = ProviderTransform.options({ model, sessionID, providerOptions: {} })
expect(result.textVerbosity).toBeUndefined()
})
test("gpt-5.2-chat should NOT have textVerbosity set", () => {
const model = createGpt5Model("gpt-5.2-chat")
const result = ProviderTransform.options({ model, sessionID, providerOptions: {} })
expect(result.textVerbosity).toBeUndefined()
})
test("gpt-5-chat should NOT have textVerbosity set", () => {
const model = createGpt5Model("gpt-5-chat")
const result = ProviderTransform.options({ model, sessionID, providerOptions: {} })
expect(result.textVerbosity).toBeUndefined()
})
test("gpt-5.2-codex should NOT have textVerbosity set (codex models excluded)", () => {
const model = createGpt5Model("gpt-5.2-codex")
const result = ProviderTransform.options({ model, sessionID, providerOptions: {} })
expect(result.textVerbosity).toBeUndefined()
})
})
describe("ProviderTransform.maxOutputTokens", () => {
test("returns 32k when modelLimit > 32k", () => {
const modelLimit = 100000