fix(ai): don't send filename with file_url on Responses (#60382)

This commit is contained in:
Aiden Cline
2026-10-29 21:31:05 -05:00
committed by GitHub
Unverified
parent e705b56562
commit 03491204c7
3 changed files with 6 additions and 5 deletions
+3 -2
View File
@@ -52,7 +52,7 @@ export const OpenResponsesInputImage = Schema.Struct({
})
export const OpenResponsesInputFile = Schema.Struct({
type: Schema.tag("input_file"),
filename: Schema.String,
filename: Schema.optional(Schema.String),
detail: Schema.optional(Schema.String),
file_data: Schema.optional(Schema.String),
file_url: Schema.optional(Schema.String),
@@ -590,11 +590,12 @@ const lowerMedia = Effect.fnUntraced(function* (part: MediaPart, request: LLMReq
const location = url ?? (yield* ProviderShared.requireInlineMedia(adapter.name, part.media)).dataUrl
if (part.media.kind !== "image") {
if (part.media.kind === "video") return { type: "input_video" as const, video_url: location }
if (url) return { type: "input_file" as const, file_url: url, detail }
return {
type: "input_file" as const,
filename: part.filename ?? (mime === "application/pdf" ? "document.pdf" : "file"),
detail,
...(url ? { file_url: url } : { file_data: location }),
file_data: location,
}
}
return {
@@ -198,7 +198,7 @@ const retainedItems = [
content: [
{ type: "input_image", image_url: "https://example.com/image.png" },
{ type: "input_file", filename: "report.pdf", file_data: "data:application/pdf;base64,cGRm", detail: "high" },
{ type: "input_file", filename: "other.pdf", file_url: "https://example.com/report.pdf", detail: "low" },
{ type: "input_file", file_url: "https://example.com/report.pdf", detail: "low" },
],
},
checkpoint,
@@ -1874,7 +1874,7 @@ describe("OpenAI Responses route", () => {
expect(expectToolOutput(prepared.body).output).toEqual([
{ type: "input_image", image_url: "https://example.com/image.png" },
{ type: "input_file", filename: "report.pdf", file_url: "https://example.com/report.pdf" },
{ type: "input_file", file_url: "https://example.com/report.pdf" },
])
}),
)
@@ -5130,7 +5130,7 @@ describe("OpenAI Responses route", () => {
role: "user",
content: [
{ type: "input_image", image_url: "https://example.com/image.png" },
{ type: "input_file", filename: "report.pdf", file_url: "https://example.com/report.pdf" },
{ type: "input_file", file_url: "https://example.com/report.pdf" },
],
},
])