Skip to content

Commit a4f7204

Browse files
authored
Fix a bug where Chat Completions model does not accept required "filename" parameter for "input_file" items (#1513)
1 parent 31bd3ac commit a4f7204

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/agents/models/chatcmpl_converter.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,16 @@ def extract_all_content(
271271
raise UserError(
272272
f"Only file_data is supported for input_file {casted_file_param}"
273273
)
274+
if "filename" not in casted_file_param or not casted_file_param["filename"]:
275+
raise UserError(
276+
f"filename must be provided for input_file {casted_file_param}"
277+
)
274278
out.append(
275279
File(
276280
type="file",
277281
file=FileFile(
278282
file_data=casted_file_param["file_data"],
283+
filename=casted_file_param["filename"],
279284
),
280285
)
281286
)

0 commit comments

Comments
 (0)