Uploading file with streaming - problem to retrieve the file

Hey!
I tried to upload a file with file path and it worked properly and had been saved with ‘.md’ extension in the storage.

Then I uploaded a file with streaming and the file has been saved as ‘upload’ without any extension in the API storage.
When I tried to retrieve the data in that case I got this error:

raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - {'error': {'message': 'Files with extensions [none] are not supported for 
retrieval. See https://platform.openai.com/docs/assistants/tools/supported-files', 'type': 'invalid_request_error',
'param': None, 'code': 'unsupported_file'}}

I assume it is related to the idea that openai doesn’t recognize the ‘.md’ extension in the file name (the file name in that case is ‘upload’).

this is my upload part of code:

def create_file(client, file_stream, file_name):
    file = client.files.create(
        file=file_stream,
        purpose='assistants'
    )
    return file.id,

Does anyone know how to solve it?

I’m getting the same error, it was working fine but now it isn’t, I need a quick solution to it, I’m getting this issue in Assistants API:

openai.BadRequestError: Error code: 400 - {‘error’: {‘message’: ‘Files with extensions [none] are not supported for retrieval. See https://platform.openai.com/docs/assistants/tools/supported-files’, ‘type’: ‘invalid_request_error’, ‘param’: None, ‘code’: ‘unsupported_file’}}

Code:

assistant = client.beta.assistants.create(
    name=assistant_name,
    instructions=instructions,
    description=description,
    model=model_name,
    tools=[{"type": "retrieval"}],
    file_ids=new_file_ids
)
1 Like