fix: adjust azure defaults to closer match openai to prevent Item .. of type 'reasoning' was provided without its required following item (#25007)

This commit is contained in:
Aiden Cline 2026-04-29 16:49:28 -05:00 committed by GitHub
parent 588261076a
commit a740d2c667
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 6 deletions

View file

@ -1466,10 +1466,13 @@ const layer: Layer.Layer<
if (combined) opts.signal = combined
// Strip openai itemId metadata following what codex does
if (model.api.npm === "@ai-sdk/openai" && opts.body && opts.method === "POST") {
if (
(model.api.npm === "@ai-sdk/openai" || model.api.npm === "@ai-sdk/azure") &&
opts.body &&
opts.method === "POST"
) {
const body = JSON.parse(opts.body as string)
const isAzure = model.providerID.includes("azure")
const keepIds = isAzure && body.store === true
const keepIds = body.store === true
if (!keepIds && Array.isArray(body.input)) {
for (const item of body.input) {
if ("id" in item) {

View file

@ -866,7 +866,7 @@ export function options(input: {
}
if (input.model.api.npm === "@ai-sdk/azure") {
result["store"] = true
result["store"] = false
result["promptCacheKey"] = input.sessionID
}

View file

@ -101,7 +101,7 @@ describe("ProviderTransform.options - setCacheKey", () => {
expect(result.store).toBe(false)
})
test("should set store=true for azure provider by default", () => {
test("should set store=false for azure provider by default", () => {
const azureModel = {
...mockModel,
providerID: "azure",
@ -116,7 +116,7 @@ describe("ProviderTransform.options - setCacheKey", () => {
sessionID,
providerOptions: {},
})
expect(result.store).toBe(true)
expect(result.store).toBe(false)
})
})