fix(provider): nest gateway google thinking options
This commit is contained in:
parent
996a0628ef
commit
c7cbbda8f2
2 changed files with 19 additions and 1 deletions
|
|
@ -645,7 +645,7 @@ function effortVariant(model: Provider.Model, effort: ReasoningEffortValue) {
|
|||
}
|
||||
return { effort }
|
||||
}
|
||||
if (idIncludes(model, "google")) return { includeThoughts: true, thinkingLevel: effort }
|
||||
if (idIncludes(model, "google")) return { thinkingConfig: { includeThoughts: true, thinkingLevel: effort } }
|
||||
return { reasoningEffort: effort }
|
||||
|
||||
case "@ai-sdk/anthropic":
|
||||
|
|
|
|||
|
|
@ -3188,6 +3188,24 @@ describe("ProviderTransform.variants", () => {
|
|||
expect(result.high).toEqual({ thinkingConfig: { includeThoughts: true, thinkingBudget: 16_000 } })
|
||||
expect(result.max).toEqual({ thinkingConfig: { includeThoughts: true, thinkingBudget: 32_768 } })
|
||||
})
|
||||
|
||||
test("uses reasoning_options effort for Google thinkingConfig variants", () => {
|
||||
const result = ProviderTransform.variants(
|
||||
createMockModel({
|
||||
id: "google/gemini-3.1-pro-preview",
|
||||
providerID: "gateway",
|
||||
api: {
|
||||
id: "google/gemini-3.1-pro-preview",
|
||||
url: "https://gateway.ai",
|
||||
npm: "@ai-sdk/gateway",
|
||||
},
|
||||
reasoning_options: [{ type: "effort", values: ["low", "high"] }],
|
||||
}),
|
||||
)
|
||||
expect(Object.keys(result)).toEqual(["low", "high"])
|
||||
expect(result.low).toEqual({ thinkingConfig: { includeThoughts: true, thinkingLevel: "low" } })
|
||||
expect(result.high).toEqual({ thinkingConfig: { includeThoughts: true, thinkingLevel: "high" } })
|
||||
})
|
||||
})
|
||||
|
||||
describe("@ai-sdk/github-copilot", () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue