I’m getting this error: “openai.BadRequestError: Error code: 400 - {‘error’: {‘message’: “Unknown parameter: ‘attachments’.”, ‘type’: ‘invalid_request_error’, ‘param’: ‘attachments’, ‘code’: ‘unknown_parameter’}}” but my payload looks fine based off what you’re saying sps:
API Payload: {'thread_id': 'thread_tzYfdoF62ng0xZOuaoysWGAh', 'role': 'user', 'content': "Load the assigned dataset and send the message 'Dataset loaded' once complete", 'attachments': [{'file_id': 'assistant-28LGp2EGC11yUCD1VLB6qA0k', 'tools': [{'type': 'code_interpreter'}]}]}
If you are sending to the API without a library, the thread ID is not part of the body when adding a message; it is part of the URL:
POST https://api.openai.com/v1/threads/{thread_id}/messages
or for initial thread creation:
POST https://api.openai.com/v1/threads
Using the messages parameter at initial thread creation, and showing one of several messages possible there, this is how a file attachment is given within the list of attachments.
I’m running 1.53.0 of the Python library, not sure if that is causing the argument to not be recognized. I’m also using the Azure OpenAI Assistants client, the API version is 2024-02-15-preview, not sure if that also is causing the problem
You still are not sending the attachments correctly. Just compare the code block you pasted to what is immediately before, you’ll see “tools” objects is NOT replicated.
Azure requires particular regions and deployment for code interpreter.
You will want to bump the api up to as new as 2024-10-01-preview - remember, v2 header came significantly after your date.