-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Confirm this is an issue with the Python library and not an underlying OpenAI API
- This is an issue with the Python library
Describe the bug
Greetings fellows,
A migration guide for assistant file upload suggests using the following format:
"attachments": [
{
"file_id": "file-123",
"tools": [
{ "type": "file_search" },
{ "type": "code_interpreter" }
]
}
]
However, the API reference shows something else:
https://platform.openai.com/docs/api-reference/messages/createMessage#messages-createmessage-attachments
Whenever I am using the version explained in the migration guide, I get the following traceback:
Failed to run listener function (error: Error code: 400 - {'error': {'message': "Missing required parameter: 'attachments[0].tools'.", 'type': 'invalid_request_error', 'param': 'attachments[0].tools', 'code': 'missing_required_parameter'}})
To Reproduce
- Try to migrate existing code that uses assistants API with file uploads to the new version
- Get stuck. :(
Code snippets
I think, this is the suspected piece in the Python library that differs:
openai.types.beta.threads.message_create_params.Attachment
class Attachment(TypedDict, total=False):
add_to: List[Literal["file_search", "code_interpreter"]]
file_id: str
"""The ID of the file to attach to the message."""
It expects add_to
and not a tools
list.
OS
macOS
Python version
Python v3.12.1
Library version
openai v1.21.2
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working