Skip to content

Conversation

Nifury
Copy link
Contributor

@Nifury Nifury commented Aug 17, 2025

When a file is provided in base64 encoding, only the file_data part is converted to the chat completion API format.
However, now without the filename field, OpenAI returns
openai.BadRequestError: Error code: 400 - {'error': {'message': "Missing required parameter: 'messages[1].content[1].file.file_id'.", 'type': 'invalid_request_error', 'param': 'messages[1].content[1].file.file_id', 'code': 'missing_required_parameter'}}

@seratch seratch added feature:chat-completions bug Something isn't working labels Aug 18, 2025
Copy link
Member

@seratch seratch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this; I've confirmed this is a bug and your change resolves it.

@seratch seratch merged commit a4f7204 into openai:main Aug 18, 2025
5 checks passed
@ant31
Copy link
Contributor

ant31 commented Oct 1, 2025

The error was already explicit.

openai.BadRequestError: Error code: 400 - {'error': {'message': "Missing required parameter: 'messages[1].content[1].file.file_id'.", 'type': 'invalid_request_error', 'param': 'messages[1].content[1].file.file_id', 'code': 'missing_required_parameter'}}

Openai-agents is not exclusive to GPT.X/openai models, and many models are not requiring a filename to works with file_input.
This change enforce the to add filename, breaking existing and working code with models not requiring it.

if the model used is requiring filename, then error is already there and explicit and the enduser knows what to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature:chat-completions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants