mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-28 19:11:03 +08:00
fix: improve Azure provider config handling and GPT-5.4 reasoning variants (#8566)
* fix: pass resourceName to Azure provider from env or config The azure custom loader was returning empty options, causing the @ai-sdk/azure SDK to fail with 'Azure OpenAI resource name setting is missing' when AZURE_RESOURCE_NAME is set in the environment. Read resourceName from provider config options, AZURE_RESOURCE_NAME, or AZURE_OPENAI_RESOURCE_NAME env vars (in that order of precedence) and pass it explicitly to the SDK options, consistent with how azure-cognitive-services handles its resource name. Fixes #8273 * fix: also support baseURL for azure provider to avoid resourceName requirement Users with a full endpoint URL (e.g. https://resource.openai.azure.com/openai/v1) can now set baseURL in provider options or AZURE_OPENAI_ENDPOINT env var. Per @ai-sdk/azure docs, baseURL takes precedence over resourceName and makes it optional, fixing the 'resource name setting is missing' error for both configuration styles. * fix: add xhigh reasoning effort to Azure provider for GPT-5.4+ Azure variant logic was missing xhigh even though @ai-sdk/openai adds it for models with release_date >= 2025-12-04. Azure GPT-5.4 now exposes the same xhigh effort level as OpenAI/Kilo Gateway. * fix(cli): annotate Azure reasoning changes --------- Co-authored-by: marius-kilocode <marius@kilocode.ai>
This commit is contained in:
@@ -210,12 +210,27 @@ export namespace Provider {
|
||||
options: {},
|
||||
}
|
||||
},
|
||||
// kilocode_change start
|
||||
"github-copilot-enterprise": async () => {
|
||||
return {
|
||||
autoload: false,
|
||||
async getModel(sdk: any, modelID: string, _options?: Record<string, any>) {
|
||||
if (useLanguageModel(sdk)) return sdk.languageModel(modelID)
|
||||
return shouldUseCopilotResponsesApi(modelID) ? sdk.responses(modelID) : sdk.chat(modelID)
|
||||
},
|
||||
options: {},
|
||||
}
|
||||
},
|
||||
// kilocode_change end
|
||||
azure: async (provider) => {
|
||||
// kilocode_change start
|
||||
const url = provider.options?.baseURL ?? Env.get("AZURE_OPENAI_ENDPOINT")
|
||||
const resource = iife(() => {
|
||||
const name = provider.options?.resourceName
|
||||
if (typeof name === "string" && name.trim() !== "") return name
|
||||
return Env.get("AZURE_RESOURCE_NAME")
|
||||
return Env.get("AZURE_RESOURCE_NAME") ?? Env.get("AZURE_OPENAI_RESOURCE_NAME")
|
||||
})
|
||||
// kilocode_change end
|
||||
|
||||
return {
|
||||
autoload: false,
|
||||
@@ -227,7 +242,11 @@ export namespace Provider {
|
||||
return sdk.responses(modelID)
|
||||
}
|
||||
},
|
||||
options: {},
|
||||
// kilocode_change start
|
||||
options: {
|
||||
...(url ? { baseURL: url } : resource ? { resourceName: resource } : {}),
|
||||
},
|
||||
// kilocode_change end
|
||||
vars(_options) {
|
||||
return {
|
||||
...(resource && { AZURE_RESOURCE_NAME: resource }),
|
||||
|
||||
@@ -583,6 +583,11 @@ export namespace ProviderTransform {
|
||||
if (id.includes("gpt-5-") || id === "gpt-5") {
|
||||
azureEfforts.unshift("minimal")
|
||||
}
|
||||
// kilocode_change start
|
||||
if (model.release_date >= "2025-12-04") {
|
||||
azureEfforts.push("xhigh")
|
||||
}
|
||||
// kilocode_change end
|
||||
return Object.fromEntries(
|
||||
azureEfforts.map((effort) => [
|
||||
effort,
|
||||
|
||||
@@ -2321,6 +2321,30 @@ describe("ProviderTransform.variants", () => {
|
||||
})
|
||||
})
|
||||
|
||||
// kilocode_change start
|
||||
describe("@ai-sdk/azure", () => {
|
||||
test("gpt-5.4 includes xhigh", () => {
|
||||
const model = createMockModel({
|
||||
id: "gpt-5.4",
|
||||
release_date: "2026-03-05",
|
||||
providerID: "azure",
|
||||
api: {
|
||||
id: "gpt-5.4",
|
||||
url: "https://resource.openai.azure.com/openai",
|
||||
npm: "@ai-sdk/azure",
|
||||
},
|
||||
})
|
||||
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"],
|
||||
})
|
||||
})
|
||||
})
|
||||
// kilocode_change end
|
||||
|
||||
describe("@ai-sdk/cerebras", () => {
|
||||
test("returns WIDELY_SUPPORTED_EFFORTS with reasoningEffort", () => {
|
||||
const model = createMockModel({
|
||||
|
||||
Reference in New Issue
Block a user