fix: add xhigh reasoning effort for GitHub Copilot GPT-5 models (#10092)
Co-authored-by: Arthur Freitas Ramos <arthur@MacBook-Air-de-Arthur.local>
This commit is contained in:
@@ -349,8 +349,12 @@ export namespace ProviderTransform {
|
||||
return Object.fromEntries(OPENAI_EFFORTS.map((effort) => [effort, { reasoningEffort: effort }]))
|
||||
|
||||
case "@ai-sdk/github-copilot":
|
||||
const copilotEfforts = iife(() => {
|
||||
if (id.includes("5.1-codex-max") || id.includes("5.2")) return [...WIDELY_SUPPORTED_EFFORTS, "xhigh"]
|
||||
return WIDELY_SUPPORTED_EFFORTS
|
||||
})
|
||||
return Object.fromEntries(
|
||||
WIDELY_SUPPORTED_EFFORTS.map((effort) => [
|
||||
copilotEfforts.map((effort) => [
|
||||
effort,
|
||||
{
|
||||
reasoningEffort: effort,
|
||||
|
||||
@@ -1224,6 +1224,102 @@ describe("ProviderTransform.variants", () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("@ai-sdk/github-copilot", () => {
|
||||
test("standard models return low, medium, high", () => {
|
||||
const model = createMockModel({
|
||||
id: "gpt-4.5",
|
||||
providerID: "github-copilot",
|
||||
api: {
|
||||
id: "gpt-4.5",
|
||||
url: "https://api.githubcopilot.com",
|
||||
npm: "@ai-sdk/github-copilot",
|
||||
},
|
||||
})
|
||||
const result = ProviderTransform.variants(model)
|
||||
expect(Object.keys(result)).toEqual(["low", "medium", "high"])
|
||||
expect(result.low).toEqual({
|
||||
reasoningEffort: "low",
|
||||
reasoningSummary: "auto",
|
||||
include: ["reasoning.encrypted_content"],
|
||||
})
|
||||
})
|
||||
|
||||
test("gpt-5.1-codex-max includes xhigh", () => {
|
||||
const model = createMockModel({
|
||||
id: "gpt-5.1-codex-max",
|
||||
providerID: "github-copilot",
|
||||
api: {
|
||||
id: "gpt-5.1-codex-max",
|
||||
url: "https://api.githubcopilot.com",
|
||||
npm: "@ai-sdk/github-copilot",
|
||||
},
|
||||
})
|
||||
const result = ProviderTransform.variants(model)
|
||||
expect(Object.keys(result)).toEqual(["low", "medium", "high", "xhigh"])
|
||||
})
|
||||
|
||||
test("gpt-5.1-codex-mini does not include xhigh", () => {
|
||||
const model = createMockModel({
|
||||
id: "gpt-5.1-codex-mini",
|
||||
providerID: "github-copilot",
|
||||
api: {
|
||||
id: "gpt-5.1-codex-mini",
|
||||
url: "https://api.githubcopilot.com",
|
||||
npm: "@ai-sdk/github-copilot",
|
||||
},
|
||||
})
|
||||
const result = ProviderTransform.variants(model)
|
||||
expect(Object.keys(result)).toEqual(["low", "medium", "high"])
|
||||
})
|
||||
|
||||
test("gpt-5.1-codex does not include xhigh", () => {
|
||||
const model = createMockModel({
|
||||
id: "gpt-5.1-codex",
|
||||
providerID: "github-copilot",
|
||||
api: {
|
||||
id: "gpt-5.1-codex",
|
||||
url: "https://api.githubcopilot.com",
|
||||
npm: "@ai-sdk/github-copilot",
|
||||
},
|
||||
})
|
||||
const result = ProviderTransform.variants(model)
|
||||
expect(Object.keys(result)).toEqual(["low", "medium", "high"])
|
||||
})
|
||||
|
||||
test("gpt-5.2 includes xhigh", () => {
|
||||
const model = createMockModel({
|
||||
id: "gpt-5.2",
|
||||
providerID: "github-copilot",
|
||||
api: {
|
||||
id: "gpt-5.2",
|
||||
url: "https://api.githubcopilot.com",
|
||||
npm: "@ai-sdk/github-copilot",
|
||||
},
|
||||
})
|
||||
const result = ProviderTransform.variants(model)
|
||||
expect(Object.keys(result)).toEqual(["low", "medium", "high", "xhigh"])
|
||||
expect(result.xhigh).toEqual({
|
||||
reasoningEffort: "xhigh",
|
||||
reasoningSummary: "auto",
|
||||
include: ["reasoning.encrypted_content"],
|
||||
})
|
||||
})
|
||||
|
||||
test("gpt-5.2-codex includes xhigh", () => {
|
||||
const model = createMockModel({
|
||||
id: "gpt-5.2-codex",
|
||||
providerID: "github-copilot",
|
||||
api: {
|
||||
id: "gpt-5.2-codex",
|
||||
url: "https://api.githubcopilot.com",
|
||||
npm: "@ai-sdk/github-copilot",
|
||||
},
|
||||
})
|
||||
const result = ProviderTransform.variants(model)
|
||||
expect(Object.keys(result)).toEqual(["low", "medium", "high", "xhigh"])
|
||||
})
|
||||
})
|
||||
|
||||
describe("@ai-sdk/cerebras", () => {
|
||||
test("returns WIDELY_SUPPORTED_EFFORTS with reasoningEffort", () => {
|
||||
const model = createMockModel({
|
||||
|
||||
Reference in New Issue
Block a user